Sha256: cc0dcafa96b5661ff09ab1fe90b7b7ebeb1d3f91c9fcc8b5d53e76124094f9da

Contents?: true

Size: 671 Bytes

Versions: 3

Compression:

Stored size: 671 Bytes

Contents

module VerySimpleCms
  class InitMercuryGenerator < Rails::Generators::Base
    source_root File.expand_path('../templates', __FILE__)
    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
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
very_simple_cms-0.0.3 lib/generators/very_simple_cms/init_mercury/init_mercury_generator.rb
very_simple_cms-0.0.2 lib/generators/very_simple_cms/init_mercury/init_mercury_generator.rb
very_simple_cms-0.0.1 lib/generators/very_simple_cms/init_mercury/init_mercury_generator.rb