twitter_bootstrap_builder 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -29,14 +29,14 @@ module TwitterBootstrapBuilder
29
29
  end
30
30
 
31
31
  def text_field(method, options={})
32
- ControlGroup.new(model.class.human_attribute_name(method), for: "#{form_builder.object_name}_#{method}") do |cg|
32
+ ControlGroup.new(options[:label] || model.class.human_attribute_name(method), for: "#{form_builder.object_name}_#{method}") do |cg|
33
33
  cg.append form_builder.text_field(method, options)
34
34
  end.to_s.html_safe
35
35
  end
36
36
 
37
37
  TwitterBootstrapMarkup::InputSize::VALUES.each do |size|
38
38
  define_method "text_field_#{size}" do |method, options={}|
39
- ControlGroup.new(model.class.human_attribute_name(method), for: "#{form_builder.object_name}_#{method}") do |cg|
39
+ ControlGroup.new(options[:label] || model.class.human_attribute_name(method), for: "#{form_builder.object_name}_#{method}") do |cg|
40
40
  options.append!(:class, "input-#{size}")
41
41
  cg.append form_builder.text_field(method, options)
42
42
  end.to_s.html_safe
@@ -44,14 +44,14 @@ module TwitterBootstrapBuilder
44
44
  end
45
45
 
46
46
  def text_area(method, options={})
47
- ControlGroup.new(model.class.human_attribute_name(method), for: "#{form_builder.object_name}_#{method}") do |cg|
47
+ ControlGroup.new(options[:label] || model.class.human_attribute_name(method), for: "#{form_builder.object_name}_#{method}") do |cg|
48
48
  cg.append form_builder.text_area(method, options)
49
49
  end.to_s.html_safe
50
50
  end
51
51
 
52
52
  TwitterBootstrapMarkup::InputSize::VALUES.each do |size|
53
53
  define_method "text_area_#{size}" do |method, options={}|
54
- ControlGroup.new(model.class.human_attribute_name(method), for: "#{form_builder.object_name}_#{method}") do |cg|
54
+ ControlGroup.new(options[:label] || model.class.human_attribute_name(method), for: "#{form_builder.object_name}_#{method}") do |cg|
55
55
  options.append!(:class, "input-#{size}")
56
56
  cg.append form_builder.text_area(method, options)
57
57
  end.to_s.html_safe
@@ -59,49 +59,49 @@ module TwitterBootstrapBuilder
59
59
  end
60
60
 
61
61
  def email_field(method, options={})
62
- ControlGroup.new(model.class.human_attribute_name(method), for: "#{form_builder.object_name}_#{method}") do |cg|
62
+ ControlGroup.new(options[:label] || model.class.human_attribute_name(method), for: "#{form_builder.object_name}_#{method}") do |cg|
63
63
  cg.append form_builder.email_field(method, options)
64
64
  end.to_s.html_safe
65
65
  end
66
66
 
67
67
  def password_field(method, options={})
68
- ControlGroup.new(model.class.human_attribute_name(method), for: "#{form_builder.object_name}_#{method}") do |cg|
68
+ ControlGroup.new(options[:label] || model.class.human_attribute_name(method), for: "#{form_builder.object_name}_#{method}") do |cg|
69
69
  cg.append form_builder.password_field(method, options)
70
70
  end.to_s.html_safe
71
71
  end
72
72
 
73
73
  def check_box(method, options={})
74
- ControlGroup.new(model.class.human_attribute_name(method), for: "#{form_builder.object_name}_#{method}") do |cg|
74
+ ControlGroup.new(options[:label] || model.class.human_attribute_name(method), for: "#{form_builder.object_name}_#{method}") do |cg|
75
75
  cg.append form_builder.check_box(method, options)
76
76
  end.to_s.html_safe
77
77
  end
78
78
 
79
79
  def hidden_field(method, options={})
80
- ControlGroup.new(model.class.human_attribute_name(method), for: "#{form_builder.object_name}_#{method}") do |cg|
80
+ ControlGroup.new(options[:label] || model.class.human_attribute_name(method), for: "#{form_builder.object_name}_#{method}") do |cg|
81
81
  cg.append form_builder.hidden_field(method, options)
82
82
  end.to_s.html_safe
83
83
  end
84
84
 
85
85
  def select(method, choices, options={}, html_options={})
86
- ControlGroup.new(model.class.human_attribute_name(method), for: "#{form_builder.object_name}_#{method}") do |cg|
86
+ ControlGroup.new(options[:label] || model.class.human_attribute_name(method), for: "#{form_builder.object_name}_#{method}") do |cg|
87
87
  cg.append form_builder.select(method, choices, options, html_options)
88
88
  end.to_s.html_safe
89
89
  end
90
90
 
91
91
  def date_select(method, options={}, html_options={})
92
- ControlGroup.new(model.class.human_attribute_name(method), for: "#{form_builder.object_name}_#{method}") do |cg|
92
+ ControlGroup.new(options[:label] || model.class.human_attribute_name(method), for: "#{form_builder.object_name}_#{method}") do |cg|
93
93
  cg.append form_builder.date_select(method, form_builder.send('objectify_options', options), html_options)
94
94
  end.to_s.html_safe
95
95
  end
96
96
 
97
97
  def time_select(method, options={}, html_options={})
98
- ControlGroup.new(model.class.human_attribute_name(method), for: "#{form_builder.object_name}_#{method}") do |cg|
98
+ ControlGroup.new(options[:label] || model.class.human_attribute_name(method), for: "#{form_builder.object_name}_#{method}") do |cg|
99
99
  cg.append form_builder.time_select(method, form_builder.send('objectify_options', options), html_options)
100
100
  end.to_s.html_safe
101
101
  end
102
102
 
103
103
  def datetime_select(method, options={}, html_options={})
104
- ControlGroup.new(model.class.human_attribute_name(method), for: "#{form_builder.object_name}_#{method}") do |cg|
104
+ ControlGroup.new(options[:label] || model.class.human_attribute_name(method), for: "#{form_builder.object_name}_#{method}") do |cg|
105
105
  cg.append form_builder.datetime_select(method, form_builder.send('objectify_options', options), html_options)
106
106
  end.to_s.html_safe
107
107
  end
@@ -1,3 +1,3 @@
1
1
  module TwitterBootstrapBuilder
2
- VERSION = '0.0.3'
2
+ VERSION = '0.0.4'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: twitter_bootstrap_builder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-10-12 00:00:00.000000000 Z
12
+ date: 2012-10-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: twitter_bootstrap_markup
16
- requirement: &28123860 !ruby/object:Gem::Requirement
16
+ requirement: &28680948 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *28123860
24
+ version_requirements: *28680948
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: kaminari
27
- requirement: &28123608 !ruby/object:Gem::Requirement
27
+ requirement: &28680696 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,7 +32,7 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *28123608
35
+ version_requirements: *28680696
36
36
  description: Set of helpers to extend Rails for implement Twitter Bootstrap markup
37
37
  email:
38
38
  - gabynaiman@gmail.com