PerfectlyNormal / tinymce-rails-imageupload

Image upload plugin for TinyMCE and Rails with the asset pipeline
MIT License
149 stars 154 forks source link

Rake Don't know how to build task 'assets:precompile:primary', (and fix...) #90

Closed ghost closed 6 years ago

ghost commented 7 years ago

I recently used this gem and the tinymce-rails gem, and got image uploading working with carrierwave, more or less following this guide. I also of course had to add the post '/tinymce_assets/' => 'tinymce_assets#create' route to the routes.rb file.

Initially that did not work, so I manually put the tinymce folder and files into the assets folder of the app, as explained in the readme.

That worked, but when uploading to heroku, failed....as it could not rake. I also could not rake locally. Locally it complained about not knowing how to build "assets:precompile:primary"

A little digging later and I discovered that assets:precompile:primary has been removed.

assets:precompile:primary and assets:precompile:all have been removed. Use assets:precompile instead. The config.assets.compress option should be changed to config.assets.js_compressor like so for instance...

So, I went in by hand to the rake task file at /usr/lib/ruby/gems/2.4.0/gems/tinymce-rails-imageupload-3.5.8.3/lib/tasks/tinymce-uploadimage-assets.rake and manually made the change from assets:precompile:primary to assets:precompile.

Rake would now rake just fine, but at this point the plugin acted weird. Wouldn't update properly. The language wasn't rendering, even in english, and the app still could not find the tinymce.js file if i moved the hard coded tinymce folder out of assets. Images couldn't be uploaded or rendered.

Moved the folder back, still no dice.

Dug through my bit bucket, found my original addition to app/config/routes.rb:

post '/tinymce_assets/' => 'tinymce_assets#create', :trailing_slash => false

My current file was missing the trailing_slash false part...

so I restored that, and put the tinymce folder with the plugins.js in it back in the javascript assets folder, and images are now back in action, but languages not so much....and that is where I am at now.

I don't know enough js to just hardcode the english, so all my characters are currently squares. If I can get a bit of help on that, and you are willing to walk me through a pull request, this fix could be my first contribution to open source software.

Regards, JW

PerfectlyNormal commented 6 years ago

Hi

I'm terrible at responding, so sorry for the extreme delay. I don't use this library any more, and I don't have a working app.

I created, once upon a time, two demo apps: https://github.com/PerfectlyNormal/tinymce-rails-imageupload-demo and https://github.com/PerfectlyNormal/tinymce-rails-imageupload-demo3 that worked fine the last time I tested it.

Feel free to have a look at those and see if you get it working

I don't know why you get the assets:precompile:primary errors, as it should check if it exists and fall back to assets:precompile if it doesn't. As that task seems to have been gone for a long while, feel free to make a pull-request with your changes to always use assets:precompile instead.