Skip to content

Commit

Permalink
fixed a few bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
nesquena committed Jun 2, 2008
1 parent 2c636d1 commit a625033
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion lib/semantic_fields_renderer.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ def file_field_tag(name, options = {})
# ex: f.select_tag(:attribute, @option_values, :label => "example") # ex: f.select_tag(:attribute, @option_values, :label => "example")
# #
def select_tag(name, option_values, options={}) def select_tag(name, option_values, options={})
label = options.delete(:label).gsub(' ', ' ') label = options.delete(:label) || name.titleize
label.gsub!(' ', ' ')
content_tag("dt", content_tag("label" , "#{label}:", :for => name )) + "\n" + content_tag("dt", content_tag("label" , "#{label}:", :for => name )) + "\n" +
content_tag("dd", @super.select_tag(name, option_values, options)) content_tag("dd", @super.select_tag(name, option_values, options))
end end
Expand Down
2 changes: 1 addition & 1 deletion lib/semantic_form_builder.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ def self.create_field_element(input_type_name)
# returns unchanged in any other case. # returns unchanged in any other case.
# #
def object_name(id=false) def object_name(id=false)
return @object_name unless @object return @object_name if @object.nil? or @object.new_record?


replace_string = id ? "_#{@object.id}" : "[#{@object.id}]" replace_string = id ? "_#{@object.id}" : "[#{@object.id}]"
@object_name.to_s.include?("[]") ? @object_name.gsub(/\[\]/, replace_string) : @object_name @object_name.to_s.include?("[]") ? @object_name.gsub(/\[\]/, replace_string) : @object_name
Expand Down

0 comments on commit a625033

Please sign in to comment.