diff options
author | Piotr Sarnacki <drogus@gmail.com> | 2010-12-15 12:20:48 +0100 |
---|---|---|
committer | Vijay Dev <vijaydev.cse@gmail.com> | 2010-12-16 01:49:30 +0530 |
commit | ed32c8fe51e347bbccd6cce64b4b8d538c0a61aa (patch) | |
tree | 1007042c96daddac6234f83f394ffeaf26fc7b5e /railties/lib/rails/generators/rails | |
parent | 7f77d6691f567b33e23b515ad495071bef8f775e (diff) | |
download | rails-ed32c8fe51e347bbccd6cce64b4b8d538c0a61aa.tar.gz rails-ed32c8fe51e347bbccd6cce64b4b8d538c0a61aa.tar.bz2 rails-ed32c8fe51e347bbccd6cce64b4b8d538c0a61aa.zip |
Generate default layout in engine with --mountable option
Diffstat (limited to 'railties/lib/rails/generators/rails')
3 files changed, 7 insertions, 2 deletions
diff --git a/railties/lib/rails/generators/rails/app/app_generator.rb b/railties/lib/rails/generators/rails/app/app_generator.rb index d25372ea8e..d842797883 100644 --- a/railties/lib/rails/generators/rails/app/app_generator.rb +++ b/railties/lib/rails/generators/rails/app/app_generator.rb @@ -284,6 +284,7 @@ module Rails 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" diff --git a/railties/lib/rails/generators/rails/app/templates/app/views/layouts/application.html.erb.tt b/railties/lib/rails/generators/rails/app/templates/app/views/layouts/application.html.erb.tt index 1de78eecae..6d56c331c1 100644 --- a/railties/lib/rails/generators/rails/app/templates/app/views/layouts/application.html.erb.tt +++ b/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 %> diff --git a/railties/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb b/railties/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb index 47a84e228c..9461589ff5 100644 --- a/railties/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb +++ b/railties/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb @@ -8,7 +8,11 @@ module Rails 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 |