class BootswatchRails::Generators::CleditorGenerator

Public Instance Methods

add_to_assets() click to toggle source
# File lib/generators/bootswatch_rails/cleditor/cleditor_generator.rb, line 13
def add_to_assets
  file = "app/assets/javascripts/application.js"
  inject_into_file file, "\n//= require jquery.cleditor", after: /require jquery_ujs$/
  file = "app/assets/stylesheets/application.css"
  inject_into_file file, " *= require jquery.cleditor\n", before: /^.*require_self/
end
add_to_view() click to toggle source
# File lib/generators/bootswatch_rails/cleditor/cleditor_generator.rb, line 20
def add_to_view
  file = "app/views/#{table_name}/index.html.erb"
  columns.each do |column|
    gsub_file file, / (#{name}\.#{column}) /, " raw(\\1) "
  end
  file = "app/views/#{table_name}/show.html.erb"
  columns.each do |column|
    gsub_file file, / (@#{name}\.#{column}) /, " raw(\\1) "
  end
  file = "app/views/#{table_name}/_form.html.erb"
  columns.each do |column|
    gsub_file file, / (:#{column}) /, " \\1, input_html: { class: 'cleditor' } "
  end
end