Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 1380

Show
Ignore:
Timestamp:
06/02/05 20:13:02 (3 years ago)
Author:
david
Message:

Fixed scaffolding to use the latest style

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/actionpack/lib/action_controller/templates/scaffolds/layout.rhtml

    r197 r1380  
    6060<body> 
    6161 
     62<p style="color: green"><%= flash['notice'] %></p> 
     63 
    6264<%= @content_for_layout %> 
    6365 
  • trunk/actionpack/lib/action_controller/templates/scaffolds/list.rhtml

    r1067 r1380  
    1515    <td><%= link_to "Show", :action => "show#{@scaffold_suffix}", :id => entry.id %></td> 
    1616    <td><%= link_to "Edit", :action => "edit#{@scaffold_suffix}", :id => entry.id %></td> 
    17     <td><%= link_to "Destroy", :action => "destroy#{@scaffold_suffix}", :id => entry.id %></td> 
     17    <td><%= link_to "Destroy", :action => "destroy#{@scaffold_suffix}", :id => entry.id, :confirm => "Are you sure?" %></td> 
    1818  </tr> 
    1919<% end %> 
  • trunk/railties/lib/rails_generator/generators/components/scaffold/templates/controller.rb

    r1067 r1380  
    33  def index 
    44    list 
    5     render_action 'list' 
     5    render :action => 'list' 
    66  end 
    77<% end -%> 
     
    1717 
    1818  def show<%= suffix %> 
    19     @<%= singular_name %> = <%= model_name %>.find(@params[:id]) 
     19    @<%= singular_name %> = <%= model_name %>.find(params[:id]) 
    2020  end 
    2121 
     
    2525 
    2626  def create<%= suffix %> 
    27     @<%= singular_name %> = <%= model_name %>.new(@params[:<%= singular_name %>]) 
     27    @<%= singular_name %> = <%= model_name %>.new(params[:<%= singular_name %>]) 
    2828    if @<%= singular_name %>.save 
    29       flash['notice'] = '<%= model_name %> was successfully created.' 
     29      flash[:notice] = '<%= model_name %> was successfully created.' 
    3030      redirect_to :action => 'list<%= suffix %>' 
    3131    else 
    32       render_action 'new<%= suffix %>' 
     32      render :action => 'new<%= suffix %>' 
    3333    end 
    3434  end 
    3535 
    3636  def edit<%= suffix %> 
    37     @<%= singular_name %> = <%= model_name %>.find(@params[:id]) 
     37    @<%= singular_name %> = <%= model_name %>.find(params[:id]) 
    3838  end 
    3939 
    4040  def update 
    41     @<%= singular_name %> = <%= model_name %>.find(@params[:id]) 
    42     if @<%= singular_name %>.update_attributes(@params[:<%= singular_name %>]) 
    43       flash['notice'] = '<%= model_name %> was successfully updated.' 
     41    @<%= singular_name %> = <%= model_name %>.find(params[:id]) 
     42    if @<%= singular_name %>.update_attributes(params[:<%= singular_name %>]) 
     43      flash[:notice] = '<%= model_name %> was successfully updated.' 
    4444      redirect_to :action => 'show<%= suffix %>', :id => @<%= singular_name %> 
    4545    else 
    46       render_action 'edit<%= suffix %>' 
     46      render :action => 'edit<%= suffix %>' 
    4747    end 
    4848  end 
    4949 
    5050  def destroy<%= suffix %> 
    51     <%= model_name %>.find(@params[:id]).destroy 
     51    <%= model_name %>.find(params[:id]).destroy 
    5252    redirect_to :action => 'list<%= suffix %>' 
    5353  end 
  • trunk/railties/lib/rails_generator/generators/components/scaffold/templates/layout.rhtml

    r951 r1380  
    66<body> 
    77 
     8<p style="color: green"><%%= flash[:notice] %></p> 
     9 
    810<%%= @content_for_layout %> 
    911 
  • trunk/railties/lib/rails_generator/generators/components/scaffold/templates/view_edit.rhtml

    r962 r1380  
    22 
    33<%%= start_form_tag :action => 'update<%= @suffix %>', :id => @<%= singular_name %> %> 
    4   <%%= render_partial "form" %> 
    5   <%%= submit_tag "Edit" %> 
     4  <%%= render_partial 'form' %> 
     5  <%%= submit_tag 'Edit' %> 
    66<%%= end_form_tag %> 
    77 
  • trunk/railties/lib/rails_generator/generators/components/scaffold/templates/view_list.rhtml

    r1067 r1380  
    33<table> 
    44  <tr> 
    5 <%% for column in <%= model_name %>.content_columns %> 
     5  <%% for column in <%= model_name %>.content_columns %> 
    66    <th><%%= column.human_name %></th> 
    7 <%% end %> 
     7  <%% end %> 
    88  </tr> 
    99   
     
    1515    <td><%%= link_to 'Show', :action => 'show<%= suffix %>', :id => <%= singular_name %> %></td> 
    1616    <td><%%= link_to 'Edit', :action => 'edit<%= suffix %>', :id => <%= singular_name %> %></td> 
    17     <td><%%= link_to 'Destroy', {:action => 'destroy<%= suffix %>', :id => <%= singular_name %>}, :confirm => "Are you sure?" %></td> 
     17    <td><%%= link_to 'Destroy', {:action => 'destroy<%= suffix %>', :id => <%= singular_name %>}, :confirm => 'Are you sure?' %></td> 
    1818  </tr> 
    1919<%% end %> 
    2020</table> 
    2121 
    22 <%%= link_to "Previous page", { :page => @<%= singular_name %>_pages.current.previous } if @<%= singular_name %>_pages.current.previous %> 
    23 <%%= link_to "Next page", { :page => @<%= singular_name %>_pages.current.next } if @<%= singular_name %>_pages.current.next %>  
     22<%%= link_to 'Previous page', { :page => @<%= singular_name %>_pages.current.previous } if @<%= singular_name %>_pages.current.previous %> 
     23<%%= link_to 'Next page', { :page => @<%= singular_name %>_pages.current.next } if @<%= singular_name %>_pages.current.next %>  
    2424 
    2525<br /> 
  • trunk/railties/lib/rails_generator/generators/components/scaffold/templates/view_new.rhtml

    r962 r1380  
    22 
    33<%%= start_form_tag :action => 'create<%= @suffix %>' %> 
    4   <%%= render_partial "form" %> 
     4  <%%= render_partial 'form' %> 
    55  <%%= submit_tag "Create" %> 
    66<%%= end_form_tag %>