class SimpleDatatable::InstallGenerator

Constants

CSS_PATH
HELPER_PATH
JS_PATH

Public Instance Methods

add_datatable_bootstrap_javascripts() click to toggle source
# File lib/generators/simple_datatable/install/install_generator.rb, line 31
    def add_datatable_bootstrap_javascripts
      return unless @use_bootstrap

      append_to_file JS_PATH do
        <<-'RUBY'
//= require simple_datatable/dataTables.bootstrap
        RUBY
      end
    end
add_datatable_bootstrap_stylesheets() click to toggle source
# File lib/generators/simple_datatable/install/install_generator.rb, line 12
    def add_datatable_bootstrap_stylesheets
      return unless @use_bootstrap

      inject_into_file CSS_PATH, before: " */" do
        <<-'RUBY'
 *= require simple_datatable/bootstrap
 *= require simple_datatable/dataTables.bootstrap
        RUBY
      end
    end
add_datatable_javascripts() click to toggle source
# File lib/generators/simple_datatable/install/install_generator.rb, line 23
    def add_datatable_javascripts
      append_to_file JS_PATH do
        <<-'RUBY'
//= require simple_datatable/jquery.dataTables.min
        RUBY
      end
    end
add_helper() click to toggle source
# File lib/generators/simple_datatable/install/install_generator.rb, line 41
    def add_helper
      inject_into_file HELPER_PATH, after: "module ApplicationHelper\n" do
        <<-'RUBY'
  include SimpleDatatable::ApplicationHelper
        RUBY
      end
    end
has_use_bootstrap() click to toggle source
# File lib/generators/simple_datatable/install/install_generator.rb, line 8
def has_use_bootstrap
  @use_bootstrap = yes? 'Would you like to add Bootstrap 3 stylesheet?'
end
init_datatable() click to toggle source
# File lib/generators/simple_datatable/install/install_generator.rb, line 49
    def init_datatable
      append_to_file JS_PATH do
        <<-'RUBY'

jQuery(document).ready(function(){
  $('.dataTable').dataTable();
});
        RUBY
      end
    end