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

Changeset 5036

Show
Ignore:
Timestamp:
09/06/06 00:23:10 (2 years ago)
Author:
david
Message:

CSS classes should be singular and form_for classes should not repeat tag name

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • plugins/simply_helpful/lib/simply_helpful/form_helper_extensions.rb

    r5034 r5036  
    1414 
    1515            html_options = if object.new_record? 
    16               { :class  => "new_#{object_name}_form", :id => nil, :method => :post } 
     16              { :class  => "new_#{object_name}", :id => nil, :method => :post } 
    1717            else 
    18               { :class  => "edit_#{object_name}_form", :id => dom_id(object, :edit), :method => :put } 
     18              { :class  => "edit_#{object_name}", :id => dom_id(object, :edit), :method => :put } 
    1919            end 
    2020 
  • plugins/simply_helpful/lib/simply_helpful/record_identifier.rb

    r5029 r5036  
    1515 
    1616    def dom_class(record) 
    17       plural_class_name(record) 
     17      singular_class_name(record) 
    1818    end 
    1919 
    2020    def dom_id(record, prefix = nil)  
    2121        prefix ||= 'new' unless record.id  
    22         [prefix, record.class.name.underscore, record.id].compact * '_' 
     22        [ prefix, singular_class_name(record), record.id ].compact * '_' 
    2323    end 
    2424   
     
    2828   
    2929    def singular_class_name(record) 
    30       record.class.to_s.downcas
     30      record.class.to_s.underscor
    3131    end 
    3232  end