Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'rails3' of github.com:plustwo/simple-form-builder into …

…rails3

Conflicts:
	lib/simple_form_builder/form_builder.rb
  • Loading branch information...
commit 09b10ecfad70ef817615aa5c526c40107ca12bc1 2 parents c7fd249 + 31c76ee
@benaskins benaskins authored
View
2  Gemfile.lock
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
- simple-form-builder (0.0.1)
+ simple-form-builder (0.0.3.rails3)
GEM
remote: http://rubygems.org/
View
20 lib/simple_form_builder/form_builder.rb
@@ -206,15 +206,23 @@ def label(method, sfb_options, options={})
text = sfb_options[:label] || (@already_grouping ? method.to_s.titleize.upcase : method.to_s.titleize)
text += ":" unless sfb_options[:no_colon]
- hint = sfb_options[:hint]
-
- text = text + " <span class='hint'>#{hint}</span>" if hint
-
dom_class = sfb_options[:label_class] || method
- ActionView::Helpers::InstanceTag.new(
+ label_options = {:class => dom_class }
+ if @options[:index].present?
+ # We're making our own label for attribute
+ label_options[:for] = "#{object.class.to_s.downcase.pluralize}_#{@options[:index]}_#{method.to_s.downcase}"
+ end
+
+ tag = ActionView::Helpers::InstanceTag.new(
object_name, method, self, object.is_a?(Symbol) ? object : nil
- ).to_label_tag(text.html_safe, :class => dom_class)
+ ).to_label_tag(text.html_safe, label_options)
+
+ if hint = sfb_options[:hint]
+ tag + " <span class='hint'>#{hint}</span>".html_safe
+ else
+ tag
+ end
end
def radio_label(method, value, sfb_options, options={})
View
2  lib/simple_form_builder/version.rb
@@ -1,3 +1,3 @@
module SimpleFormBuilder
- VERSION = '0.0.1'
+ VERSION = '0.0.3.rails3'
end
Please sign in to comment.
Something went wrong with that request. Please try again.