class AjaxModalRails::InstallGenerator

Public Class Methods

default_layout() click to toggle source
# File lib/generators/ajax_modal_rails/install/install_generator.rb, line 3
def self.default_layout
  begin
    Haml
    return find_default_haml_layout
  rescue NameError
    return 'app/views/layouts/application.html.erb'
  end
end

Private Class Methods

find_default_haml_layout() click to toggle source
# File lib/generators/ajax_modal_rails/install/install_generator.rb, line 38
def self.find_default_haml_layout
  Dir.glob('app/views/layouts/application{.html,}.haml').first
end

Public Instance Methods

install() click to toggle source
# File lib/generators/ajax_modal_rails/install/install_generator.rb, line 18
def install
  install_layout unless options.skip_layout?
  install_javascript unless options.skip_javascript?
end

Private Instance Methods

install_javascript() click to toggle source
# File lib/generators/ajax_modal_rails/install/install_generator.rb, line 34
def install_javascript
  append_to_file 'app/assets/javascripts/application.js', '//= require ajax_modal_rails'
end
install_layout() click to toggle source
# File lib/generators/ajax_modal_rails/install/install_generator.rb, line 25
def install_layout
  begin
    Haml
    append_to_file options.layout, File.read(File.expand_path('../templates/render_ajax_modal_frame.html.haml', __FILE__))
  rescue NameError
    insert_into_file options.layout, File.read(File.expand_path('../templates/render_ajax_modal_frame.html.erb', __FILE__)), before: '</body>'
  end
end