diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2007-02-21 00:29:44 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2007-02-21 00:29:44 +0000 |
commit | 21187c0fb4fc559927a2f947f909dedd85969ffb (patch) | |
tree | efd0ceb5c3a88531916186e97aa106041c293975 /railties/lib | |
parent | b5419cd66ea160d1ee94f3ca521bb44adf3a21ca (diff) | |
download | rails-21187c0fb4fc559927a2f947f909dedd85969ffb.tar.gz rails-21187c0fb4fc559927a2f947f909dedd85969ffb.tar.bz2 rails-21187c0fb4fc559927a2f947f909dedd85969ffb.zip |
Apply the rest of Chads patch
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6180 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'railties/lib')
38 files changed, 192 insertions, 192 deletions
diff --git a/railties/lib/rails_generator/commands.rb b/railties/lib/rails_generator/commands.rb index d9c471a915..db9a087f29 100644 --- a/railties/lib/rails_generator/commands.rb +++ b/railties/lib/rails_generator/commands.rb @@ -559,7 +559,7 @@ end_message return end - logger.refreshing "#{template_options[:insert].gsub(/\.rhtml/,'')} inside #{relative_destination}" + logger.refreshing "#{template_options[:insert].gsub(/\.erb/,'')} inside #{relative_destination}" begin_mark = Regexp.quote(template_part_mark(template_options[:begin_mark], template_options[:mark_id])) end_mark = Regexp.quote(template_part_mark(template_options[:end_mark], template_options[:mark_id])) diff --git a/railties/lib/rails_generator/generators/components/controller/USAGE b/railties/lib/rails_generator/generators/components/controller/USAGE index ec64209135..ae7b8e022b 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.rhtml [...] + Views: app/views/credit_card/debit.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.rhtml [...] + Views: app/views/admin/credit_card/debit.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 c6703b4a17..f73e5a41b0 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}.rhtml") - m.template 'view.rhtml', path, + path = File.join('app/views', class_path, file_name, "#{action}.erb") + m.template 'view.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.erb new file mode 100644 index 0000000000..ad85431f98 --- /dev/null +++ b/railties/lib/rails_generator/generators/components/controller/templates/view.erb @@ -0,0 +1,2 @@ +<h1><%= class_name %>#<%= action %></h1> +<p>Find me in <%= path %></p> diff --git a/railties/lib/rails_generator/generators/components/controller/templates/view.rhtml b/railties/lib/rails_generator/generators/components/controller/templates/view.rhtml index ad85431f98..e69de29bb2 100644 --- a/railties/lib/rails_generator/generators/components/controller/templates/view.rhtml +++ b/railties/lib/rails_generator/generators/components/controller/templates/view.rhtml @@ -1,2 +0,0 @@ -<h1><%= class_name %>#<%= action %></h1> -<p>Find me in <%= path %></p> diff --git a/railties/lib/rails_generator/generators/components/mailer/USAGE b/railties/lib/rails_generator/generators/components/mailer/USAGE index f3c295ebd3..8224a25190 100644 --- a/railties/lib/rails_generator/generators/components/mailer/USAGE +++ b/railties/lib/rails_generator/generators/components/mailer/USAGE @@ -12,7 +12,7 @@ Example: This will create a Notifications mailer class: Mailer: app/models/notifications.rb - Views: app/views/notifications/signup.rhtml [...] + Views: app/views/notifications/signup.erb [...] Test: test/unit/test/unit/notifications_test.rb Fixtures: test/fixtures/notifications/signup [...] diff --git a/railties/lib/rails_generator/generators/components/mailer/mailer_generator.rb b/railties/lib/rails_generator/generators/components/mailer/mailer_generator.rb index 764707da4c..3ff4f03972 100644 --- a/railties/lib/rails_generator/generators/components/mailer/mailer_generator.rb +++ b/railties/lib/rails_generator/generators/components/mailer/mailer_generator.rb @@ -21,12 +21,12 @@ class MailerGenerator < Rails::Generator::NamedBase # View template and fixture for each action. actions.each do |action| relative_path = File.join(file_path, action) - view_path = File.join('app/views', "#{relative_path}.rhtml") + view_path = File.join('app/views', "#{relative_path}.erb") fixture_path = File.join('test/fixtures', relative_path) - m.template "view.rhtml", view_path, + m.template "view.erb", view_path, :assigns => { :action => action, :path => view_path } - m.template "fixture.rhtml", fixture_path, + m.template "fixture.erb", fixture_path, :assigns => { :action => action, :path => view_path } end end diff --git a/railties/lib/rails_generator/generators/components/mailer/templates/fixture.erb b/railties/lib/rails_generator/generators/components/mailer/templates/fixture.erb new file mode 100644 index 0000000000..6899257ddc --- /dev/null +++ b/railties/lib/rails_generator/generators/components/mailer/templates/fixture.erb @@ -0,0 +1,3 @@ +<%= class_name %>#<%= action %> + +Find me in <%= path %> diff --git a/railties/lib/rails_generator/generators/components/mailer/templates/fixture.rhtml b/railties/lib/rails_generator/generators/components/mailer/templates/fixture.rhtml index 6899257ddc..e69de29bb2 100644 --- a/railties/lib/rails_generator/generators/components/mailer/templates/fixture.rhtml +++ b/railties/lib/rails_generator/generators/components/mailer/templates/fixture.rhtml @@ -1,3 +0,0 @@ -<%= class_name %>#<%= action %> - -Find me in <%= path %> diff --git a/railties/lib/rails_generator/generators/components/mailer/templates/view.erb b/railties/lib/rails_generator/generators/components/mailer/templates/view.erb new file mode 100644 index 0000000000..6899257ddc --- /dev/null +++ b/railties/lib/rails_generator/generators/components/mailer/templates/view.erb @@ -0,0 +1,3 @@ +<%= class_name %>#<%= action %> + +Find me in <%= path %> diff --git a/railties/lib/rails_generator/generators/components/mailer/templates/view.rhtml b/railties/lib/rails_generator/generators/components/mailer/templates/view.rhtml index 6899257ddc..e69de29bb2 100644 --- a/railties/lib/rails_generator/generators/components/mailer/templates/view.rhtml +++ b/railties/lib/rails_generator/generators/components/mailer/templates/view.rhtml @@ -1,3 +0,0 @@ -<%= class_name %>#<%= action %> - -Find me in <%= path %> 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 759850f6bf..df622f7eee 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.rhtml", + m.complex_template "form.erb", File.join('app/views', controller_class_path, controller_file_name, - "_form.rhtml"), - :insert => 'form_scaffolding.rhtml', + "_form.erb"), + :insert => 'form_scaffolding.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}.rhtml", + m.template "view_#{action}.erb", File.join('app/views', controller_class_path, controller_file_name, - "#{action}.rhtml"), + "#{action}.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.rhtml', + m.template 'layout.erb', File.join('app/views/layouts', controller_class_path, - "#{controller_file_name}.rhtml") + "#{controller_file_name}.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}.rhtml") - m.template "controller:view.rhtml", path, + "#{action}.erb") + m.template "controller:view.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.erb new file mode 100644 index 0000000000..d15f0d4ec2 --- /dev/null +++ b/railties/lib/rails_generator/generators/components/scaffold/templates/form.erb @@ -0,0 +1,3 @@ +<%%= error_messages_for '<%= singular_name %>' %> + +<%= template_for_inclusion %> diff --git a/railties/lib/rails_generator/generators/components/scaffold/templates/form.rhtml b/railties/lib/rails_generator/generators/components/scaffold/templates/form.rhtml index d15f0d4ec2..e69de29bb2 100644 --- a/railties/lib/rails_generator/generators/components/scaffold/templates/form.rhtml +++ b/railties/lib/rails_generator/generators/components/scaffold/templates/form.rhtml @@ -1,3 +0,0 @@ -<%%= error_messages_for '<%= singular_name %>' %> - -<%= template_for_inclusion %> 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.erb new file mode 100644 index 0000000000..c7a87553ac --- /dev/null +++ b/railties/lib/rails_generator/generators/components/scaffold/templates/form_scaffolding.erb @@ -0,0 +1 @@ +<%= all_input_tags(@model_instance, @singular_name, {}) %>
\ No newline at end of file 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 index c7a87553ac..e69de29bb2 100644 --- a/railties/lib/rails_generator/generators/components/scaffold/templates/form_scaffolding.rhtml +++ b/railties/lib/rails_generator/generators/components/scaffold/templates/form_scaffolding.rhtml @@ -1 +0,0 @@ -<%= all_input_tags(@model_instance, @singular_name, {}) %>
\ No newline at end of file diff --git a/railties/lib/rails_generator/generators/components/scaffold/templates/layout.erb b/railties/lib/rails_generator/generators/components/scaffold/templates/layout.erb new file mode 100644 index 0000000000..5c1f304232 --- /dev/null +++ b/railties/lib/rails_generator/generators/components/scaffold/templates/layout.erb @@ -0,0 +1,17 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> + +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> +<head> + <meta http-equiv="content-type" content="text/html;charset=UTF-8" /> + <title><%= controller_class_name %>: <%%= controller.action_name %></title> + <%%= stylesheet_link_tag 'scaffold' %> +</head> +<body> + +<p style="color: green"><%%= flash[:notice] %></p> + +<%%= yield %> + +</body> +</html> diff --git a/railties/lib/rails_generator/generators/components/scaffold/templates/layout.rhtml b/railties/lib/rails_generator/generators/components/scaffold/templates/layout.rhtml index 5c1f304232..e69de29bb2 100644 --- a/railties/lib/rails_generator/generators/components/scaffold/templates/layout.rhtml +++ b/railties/lib/rails_generator/generators/components/scaffold/templates/layout.rhtml @@ -1,17 +0,0 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" - "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> - -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> -<head> - <meta http-equiv="content-type" content="text/html;charset=UTF-8" /> - <title><%= controller_class_name %>: <%%= controller.action_name %></title> - <%%= stylesheet_link_tag 'scaffold' %> -</head> -<body> - -<p style="color: green"><%%= flash[:notice] %></p> - -<%%= yield %> - -</body> -</html> 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.erb new file mode 100644 index 0000000000..a86aa0b0d5 --- /dev/null +++ b/railties/lib/rails_generator/generators/components/scaffold/templates/view_edit.erb @@ -0,0 +1,9 @@ +<h1>Editing <%= singular_name %></h1> + +<%% form_tag :action => 'update<%= @suffix %>', :id => @<%= singular_name %> do %> + <%%= render :partial => 'form' %> + <%%= submit_tag 'Edit' %> +<%% end %> + +<%%= link_to 'Show', :action => 'show<%= suffix %>', :id => @<%= singular_name %> %> | +<%%= link_to 'Back', :action => 'list<%= suffix %>' %> 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 index a86aa0b0d5..e69de29bb2 100644 --- a/railties/lib/rails_generator/generators/components/scaffold/templates/view_edit.rhtml +++ b/railties/lib/rails_generator/generators/components/scaffold/templates/view_edit.rhtml @@ -1,9 +0,0 @@ -<h1>Editing <%= singular_name %></h1> - -<%% form_tag :action => 'update<%= @suffix %>', :id => @<%= singular_name %> do %> - <%%= render :partial => 'form' %> - <%%= submit_tag 'Edit' %> -<%% end %> - -<%%= link_to 'Show', :action => 'show<%= suffix %>', :id => @<%= singular_name %> %> | -<%%= link_to 'Back', :action => 'list<%= suffix %>' %> 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.erb new file mode 100644 index 0000000000..3e2a414485 --- /dev/null +++ b/railties/lib/rails_generator/generators/components/scaffold/templates/view_list.erb @@ -0,0 +1,27 @@ +<h1>Listing <%= plural_name %></h1> + +<table> + <tr> + <%% for column in <%= model_name %>.content_columns %> + <th><%%= column.human_name %></th> + <%% end %> + </tr> + +<%% for <%= singular_name %> in @<%= plural_name %> %> + <tr> + <%% for column in <%= model_name %>.content_columns %> + <td><%%=h <%= singular_name %>.send(column.name) %></td> + <%% end %> + <td><%%= link_to 'Show', :action => 'show<%= suffix %>', :id => <%= singular_name %> %></td> + <td><%%= link_to 'Edit', :action => 'edit<%= suffix %>', :id => <%= singular_name %> %></td> + <td><%%= link_to 'Destroy', { :action => 'destroy<%= suffix %>', :id => <%= singular_name %> }, :confirm => 'Are you sure?', :method => :post %></td> + </tr> +<%% end %> +</table> + +<%%= link_to 'Previous page', { :page => @<%= singular_name %>_pages.current.previous } if @<%= singular_name %>_pages.current.previous %> +<%%= link_to 'Next page', { :page => @<%= singular_name %>_pages.current.next } if @<%= singular_name %>_pages.current.next %> + +<br /> + +<%%= link_to 'New <%= singular_name %>', :action => 'new<%= suffix %>' %> 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 index 3e2a414485..e69de29bb2 100644 --- a/railties/lib/rails_generator/generators/components/scaffold/templates/view_list.rhtml +++ b/railties/lib/rails_generator/generators/components/scaffold/templates/view_list.rhtml @@ -1,27 +0,0 @@ -<h1>Listing <%= plural_name %></h1> - -<table> - <tr> - <%% for column in <%= model_name %>.content_columns %> - <th><%%= column.human_name %></th> - <%% end %> - </tr> - -<%% for <%= singular_name %> in @<%= plural_name %> %> - <tr> - <%% for column in <%= model_name %>.content_columns %> - <td><%%=h <%= singular_name %>.send(column.name) %></td> - <%% end %> - <td><%%= link_to 'Show', :action => 'show<%= suffix %>', :id => <%= singular_name %> %></td> - <td><%%= link_to 'Edit', :action => 'edit<%= suffix %>', :id => <%= singular_name %> %></td> - <td><%%= link_to 'Destroy', { :action => 'destroy<%= suffix %>', :id => <%= singular_name %> }, :confirm => 'Are you sure?', :method => :post %></td> - </tr> -<%% end %> -</table> - -<%%= link_to 'Previous page', { :page => @<%= singular_name %>_pages.current.previous } if @<%= singular_name %>_pages.current.previous %> -<%%= link_to 'Next page', { :page => @<%= singular_name %>_pages.current.next } if @<%= singular_name %>_pages.current.next %> - -<br /> - -<%%= link_to 'New <%= singular_name %>', :action => 'new<%= suffix %>' %> 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.erb new file mode 100644 index 0000000000..8222ea622f --- /dev/null +++ b/railties/lib/rails_generator/generators/components/scaffold/templates/view_new.erb @@ -0,0 +1,8 @@ +<h1>New <%= singular_name %></h1> + +<%% form_tag :action => 'create<%= @suffix %>' do %> + <%%= render :partial => 'form' %> + <%%= submit_tag "Create" %> +<%% end %> + +<%%= link_to 'Back', :action => 'list<%= suffix %>' %> 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 index 8222ea622f..e69de29bb2 100644 --- a/railties/lib/rails_generator/generators/components/scaffold/templates/view_new.rhtml +++ b/railties/lib/rails_generator/generators/components/scaffold/templates/view_new.rhtml @@ -1,8 +0,0 @@ -<h1>New <%= singular_name %></h1> - -<%% form_tag :action => 'create<%= @suffix %>' do %> - <%%= render :partial => 'form' %> - <%%= submit_tag "Create" %> -<%% end %> - -<%%= link_to 'Back', :action => 'list<%= suffix %>' %> 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.erb new file mode 100644 index 0000000000..c9245cdfda --- /dev/null +++ b/railties/lib/rails_generator/generators/components/scaffold/templates/view_show.erb @@ -0,0 +1,8 @@ +<%% for column in <%= model_name %>.content_columns %> +<p> + <b><%%= column.human_name %>:</b> <%%=h @<%= singular_name %>.send(column.name) %> +</p> +<%% end %> + +<%%= link_to 'Edit', :action => 'edit<%= suffix %>', :id => @<%= singular_name %> %> | +<%%= link_to 'Back', :action => 'list<%= suffix %>' %> 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 index c9245cdfda..e69de29bb2 100644 --- a/railties/lib/rails_generator/generators/components/scaffold/templates/view_show.rhtml +++ b/railties/lib/rails_generator/generators/components/scaffold/templates/view_show.rhtml @@ -1,8 +0,0 @@ -<%% for column in <%= model_name %>.content_columns %> -<p> - <b><%%= column.human_name %>:</b> <%%=h @<%= singular_name %>.send(column.name) %> -</p> -<%% end %> - -<%%= link_to 'Edit', :action => 'edit<%= suffix %>', :id => @<%= singular_name %> %> | -<%%= link_to 'Back', :action => 'list<%= suffix %>' %> 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 112a7cf74f..502df6a567 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}.rhtml", - File.join('app/views', controller_class_path, controller_file_name, "#{action}.rhtml") + "view_#{action}.erb", + File.join('app/views', controller_class_path, controller_file_name, "#{action}.erb") ) end # Layout and stylesheet. - m.template('layout.rhtml', File.join('app/views/layouts', controller_class_path, "#{controller_file_name}.rhtml")) + m.template('layout.erb', File.join('app/views/layouts', controller_class_path, "#{controller_file_name}.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 4ca12d622f..413f7f7ccb 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.rhtml + format.html # index.erb format.xml { render :xml => @<%= table_name %>.to_xml } 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.rhtml + format.html # show.erb format.xml { render :xml => @<%= file_name %>.to_xml } 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.erb new file mode 100644 index 0000000000..5c1f304232 --- /dev/null +++ b/railties/lib/rails_generator/generators/components/scaffold_resource/templates/layout.erb @@ -0,0 +1,17 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> + +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> +<head> + <meta http-equiv="content-type" content="text/html;charset=UTF-8" /> + <title><%= controller_class_name %>: <%%= controller.action_name %></title> + <%%= stylesheet_link_tag 'scaffold' %> +</head> +<body> + +<p style="color: green"><%%= flash[:notice] %></p> + +<%%= yield %> + +</body> +</html> diff --git a/railties/lib/rails_generator/generators/components/scaffold_resource/templates/layout.rhtml b/railties/lib/rails_generator/generators/components/scaffold_resource/templates/layout.rhtml index 5c1f304232..e69de29bb2 100644 --- a/railties/lib/rails_generator/generators/components/scaffold_resource/templates/layout.rhtml +++ b/railties/lib/rails_generator/generators/components/scaffold_resource/templates/layout.rhtml @@ -1,17 +0,0 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" - "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> - -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> -<head> - <meta http-equiv="content-type" content="text/html;charset=UTF-8" /> - <title><%= controller_class_name %>: <%%= controller.action_name %></title> - <%%= stylesheet_link_tag 'scaffold' %> -</head> -<body> - -<p style="color: green"><%%= flash[:notice] %></p> - -<%%= yield %> - -</body> -</html> 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.erb new file mode 100644 index 0000000000..bf165e02be --- /dev/null +++ b/railties/lib/rails_generator/generators/components/scaffold_resource/templates/view_edit.erb @@ -0,0 +1,19 @@ +<h1>Editing <%= singular_name %></h1> + +<%%= error_messages_for :<%= singular_name %> %> + +<%% form_for(:<%= singular_name %>, :url => <%= singular_name %>_path(@<%= singular_name %>), :html => { :method => :put }) do |f| %> +<% for attribute in attributes -%> + <p> + <b><%= attribute.column.human_name %></b><br /> + <%%= f.<%= attribute.field_type %> :<%= attribute.name %> %> + </p> + +<% end -%> + <p> + <%%= submit_tag "Update" %> + </p> +<%% end %> + +<%%= link_to 'Show', <%= singular_name %>_path(@<%= singular_name %>) %> | +<%%= link_to 'Back', <%= plural_name %>_path %>
\ No newline at end of file diff --git a/railties/lib/rails_generator/generators/components/scaffold_resource/templates/view_edit.rhtml b/railties/lib/rails_generator/generators/components/scaffold_resource/templates/view_edit.rhtml index bf165e02be..e69de29bb2 100644 --- a/railties/lib/rails_generator/generators/components/scaffold_resource/templates/view_edit.rhtml +++ b/railties/lib/rails_generator/generators/components/scaffold_resource/templates/view_edit.rhtml @@ -1,19 +0,0 @@ -<h1>Editing <%= singular_name %></h1> - -<%%= error_messages_for :<%= singular_name %> %> - -<%% form_for(:<%= singular_name %>, :url => <%= singular_name %>_path(@<%= singular_name %>), :html => { :method => :put }) do |f| %> -<% for attribute in attributes -%> - <p> - <b><%= attribute.column.human_name %></b><br /> - <%%= f.<%= attribute.field_type %> :<%= attribute.name %> %> - </p> - -<% end -%> - <p> - <%%= submit_tag "Update" %> - </p> -<%% end %> - -<%%= link_to 'Show', <%= singular_name %>_path(@<%= singular_name %>) %> | -<%%= link_to 'Back', <%= plural_name %>_path %>
\ No newline at end of file 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.erb new file mode 100644 index 0000000000..9ad899465c --- /dev/null +++ b/railties/lib/rails_generator/generators/components/scaffold_resource/templates/view_index.erb @@ -0,0 +1,24 @@ +<h1>Listing <%= plural_name %></h1> + +<table> + <tr> +<% for attribute in attributes -%> + <th><%= attribute.column.human_name %></th> +<% end -%> + </tr> + +<%% for <%= singular_name %> in @<%= plural_name %> %> + <tr> +<% for attribute in attributes -%> + <td><%%=h <%= singular_name %>.<%= attribute.name %> %></td> +<% end -%> + <td><%%= link_to 'Show', <%= singular_name %>_path(<%= singular_name %>) %></td> + <td><%%= link_to 'Edit', edit_<%= singular_name %>_path(<%= singular_name %>) %></td> + <td><%%= link_to 'Destroy', <%= singular_name %>_path(<%= singular_name %>), :confirm => 'Are you sure?', :method => :delete %></td> + </tr> +<%% end %> +</table> + +<br /> + +<%%= link_to 'New <%= singular_name %>', new_<%= singular_name %>_path %>
\ No newline at end of file diff --git a/railties/lib/rails_generator/generators/components/scaffold_resource/templates/view_index.rhtml b/railties/lib/rails_generator/generators/components/scaffold_resource/templates/view_index.rhtml index 9ad899465c..e69de29bb2 100644 --- a/railties/lib/rails_generator/generators/components/scaffold_resource/templates/view_index.rhtml +++ b/railties/lib/rails_generator/generators/components/scaffold_resource/templates/view_index.rhtml @@ -1,24 +0,0 @@ -<h1>Listing <%= plural_name %></h1> - -<table> - <tr> -<% for attribute in attributes -%> - <th><%= attribute.column.human_name %></th> -<% end -%> - </tr> - -<%% for <%= singular_name %> in @<%= plural_name %> %> - <tr> -<% for attribute in attributes -%> - <td><%%=h <%= singular_name %>.<%= attribute.name %> %></td> -<% end -%> - <td><%%= link_to 'Show', <%= singular_name %>_path(<%= singular_name %>) %></td> - <td><%%= link_to 'Edit', edit_<%= singular_name %>_path(<%= singular_name %>) %></td> - <td><%%= link_to 'Destroy', <%= singular_name %>_path(<%= singular_name %>), :confirm => 'Are you sure?', :method => :delete %></td> - </tr> -<%% end %> -</table> - -<br /> - -<%%= link_to 'New <%= singular_name %>', new_<%= singular_name %>_path %>
\ No newline at end of file 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.erb new file mode 100644 index 0000000000..b3b6f91453 --- /dev/null +++ b/railties/lib/rails_generator/generators/components/scaffold_resource/templates/view_new.erb @@ -0,0 +1,18 @@ +<h1>New <%= singular_name %></h1> + +<%%= error_messages_for :<%= singular_name %> %> + +<%% form_for(:<%= singular_name %>, :url => <%= plural_name %>_path) do |f| %> +<% for attribute in attributes -%> + <p> + <b><%= attribute.column.human_name %></b><br /> + <%%= f.<%= attribute.field_type %> :<%= attribute.name %> %> + </p> + +<% end -%> + <p> + <%%= submit_tag "Create" %> + </p> +<%% end %> + +<%%= link_to 'Back', <%= plural_name %>_path %>
\ No newline at end of file diff --git a/railties/lib/rails_generator/generators/components/scaffold_resource/templates/view_new.rhtml b/railties/lib/rails_generator/generators/components/scaffold_resource/templates/view_new.rhtml index b3b6f91453..e69de29bb2 100644 --- a/railties/lib/rails_generator/generators/components/scaffold_resource/templates/view_new.rhtml +++ b/railties/lib/rails_generator/generators/components/scaffold_resource/templates/view_new.rhtml @@ -1,18 +0,0 @@ -<h1>New <%= singular_name %></h1> - -<%%= error_messages_for :<%= singular_name %> %> - -<%% form_for(:<%= singular_name %>, :url => <%= plural_name %>_path) do |f| %> -<% for attribute in attributes -%> - <p> - <b><%= attribute.column.human_name %></b><br /> - <%%= f.<%= attribute.field_type %> :<%= attribute.name %> %> - </p> - -<% end -%> - <p> - <%%= submit_tag "Create" %> - </p> -<%% end %> - -<%%= link_to 'Back', <%= plural_name %>_path %>
\ No newline at end of file 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.erb new file mode 100644 index 0000000000..adecaf70c6 --- /dev/null +++ b/railties/lib/rails_generator/generators/components/scaffold_resource/templates/view_show.erb @@ -0,0 +1,10 @@ +<% for attribute in attributes -%> +<p> + <b><%= attribute.column.human_name %>:</b> + <%%=h @<%= singular_name %>.<%= attribute.name %> %> +</p> + +<% end -%> + +<%%= link_to 'Edit', edit_<%= singular_name %>_path(@<%= singular_name %>) %> | +<%%= link_to 'Back', <%= plural_name %>_path %>
\ No newline at end of file diff --git a/railties/lib/rails_generator/generators/components/scaffold_resource/templates/view_show.rhtml b/railties/lib/rails_generator/generators/components/scaffold_resource/templates/view_show.rhtml index adecaf70c6..e69de29bb2 100644 --- a/railties/lib/rails_generator/generators/components/scaffold_resource/templates/view_show.rhtml +++ b/railties/lib/rails_generator/generators/components/scaffold_resource/templates/view_show.rhtml @@ -1,10 +0,0 @@ -<% for attribute in attributes -%> -<p> - <b><%= attribute.column.human_name %>:</b> - <%%=h @<%= singular_name %>.<%= attribute.name %> %> -</p> - -<% end -%> - -<%%= link_to 'Edit', edit_<%= singular_name %>_path(@<%= singular_name %>) %> | -<%%= link_to 'Back', <%= plural_name %>_path %>
\ No newline at end of file |