WYSIWYG image uploads in Rails App - ruby-on-rails

Can anyone recommend a way of creating a view where users can upload images to my app through a WYSIWYG editor?
I've tried solving this using CK Editor and Paperclip but am having lots of trouble... Maybe I'm going about this the wrong way.
If someone's done this before I'd really like to know how! I don't have a editor or file storage mechanism preference so fire away...

This is all dependent on the WYSIWYG's file upload API. From there, just build an ImagesController to handle requests from that API, use whatever system (Paperclip is good) to handle those files internally, and you should be good to go. You won't find a plug-and-play solution; you'll have to hand-roll it.
Turns out that, with more targeted Google searching, you can find a preexisting solution. Here's one for TinyMCE and Rails. You may, however, end up finding that it doesn't meet your needs, in which case I would not be surprised to find that creating your own solution would be simpler than you expect :)

You could try Bootsy. It's a WYSIWYG editor with image upload capability. Includes a (rather simple) image manager as well.
https://github.com/volmer/bootsy

There is an other solution for rails out there:
https://github.com/spohlenz/tinymce-rails
You can load it as gem and configure it via a yml file. And it comes with an extra language gem.

Related

Ruby On Rails: generate files on the fly in production

Update:
After looking more closely into the issue I think I am understanding the problem wrong. Since epub is essentially a zipped file I have to generate files at some point.
The actual question would be how to do this efficiently in production if the number of files and file size I need to generate become large?
The ebook content will be generated from entries in the database as html files. I am thinking about storing those files with Amazon S3 but I am not sure if that's the best option out there.
Original Question
I am trying to create a web-based epub generation application with Ruby On Rails.
Currently I am looking into the eeepub gem: https://github.com/jugyo/eeepub.
I am wondering if there is a way to feed the epub content from database without declaring files as shown in the example.
files [File.join(dir, 'foo.html'), File.join(dir, 'bar.html')]
There is an open issue regarding this:https://github.com/jugyo/eeepub/issues/17
from years ago....
I know the gem is very old and does not seem to be active at all. I have looked through the source code and still not seeing a solution. If anyone has any pointers on how to achieve this through eeepub or a better tool please help me out! Thanks in advance.
Hi #voidwalker You can check the best gems for e-publishing on Ruby-toolbox, here you can compare gems by their popularity and activity.
from this list I think the Git-scribe is the best gem as per your requirement. Please try it and let me know if it's helpful.
Thanks

Can an admin template be used in a Ruby on Rails web app?

I have been doing UI research and have come across admin templates at http://themeforest.net/. I was wondering how do you apply these onto a web app built on Rails. These templates look very similar to wordpress themes. Are they that easy to configure? Is it just as simple as setting up a link to the database to make the fields form capture data? I've been looking at this theme.
For admin templates I recommend using Active Admin. It's relatively easy to implement and gives you great admin screens with little effort.
Yes, You can. I'm trying to solve the same problem and so far I have a couple options:
1.) do it by hand, I've done this before, it works but takes a lot of time to truly understand how your theme is put together. First I would recommend using the included themes assets exactly as they are bundled with the theme. Don't assume that just because you have twitter-bootstrap-rails gem that the bootstrap classes in the theme will work. Link the assets statically and slowly extract out the static assets and replace them in the asset pipeline once you know they work.
2.) Use the strategy suggested in the install_theme gem (http://drnicwilliams.com/2009/10/06/install-any-html-themetemplate-into-your-rails-app/) the gem itself is not maintained any longer (i'm not sure about any forks), but the strategy is sound. Extract the core parts of the template into partials.
The short answer is yes, but there is no straight forward way to "import to rails"

WYSIWYG recommendations for my Rails app

I'm working on a Rails project and I'm in need of a user-friendly WYSIWYG. I'll say this about the type of people using it: Whatever you think of as user-friendly, perhaps think one step below that (not an insult, just a realization).
Ideally, I'd like something where one could have basic functionality (lists, links, bold, italic) and see in real-time. Kind of like OH MY GOSH IT'S RIGHT HERE IN STACK OVERFLOW AS I CREATE THIS POST.
So, um, yeah: something like this would be excellent (although I'd prefer the windows be side-by-side rather than this editor-on-top situation, but I won't be picky).
I'd suggest to use gem ckeditor it's really perfect solution, i used it recently in my Rails 3.2 project
A pretty cool and fancy one is Sir Trevor JS. There is also a gem
We use TinyMCE quite a bit.
No unbelievable feature set or anything, but it does have a nice jQuery integration plugin (which goes a long way for us).
The live preview functionality seems very doable.
If your project is non commercial you can use this
Froala
I've been using Bootsy. It's simple and easy to use, however I have not been able to get the "image" upload => carrierwave to store on S3 servers. But everything else with it is fantastic.
Use Trix by Basecamp:
Trix is an open-source project from Basecamp, the creators of Ruby on Rails. Millions of people trust their text to Basecamp, and we built Trix to give them the best possible editing experience.
You can use Mercury its a full featured HTML5 editor
gem 'mercury-rails'
rails generate mercury:install
http://jejacks0n.github.io/mercury/
github: https://github.com/jejacks0n/mercury
Old question but check out froala: https://github.com/froala/wysiwyg-rails
and the plugins main homepage https://www.froala.com/wysiwyg-editor

uploading a file with rail - what is the best approach

I have a requirement of uploading a file to my disk through my webpage. Seems like I have two options
My requirement is specific that I will upload ONLY text files.
Using default rails methods to upload a file.
Ex: http://www.tutorialspoint.com/ruby-on-rails/rails-file-uploading.htm
Using a plugin like 'PaperClip'
Following are my concerns:
I want to keep the file upload as simple as possible
Keep as away as dependencies like Imagemagic etc
I'm using rails 2.8.3
concurrent file uploads can be happen by multiple users
please can someone tell me what are the pros and cons of having
writing a simple file upload (option 1)
using a plugin/gem to upload a files
Writing your own file uploader is an option, but using a pre-built gem provides you with all of the code you need, straight after install.
Gems will usually have all of the functionality packaged into them that handles all of the cross-platform issues and security headaches your likely to run into by writing something from scratch. A well maintained gem will also have a good community behind it, keeping things up to date.
The popular Gems out there are really easy to use, and unless you are resizing images etc, you shouldn't need ImageMagick installed. Have a look at these:
http://railscasts.com/episodes/134-paperclip
https://github.com/technoweenie/attachment_fu/wiki
Paperclip is far easier to build a simple upload form with, but I'm not sure if it works on Rails 2. Attachment_fu is an old favorite from the Rails 2 days and will definitely be able to handle your problem, it just requires a little more configuration.

rails + attachment_fu: issue with files in directories

I use attachment_fu for my rails app. It's great for me.
However, the designer who works with me complains about it because it saves files in different directory. She said that she can't handle those files efficiently with Photoshop as they are scattered.
I tried to persuade her with the following reasons.
We can avoid file name clash
It's faster than when they are in the same directory
But I couldn't convince her. How would you? Or are you with her? If so, why?
Sam
I think Adobe Photoshop has a built-in utility called 'Bridge' which allows easy asset management, might be worth having a look.

Resources