Skip to content
Browse files

Fixed scaffolding to use the latest style

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1380 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent 3162f38 commit 32c0e895bfa521acdc5c7031a2285a3b8dd53130 @dhh dhh committed Jun 2, 2005
View
2 actionpack/lib/action_controller/templates/scaffolds/layout.rhtml
@@ -59,6 +59,8 @@
</head>
<body>
+<p style="color: green"><%= flash['notice'] %></p>
+
<%= @content_for_layout %>
</body>
View
2 actionpack/lib/action_controller/templates/scaffolds/list.rhtml
@@ -14,7 +14,7 @@
<% end %>
<td><%= link_to "Show", :action => "show#{@scaffold_suffix}", :id => entry.id %></td>
<td><%= link_to "Edit", :action => "edit#{@scaffold_suffix}", :id => entry.id %></td>
- <td><%= link_to "Destroy", :action => "destroy#{@scaffold_suffix}", :id => entry.id %></td>
+ <td><%= link_to "Destroy", :action => "destroy#{@scaffold_suffix}", :id => entry.id, :confirm => "Are you sure?" %></td>
</tr>
<% end %>
</table>
View
22 railties/lib/rails_generator/generators/components/scaffold/templates/controller.rb
@@ -2,7 +2,7 @@ class <%= controller_class_name %>Controller < ApplicationController
<% unless suffix -%>
def index
list
- render_action 'list'
+ render :action => 'list'
end
<% end -%>
@@ -16,39 +16,39 @@ def list<%= suffix %>
end
def show<%= suffix %>
- @<%= singular_name %> = <%= model_name %>.find(@params[:id])
+ @<%= singular_name %> = <%= model_name %>.find(params[:id])
end
def new<%= suffix %>
@<%= singular_name %> = <%= model_name %>.new
end
def create<%= suffix %>
- @<%= singular_name %> = <%= model_name %>.new(@params[:<%= singular_name %>])
+ @<%= singular_name %> = <%= model_name %>.new(params[:<%= singular_name %>])
if @<%= singular_name %>.save
- flash['notice'] = '<%= model_name %> was successfully created.'
+ flash[:notice] = '<%= model_name %> was successfully created.'
redirect_to :action => 'list<%= suffix %>'
else
- render_action 'new<%= suffix %>'
+ render :action => 'new<%= suffix %>'
end
end
def edit<%= suffix %>
- @<%= singular_name %> = <%= model_name %>.find(@params[:id])
+ @<%= singular_name %> = <%= model_name %>.find(params[:id])
end
def update
- @<%= singular_name %> = <%= model_name %>.find(@params[:id])
- if @<%= singular_name %>.update_attributes(@params[:<%= singular_name %>])
- flash['notice'] = '<%= model_name %> was successfully updated.'
+ @<%= singular_name %> = <%= model_name %>.find(params[:id])
+ if @<%= singular_name %>.update_attributes(params[:<%= singular_name %>])
+ flash[:notice] = '<%= model_name %> was successfully updated.'
redirect_to :action => 'show<%= suffix %>', :id => @<%= singular_name %>
else
- render_action 'edit<%= suffix %>'
+ render :action => 'edit<%= suffix %>'
end
end
def destroy<%= suffix %>
- <%= model_name %>.find(@params[:id]).destroy
+ <%= model_name %>.find(params[:id]).destroy
redirect_to :action => 'list<%= suffix %>'
end
end
View
2 railties/lib/rails_generator/generators/components/scaffold/templates/layout.rhtml
@@ -5,6 +5,8 @@
</head>
<body>
+<p style="color: green"><%%= flash[:notice] %></p>
+
<%%= @content_for_layout %>
</body>
View
4 railties/lib/rails_generator/generators/components/scaffold/templates/view_edit.rhtml
@@ -1,8 +1,8 @@
<h1>Editing <%= singular_name %></h1>
<%%= start_form_tag :action => 'update<%= @suffix %>', :id => @<%= singular_name %> %>
- <%%= render_partial "form" %>
- <%%= submit_tag "Edit" %>
+ <%%= render_partial 'form' %>
+ <%%= submit_tag 'Edit' %>
<%%= end_form_tag %>
<%%= link_to 'Show', :action => 'show<%= suffix %>', :id => @<%= singular_name %> %> |
View
10 railties/lib/rails_generator/generators/components/scaffold/templates/view_list.rhtml
@@ -2,9 +2,9 @@
<table>
<tr>
-<%% for column in <%= model_name %>.content_columns %>
+ <%% for column in <%= model_name %>.content_columns %>
<th><%%= column.human_name %></th>
-<%% end %>
+ <%% end %>
</tr>
<%% for <%= singular_name %> in @<%= plural_name %> %>
@@ -14,13 +14,13 @@
<%% 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?" %></td>
+ <td><%%= link_to 'Destroy', {:action => 'destroy<%= suffix %>', :id => <%= singular_name %>}, :confirm => 'Are you sure?' %></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 %>
+<%%= 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 />
View
2 railties/lib/rails_generator/generators/components/scaffold/templates/view_new.rhtml
@@ -1,7 +1,7 @@
<h1>New <%= singular_name %></h1>
<%%= start_form_tag :action => 'create<%= @suffix %>' %>
- <%%= render_partial "form" %>
+ <%%= render_partial 'form' %>
<%%= submit_tag "Create" %>
<%%= end_form_tag %>

0 comments on commit 32c0e89

Please sign in to comment.
Something went wrong with that request. Please try again.