lib/generators/blacklight/controller_generator.rb in blacklight-6.0.2 vs lib/generators/blacklight/controller_generator.rb in blacklight-6.1.0
- old
+ new
@@ -4,39 +4,37 @@
source_root File.expand_path('../templates', __FILE__)
argument :controller_name , type: :string , default: "catalog"
- desc """
- This generator makes the following changes to your application:
- 1. Injects behavior into your user application_controller.rb
- 2. Creates a Blacklight::Catalog-based controller
- 3. Adds routes for your controller
+ desc <<-EOS
+ This generator makes the following changes to your application:
+ 1. Injects behavior into your user application_controller.rb
+ 2. Creates a Blacklight::Catalog-based controller
+ 3. Adds routes for your controller
+ EOS
- Thank you for Installing Blacklight.
- """
-
# Add Blacklight to the application controller
def inject_blacklight_controller_behavior
inject_into_class "app/controllers/application_controller.rb", "ApplicationController" do
- " # Adds a few additional behaviors into the application controller \n" +
- " include Blacklight::Controller\n" +
+ " # Adds a few additional behaviors into the application controller\n" \
+ " include Blacklight::Controller\n" \
" layout 'blacklight'\n\n"
end
end
# Generate blacklight catalog controller
def create_blacklight_catalog
template "catalog_controller.rb", "app/controllers/#{controller_name}_controller.rb"
end
def inject_blacklight_routes
- route <<-EOF.strip_heredoc
- concern :searchable, Blacklight::Routes::Searchable.new
+ route <<-EOF
+ concern :searchable, Blacklight::Routes::Searchable.new
- resource :catalog, only: [:index], as: 'catalog', path: '/catalog', controller: 'catalog' do
- concerns :searchable
- end
+ resource :catalog, only: [:index], as: 'catalog', path: '/catalog', controller: 'catalog' do
+ concerns :searchable
+ end
EOF
end
end
end