simple-form-builder 0.0.2.rails3 → 0.0.3.rails3

Sign up to get free protection for your applications and to get access to all the features.
@@ -206,15 +206,23 @@ module SimpleFormBuilder
206
206
  text = sfb_options[:label] || (@already_grouping ? method.to_s.titleize.upcase : method.to_s.titleize)
207
207
  text += ":" unless sfb_options[:no_colon]
208
208
 
209
- hint = sfb_options[:hint]
210
-
211
- text = text + " <span class='hint'>#{hint}</span>" if hint
212
-
213
209
  dom_class = sfb_options[:label_class] || method
214
210
 
215
- ActionView::Helpers::InstanceTag.new(
211
+ label_options = {:class => dom_class }
212
+ if @options[:index].present?
213
+ # We're making our own label for attribute
214
+ label_options[:for] = "#{object.class.to_s.downcase.pluralize}_#{@options[:index]}_#{method.to_s.downcase}"
215
+ end
216
+
217
+ tag = ActionView::Helpers::InstanceTag.new(
216
218
  object_name, method, self, object
217
- ).to_label_tag(text.html_safe, :class => dom_class)
219
+ ).to_label_tag(text.html_safe, label_options)
220
+
221
+ if hint = sfb_options[:hint]
222
+ tag + " <span class='hint'>#{hint}</span>".html_safe
223
+ else
224
+ tag
225
+ end
218
226
  end
219
227
 
220
228
  def radio_label(method, value, sfb_options, options={})
@@ -1,3 +1,3 @@
1
1
  module SimpleFormBuilder
2
- VERSION = '0.0.2.rails3'
2
+ VERSION = '0.0.3.rails3'
3
3
  end
metadata CHANGED
@@ -1,15 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple-form-builder
3
3
  version: !ruby/object:Gem::Version
4
- hash: 708262389
5
- prerelease: 6
4
+ hash: -428173563
5
+ prerelease: true
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 2
10
- - rails
11
9
  - 3
12
- version: 0.0.2.rails3
10
+ - rails3
11
+ version: 0.0.3.rails3
13
12
  platform: ruby
14
13
  authors:
15
14
  - Ben Askins
@@ -17,7 +16,7 @@ autorequire:
17
16
  bindir: bin
18
17
  cert_chain: []
19
18
 
20
- date: 2011-01-13 00:00:00 +11:00
19
+ date: 2011-01-25 00:00:00 +11:00
21
20
  default_executable:
22
21
  dependencies: []
23
22
 
@@ -70,7 +69,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
70
69
  requirements: []
71
70
 
72
71
  rubyforge_project: simple-form-builder
73
- rubygems_version: 1.4.2
72
+ rubygems_version: 1.3.7
74
73
  signing_key:
75
74
  specification_version: 3
76
75
  summary: A best-practice FormBuilder