simple-form-builder 0.0.7.rails3 → 0.0.8.rails3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,7 @@
1
1
  module SimpleFormBuilder
2
2
  class FormBuilder < ActionView::Helpers::FormBuilder
3
3
 
4
- SFBOptions = %w(wrapper_el no_colon label_text label_class label img input_val hint).collect { |o| o.to_sym }
4
+ SFBOptions = %w(wrapper_el no_star no_colon label_text label_class label img input_val hint).collect { |o| o.to_sym }
5
5
  InputOptions = %w(required checked rows type).collect { |o| o.to_sym }
6
6
 
7
7
  def initialize(*args)
@@ -72,6 +72,11 @@ module SimpleFormBuilder
72
72
  list_item(label(method, sfb_options, options) + super, sfb_options, options)
73
73
  end
74
74
 
75
+ def grouped_collection_select(method, collection, group_method, group_label_method, value_method=:id, text_method=:name, options={}, html_options={})
76
+ sfb_options = extract_sfb_options(options)
77
+ list_item(label(method, sfb_options, options) + super, sfb_options, options)
78
+ end
79
+
75
80
  def country_select(method, priority_countries=nil, options={}, html_options={})
76
81
  sfb_options = extract_sfb_options(options)
77
82
  labelled_field(method, sfb_options, options, super)
@@ -204,6 +209,11 @@ module SimpleFormBuilder
204
209
 
205
210
  def label(method, sfb_options, options={})
206
211
  text = sfb_options[:label] || (@already_grouping ? method.to_s.titleize.upcase : method.to_s.titleize)
212
+
213
+ if options.has_key?(:required) and !sfb_options[:no_star]
214
+ text += '<span class="required">*</span>'
215
+ end
216
+
207
217
  text += ":" unless sfb_options[:no_colon]
208
218
 
209
219
  dom_class = sfb_options[:label_class] || method
@@ -221,7 +231,6 @@ module SimpleFormBuilder
221
231
 
222
232
  tag = tag.to_label_tag(text.html_safe, label_options)
223
233
 
224
-
225
234
  if hint = sfb_options[:hint]
226
235
  tag + " <span class='hint'>#{hint}</span>".html_safe
227
236
  else
@@ -1,3 +1,3 @@
1
1
  module SimpleFormBuilder
2
- VERSION = '0.0.7.rails3'
2
+ VERSION = '0.0.8.rails3'
3
3
  end
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple-form-builder
3
3
  version: !ruby/object:Gem::Version
4
- hash: 708262365
4
+ hash: 708262309
5
5
  prerelease: 6
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 7
9
+ - 8
10
10
  - rails
11
11
  - 3
12
- version: 0.0.7.rails3
12
+ version: 0.0.8.rails3
13
13
  platform: ruby
14
14
  authors:
15
15
  - Ben Askins
@@ -17,8 +17,7 @@ autorequire:
17
17
  bindir: bin
18
18
  cert_chain: []
19
19
 
20
- date: 2011-05-31 00:00:00 +10:00
21
- default_executable:
20
+ date: 2011-07-18 00:00:00 Z
22
21
  dependencies: []
23
22
 
24
23
  description: Extends ActionView::Helpers::FormBuilder with simple, best practices markup.
@@ -38,7 +37,6 @@ files:
38
37
  - CHANGELOG.md
39
38
  - README.md
40
39
  - ROADMAP.md
41
- has_rdoc: true
42
40
  homepage: http://github.com/plustwo/simple-form-builder
43
41
  licenses: []
44
42
 
@@ -70,7 +68,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
70
68
  requirements: []
71
69
 
72
70
  rubyforge_project: simple-form-builder
73
- rubygems_version: 1.6.2
71
+ rubygems_version: 1.8.5
74
72
  signing_key:
75
73
  specification_version: 3
76
74
  summary: A best-practice FormBuilder