diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2007-05-06 10:34:18 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2007-05-06 10:34:18 +0000 |
commit | c7befb896e72e6087d2d413990d319c990154c7e (patch) | |
tree | a6cde8d298baf86cdca519e67fe367a9a9274d6b | |
parent | e4c5ddd83954a04be72f738f2f1c60739aacdd76 (diff) | |
download | rails-c7befb896e72e6087d2d413990d319c990154c7e.tar.gz rails-c7befb896e72e6087d2d413990d319c990154c7e.tar.bz2 rails-c7befb896e72e6087d2d413990d319c990154c7e.zip |
Generators use *.html.erb view template naming. Closes #8278.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6690 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
27 files changed, 21 insertions, 19 deletions
diff --git a/railties/CHANGELOG b/railties/CHANGELOG index ee72dec0bc..408253cb6e 100644 --- a/railties/CHANGELOG +++ b/railties/CHANGELOG @@ -1,5 +1,7 @@ *SVN* +* Generators use *.html.erb view template naming. #8278 [Tim Pope] + * Updated resource_scaffold and model generators to use short-hand style migrations [DHH] * Updated initializer to only load #{RAILS_ENV}.rb once. Added deprecation warning for config.breakpoint_server. [Nicholas Seckar] diff --git a/railties/lib/rails_generator/generators/components/controller/USAGE b/railties/lib/rails_generator/generators/components/controller/USAGE index ae7b8e022b..246a3d652b 100644 --- a/railties/lib/rails_generator/generators/components/controller/USAGE +++ b/railties/lib/rails_generator/generators/components/controller/USAGE @@ -15,7 +15,7 @@ Example: Credit card controller with URLs like /credit_card/debit. Controller: app/controllers/credit_card_controller.rb - Views: app/views/credit_card/debit.erb [...] + Views: app/views/credit_card/debit.html.erb [...] Helper: app/helpers/credit_card_helper.rb Test: test/functional/credit_card_controller_test.rb @@ -24,7 +24,7 @@ Modules Example: Credit card admin controller with URLs /admin/credit_card/suspend. Controller: app/controllers/admin/credit_card_controller.rb - Views: app/views/admin/credit_card/debit.erb [...] + Views: app/views/admin/credit_card/debit.html.erb [...] Helper: app/helpers/admin/credit_card_helper.rb Test: test/functional/admin/credit_card_controller_test.rb diff --git a/railties/lib/rails_generator/generators/components/controller/controller_generator.rb b/railties/lib/rails_generator/generators/components/controller/controller_generator.rb index f73e5a41b0..c37ff45836 100644 --- a/railties/lib/rails_generator/generators/components/controller/controller_generator.rb +++ b/railties/lib/rails_generator/generators/components/controller/controller_generator.rb @@ -28,8 +28,8 @@ class ControllerGenerator < Rails::Generator::NamedBase # View template for each action. actions.each do |action| - path = File.join('app/views', class_path, file_name, "#{action}.erb") - m.template 'view.erb', path, + path = File.join('app/views', class_path, file_name, "#{action}.html.erb") + m.template 'view.html.erb', path, :assigns => { :action => action, :path => path } end end diff --git a/railties/lib/rails_generator/generators/components/controller/templates/view.erb b/railties/lib/rails_generator/generators/components/controller/templates/view.html.erb index ad85431f98..ad85431f98 100644 --- a/railties/lib/rails_generator/generators/components/controller/templates/view.erb +++ b/railties/lib/rails_generator/generators/components/controller/templates/view.html.erb diff --git a/railties/lib/rails_generator/generators/components/controller/templates/view.rhtml b/railties/lib/rails_generator/generators/components/controller/templates/view.rhtml deleted file mode 100644 index e69de29bb2..0000000000 --- a/railties/lib/rails_generator/generators/components/controller/templates/view.rhtml +++ /dev/null diff --git a/railties/lib/rails_generator/generators/components/scaffold/scaffold_generator.rb b/railties/lib/rails_generator/generators/components/scaffold/scaffold_generator.rb index 855f9119d5..a3650c7e3a 100644 --- a/railties/lib/rails_generator/generators/components/scaffold/scaffold_generator.rb +++ b/railties/lib/rails_generator/generators/components/scaffold/scaffold_generator.rb @@ -81,12 +81,12 @@ class ScaffoldGenerator < Rails::Generator::NamedBase m.dependency 'model', [singular_name], :collision => :skip, :skip_migration => true # Scaffolded forms. - m.complex_template "form.erb", + m.complex_template "form.html.erb", File.join('app/views', controller_class_path, controller_file_name, - "_form.erb"), - :insert => 'form_scaffolding.erb', + "_form.html.erb"), + :insert => 'form_scaffolding.html.erb', :sandbox => lambda { create_sandbox }, :begin_mark => 'form', :end_mark => 'eoform', @@ -95,11 +95,11 @@ class ScaffoldGenerator < Rails::Generator::NamedBase # Scaffolded views. scaffold_views.each do |action| - m.template "view_#{action}.erb", + m.template "view_#{action}.html.erb", File.join('app/views', controller_class_path, controller_file_name, - "#{action}.erb"), + "#{action}.html.erb"), :assigns => { :action => action } end @@ -120,10 +120,10 @@ class ScaffoldGenerator < Rails::Generator::NamedBase "#{controller_file_name}_helper.rb") # Layout and stylesheet. - m.template 'layout.erb', + m.template 'layout.html.erb', File.join('app/views/layouts', controller_class_path, - "#{controller_file_name}.erb") + "#{controller_file_name}.html.erb") m.template 'style.css', 'public/stylesheets/scaffold.css' @@ -133,8 +133,8 @@ class ScaffoldGenerator < Rails::Generator::NamedBase path = File.join('app/views', controller_class_path, controller_file_name, - "#{action}.erb") - m.template "controller:view.erb", path, + "#{action}.html.erb") + m.template "controller:view.html.erb", path, :assigns => { :action => action, :path => path} end end diff --git a/railties/lib/rails_generator/generators/components/scaffold/templates/form.erb b/railties/lib/rails_generator/generators/components/scaffold/templates/form.html.erb index d15f0d4ec2..d15f0d4ec2 100644 --- a/railties/lib/rails_generator/generators/components/scaffold/templates/form.erb +++ b/railties/lib/rails_generator/generators/components/scaffold/templates/form.html.erb diff --git a/railties/lib/rails_generator/generators/components/scaffold/templates/form.rhtml b/railties/lib/rails_generator/generators/components/scaffold/templates/form.rhtml deleted file mode 100644 index e69de29bb2..0000000000 --- a/railties/lib/rails_generator/generators/components/scaffold/templates/form.rhtml +++ /dev/null diff --git a/railties/lib/rails_generator/generators/components/scaffold/templates/form_scaffolding.erb b/railties/lib/rails_generator/generators/components/scaffold/templates/form_scaffolding.html.erb index c7a87553ac..c7a87553ac 100644 --- a/railties/lib/rails_generator/generators/components/scaffold/templates/form_scaffolding.erb +++ b/railties/lib/rails_generator/generators/components/scaffold/templates/form_scaffolding.html.erb diff --git a/railties/lib/rails_generator/generators/components/scaffold/templates/form_scaffolding.rhtml b/railties/lib/rails_generator/generators/components/scaffold/templates/form_scaffolding.rhtml deleted file mode 100644 index e69de29bb2..0000000000 --- a/railties/lib/rails_generator/generators/components/scaffold/templates/form_scaffolding.rhtml +++ /dev/null diff --git a/railties/lib/rails_generator/generators/components/scaffold/templates/layout.erb b/railties/lib/rails_generator/generators/components/scaffold/templates/layout.html.erb index 5c1f304232..5c1f304232 100644 --- a/railties/lib/rails_generator/generators/components/scaffold/templates/layout.erb +++ b/railties/lib/rails_generator/generators/components/scaffold/templates/layout.html.erb diff --git a/railties/lib/rails_generator/generators/components/scaffold/templates/layout.rhtml b/railties/lib/rails_generator/generators/components/scaffold/templates/layout.rhtml deleted file mode 100644 index e69de29bb2..0000000000 --- a/railties/lib/rails_generator/generators/components/scaffold/templates/layout.rhtml +++ /dev/null diff --git a/railties/lib/rails_generator/generators/components/scaffold/templates/view_edit.erb b/railties/lib/rails_generator/generators/components/scaffold/templates/view_edit.html.erb index a86aa0b0d5..a86aa0b0d5 100644 --- a/railties/lib/rails_generator/generators/components/scaffold/templates/view_edit.erb +++ b/railties/lib/rails_generator/generators/components/scaffold/templates/view_edit.html.erb diff --git a/railties/lib/rails_generator/generators/components/scaffold/templates/view_edit.rhtml b/railties/lib/rails_generator/generators/components/scaffold/templates/view_edit.rhtml deleted file mode 100644 index e69de29bb2..0000000000 --- a/railties/lib/rails_generator/generators/components/scaffold/templates/view_edit.rhtml +++ /dev/null diff --git a/railties/lib/rails_generator/generators/components/scaffold/templates/view_list.erb b/railties/lib/rails_generator/generators/components/scaffold/templates/view_list.html.erb index 3e2a414485..3e2a414485 100644 --- a/railties/lib/rails_generator/generators/components/scaffold/templates/view_list.erb +++ b/railties/lib/rails_generator/generators/components/scaffold/templates/view_list.html.erb diff --git a/railties/lib/rails_generator/generators/components/scaffold/templates/view_list.rhtml b/railties/lib/rails_generator/generators/components/scaffold/templates/view_list.rhtml deleted file mode 100644 index e69de29bb2..0000000000 --- a/railties/lib/rails_generator/generators/components/scaffold/templates/view_list.rhtml +++ /dev/null diff --git a/railties/lib/rails_generator/generators/components/scaffold/templates/view_new.erb b/railties/lib/rails_generator/generators/components/scaffold/templates/view_new.html.erb index 8222ea622f..8222ea622f 100644 --- a/railties/lib/rails_generator/generators/components/scaffold/templates/view_new.erb +++ b/railties/lib/rails_generator/generators/components/scaffold/templates/view_new.html.erb diff --git a/railties/lib/rails_generator/generators/components/scaffold/templates/view_new.rhtml b/railties/lib/rails_generator/generators/components/scaffold/templates/view_new.rhtml deleted file mode 100644 index e69de29bb2..0000000000 --- a/railties/lib/rails_generator/generators/components/scaffold/templates/view_new.rhtml +++ /dev/null diff --git a/railties/lib/rails_generator/generators/components/scaffold/templates/view_show.erb b/railties/lib/rails_generator/generators/components/scaffold/templates/view_show.html.erb index c9245cdfda..c9245cdfda 100644 --- a/railties/lib/rails_generator/generators/components/scaffold/templates/view_show.erb +++ b/railties/lib/rails_generator/generators/components/scaffold/templates/view_show.html.erb diff --git a/railties/lib/rails_generator/generators/components/scaffold/templates/view_show.rhtml b/railties/lib/rails_generator/generators/components/scaffold/templates/view_show.rhtml deleted file mode 100644 index e69de29bb2..0000000000 --- a/railties/lib/rails_generator/generators/components/scaffold/templates/view_show.rhtml +++ /dev/null diff --git a/railties/lib/rails_generator/generators/components/scaffold_resource/scaffold_resource_generator.rb b/railties/lib/rails_generator/generators/components/scaffold_resource/scaffold_resource_generator.rb index 502df6a567..a10f7f12b3 100644 --- a/railties/lib/rails_generator/generators/components/scaffold_resource/scaffold_resource_generator.rb +++ b/railties/lib/rails_generator/generators/components/scaffold_resource/scaffold_resource_generator.rb @@ -41,13 +41,13 @@ class ScaffoldResourceGenerator < Rails::Generator::NamedBase for action in scaffold_views m.template( - "view_#{action}.erb", - File.join('app/views', controller_class_path, controller_file_name, "#{action}.erb") + "view_#{action}.html.erb", + File.join('app/views', controller_class_path, controller_file_name, "#{action}.html.erb") ) end # Layout and stylesheet. - m.template('layout.erb', File.join('app/views/layouts', controller_class_path, "#{controller_file_name}.erb")) + m.template('layout.html.erb', File.join('app/views/layouts', controller_class_path, "#{controller_file_name}.html.erb")) m.template('style.css', 'public/stylesheets/scaffold.css') m.template('model.rb', File.join('app/models', class_path, "#{file_name}.rb")) diff --git a/railties/lib/rails_generator/generators/components/scaffold_resource/templates/controller.rb b/railties/lib/rails_generator/generators/components/scaffold_resource/templates/controller.rb index ac53b6c10d..f28f364af0 100644 --- a/railties/lib/rails_generator/generators/components/scaffold_resource/templates/controller.rb +++ b/railties/lib/rails_generator/generators/components/scaffold_resource/templates/controller.rb @@ -5,7 +5,7 @@ class <%= controller_class_name %>Controller < ApplicationController @<%= table_name %> = <%= class_name %>.find(:all) respond_to do |format| - format.html # index.erb + format.html # index.html.erb format.xml { render :xml => @<%= table_name %> } end end @@ -16,7 +16,7 @@ class <%= controller_class_name %>Controller < ApplicationController @<%= file_name %> = <%= class_name %>.find(params[:id]) respond_to do |format| - format.html # show.erb + format.html # show.html.erb format.xml { render :xml => @<%= file_name %> } end end @@ -27,7 +27,7 @@ class <%= controller_class_name %>Controller < ApplicationController @<%= file_name %> = <%= class_name %>.new respond_to do |format| - format.html # new.erb + format.html # new.html.erb format.xml { render :xml => @<%= file_name %> } end end diff --git a/railties/lib/rails_generator/generators/components/scaffold_resource/templates/layout.erb b/railties/lib/rails_generator/generators/components/scaffold_resource/templates/layout.html.erb index 5c1f304232..5c1f304232 100644 --- a/railties/lib/rails_generator/generators/components/scaffold_resource/templates/layout.erb +++ b/railties/lib/rails_generator/generators/components/scaffold_resource/templates/layout.html.erb diff --git a/railties/lib/rails_generator/generators/components/scaffold_resource/templates/view_edit.erb b/railties/lib/rails_generator/generators/components/scaffold_resource/templates/view_edit.html.erb index bf165e02be..bf165e02be 100644 --- a/railties/lib/rails_generator/generators/components/scaffold_resource/templates/view_edit.erb +++ b/railties/lib/rails_generator/generators/components/scaffold_resource/templates/view_edit.html.erb diff --git a/railties/lib/rails_generator/generators/components/scaffold_resource/templates/view_index.erb b/railties/lib/rails_generator/generators/components/scaffold_resource/templates/view_index.html.erb index 9ad899465c..9ad899465c 100644 --- a/railties/lib/rails_generator/generators/components/scaffold_resource/templates/view_index.erb +++ b/railties/lib/rails_generator/generators/components/scaffold_resource/templates/view_index.html.erb diff --git a/railties/lib/rails_generator/generators/components/scaffold_resource/templates/view_new.erb b/railties/lib/rails_generator/generators/components/scaffold_resource/templates/view_new.html.erb index b3b6f91453..b3b6f91453 100644 --- a/railties/lib/rails_generator/generators/components/scaffold_resource/templates/view_new.erb +++ b/railties/lib/rails_generator/generators/components/scaffold_resource/templates/view_new.html.erb diff --git a/railties/lib/rails_generator/generators/components/scaffold_resource/templates/view_show.erb b/railties/lib/rails_generator/generators/components/scaffold_resource/templates/view_show.html.erb index adecaf70c6..adecaf70c6 100644 --- a/railties/lib/rails_generator/generators/components/scaffold_resource/templates/view_show.erb +++ b/railties/lib/rails_generator/generators/components/scaffold_resource/templates/view_show.html.erb |