提交 232e3795 编写于 作者: P Piotr Sarnacki

Generate default layout in engine with --mountable option

上级 779a60de
......@@ -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"
......
<!DOCTYPE html>
<html>
<head>
<title><%= app_const_base %></title>
<title><%= camelized %></title>
<%%= stylesheet_link_tag :all %>
<%%= javascript_include_tag :defaults %>
<%%= csrf_meta_tags %>
......
......@@ -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
......
......@@ -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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册