Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mercury Editor with rails4

i'm wondering how to use mercury gem with rails4. i tried to follow guide http://asciicasts.com/episodes/296-mercury-editor if i load page within editor ( /editor/pages/1) i see error in javascript console:

Uncaught TypeError: Cannot read property 'konqueror' of undefined

and mercury-region isn't visible at page at all

Gemfile:

gem 'mercury-rails', github: 'jejacks0n/mercury'

app/views/pages/show.html.erb:

<div id="page_body" class="mercury-region" data-type="editable">
  <%= raw(@page.body) %>
</div>

after some delay i get javascript alert with message:

Mercury.PageEditor failed to load: Region type is malformed, no data-type provided, or "Full" is unknown for the "page_body" region.

Please try refreshing.

like image 531
Danil Avatar asked Mar 22 '23 17:03

Danil


2 Answers

mercury is utilising jquery.browser this method is deprecated in the most recent update.

If you include gem 'jquery-migrate-rails' in your gemfile that you should work favourably until mercury updates it's code to the latest jquery or at least 1.9

You'll need to add //= require jquery-migrate-min to your application.js after jquery is loaded.

like image 163
Christian Ramsey Avatar answered Mar 29 '23 23:03

Christian Ramsey


I just had the same issue. I describe it better in my own question here, but basically the issue comes from a deprecated jquery method calling 'konqueror'. I don't think it had anything to do with your app being in rails 4 btw. I'm in gem 'rails', '3.2.13'

I'd up-vote the question but apparently I need more reputation. hint, hint :)

like image 37
Patrick Dougall Avatar answered Mar 30 '23 00:03

Patrick Dougall