Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Generate default layout in engine with --mountable option

  • Loading branch information...
commit 232e37952d90a115273c798b8208c1c563a2c9d4 1 parent 779a60d
@drogus drogus authored
View
1  railties/lib/rails/generators/rails/app/app_generator.rb
@@ -284,6 +284,7 @@ def defined_app_const_base
def app_const_base
@app_const_base ||= defined_app_const_base || app_name.gsub(/\W/, '_').squeeze('_').camelize
end
+ alias :camelized :app_const_base
def app_const
@app_const ||= "#{app_const_base}::Application"
View
2  railties/lib/rails/generators/rails/app/templates/app/views/layouts/application.html.erb.tt
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html>
<head>
- <title><%= app_const_base %></title>
+ <title><%= camelized %></title>
<%%= stylesheet_link_tag :all %>
<%%= javascript_include_tag :defaults %>
<%%= csrf_meta_tags %>
View
6 railties/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb
@@ -8,7 +8,11 @@ def rakefile
end
def app
- directory "app" if options[:mountable]
+ if options[:mountable]
+ directory "app"
+ template "#{app_templates_dir}/app/views/layouts/application.html.erb.tt",
+ "app/views/layouts/#{name}/application.html.erb"
+ end
end
def readme
View
1  railties/test/generators/plugin_new_generator_test.rb
@@ -166,6 +166,7 @@ def test_create_mountable_application_with_mountable_option
assert_file "test/dummy/config/routes.rb", /mount Bukkits::Engine => "\/bukkits"/
assert_file "app/controllers/bukkits/application_controller.rb", /module Bukkits\n class ApplicationController < ActionController::Base/
assert_file "app/helpers/bukkits/application_helper.rb", /module Bukkits\n module ApplicationHelper/
+ assert_file "app/views/layouts/bukkits/application.html.erb", /<title>Bukkits<\/title>/
end
def test_passing_dummy_path_as_a_parameter
Please sign in to comment.
Something went wrong with that request. Please try again.