Class: VerySimpleCms::InitMercuryGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/very_simple_cms/init_mercury/init_mercury_generator.rb

Instance Method Summary collapse

Instance Method Details

#appent_to_mercuryObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/generators/very_simple_cms/init_mercury/init_mercury_generator.rb', line 4

def appent_to_mercury
  append_to_file "app/assets/javascripts/mercury.js" do
    "
    $(window).on('mercury:ready', function() {
      var link = $('.admin_edit_link');

      if(Mercury.saveUrl !== null) { 
        Mercury.saveUrl = link.attr('data-save-url');
      }
      link.hide(Mercury.saveUrl);
    });

    $(window).on('mercury:saved', function() {
      window.location = window.location.href.replace(/\\/editor\\//i, '/');
    });
    "
  end
end