4

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.

Danil
  • 2,497
  • 2
  • 19
  • 27

4 Answers4

4

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.

  • I haven't looked at the gem, but in general you shouldn't *need* to include minified scripts in your manifests. Sprockets minifies for you. – jrhorn424 Nov 07 '13 at 06:21
3

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 :)

Community
  • 1
  • 1
Patrick Dougall
  • 346
  • 2
  • 12
0

I had a similar issue with this because of turbolinks. I just disabled its JS in applications.js:

//= require turbolinks

~to:

// require turbolinks

-until I figure out how to get them to play nicely together. At least for the Mercury pages, have to poke them somehow.

Colby Blair
  • 396
  • 4
  • 15
0

I have some issues too, it does seem to be an issue with Turbolinks. I was able to get by it by removing the line:

<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>

from my application.html.erb file, not sure if this will cause issues down the road