formtastic-bootstrap 2.1.0 → 2.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. data/VERSION +1 -1
  2. data/lib/action_view/helpers/text_field_date_helper.rb +166 -0
  3. data/lib/formtastic-bootstrap/actions.rb +10 -0
  4. data/lib/formtastic-bootstrap/actions/base.rb +22 -0
  5. data/lib/formtastic-bootstrap/actions/button_action.rb +13 -0
  6. data/lib/formtastic-bootstrap/actions/input_action.rb +13 -0
  7. data/lib/formtastic-bootstrap/actions/link_action.rb +12 -0
  8. data/lib/formtastic-bootstrap/engine.rb +4 -0
  9. data/lib/formtastic-bootstrap/form_builder.rb +41 -0
  10. data/lib/formtastic-bootstrap/helpers.rb +17 -0
  11. data/lib/formtastic-bootstrap/helpers/action_helper.rb +12 -0
  12. data/lib/formtastic-bootstrap/helpers/actions_helper.rb +24 -0
  13. data/lib/formtastic-bootstrap/helpers/errors_helper.rb +70 -0
  14. data/lib/formtastic-bootstrap/helpers/fieldset_wrapper.rb +35 -0
  15. data/lib/formtastic-bootstrap/helpers/input_helper.rb +12 -0
  16. data/lib/formtastic-bootstrap/helpers/inputs_helper.rb +34 -0
  17. data/lib/formtastic-bootstrap/inputs.rb +36 -0
  18. data/lib/formtastic-bootstrap/inputs/base.rb +45 -0
  19. data/lib/formtastic-bootstrap/inputs/base/choices.rb +20 -0
  20. data/lib/formtastic-bootstrap/inputs/base/collections.rb +9 -0
  21. data/lib/formtastic-bootstrap/inputs/base/datetime_pickerish.rb +10 -0
  22. data/lib/formtastic-bootstrap/inputs/base/errors.rb +48 -0
  23. data/lib/formtastic-bootstrap/inputs/base/grouped_collections.rb +9 -0
  24. data/lib/formtastic-bootstrap/inputs/base/hints.rb +27 -0
  25. data/lib/formtastic-bootstrap/inputs/base/html.rb +21 -0
  26. data/lib/formtastic-bootstrap/inputs/base/labelling.rb +29 -0
  27. data/lib/formtastic-bootstrap/inputs/base/numeric.rb +9 -0
  28. data/lib/formtastic-bootstrap/inputs/base/placeholder.rb +9 -0
  29. data/lib/formtastic-bootstrap/inputs/base/stringish.rb +17 -0
  30. data/lib/formtastic-bootstrap/inputs/base/timeish.rb +55 -0
  31. data/lib/formtastic-bootstrap/inputs/base/wrapping.rb +83 -0
  32. data/lib/formtastic-bootstrap/inputs/boolean_input.rb +29 -0
  33. data/lib/formtastic-bootstrap/inputs/check_boxes_input.rb +40 -0
  34. data/lib/formtastic-bootstrap/inputs/country_input.rb +14 -0
  35. data/lib/formtastic-bootstrap/inputs/date_input.rb +10 -0
  36. data/lib/formtastic-bootstrap/inputs/date_picker_input.rb +9 -0
  37. data/lib/formtastic-bootstrap/inputs/date_select_input.rb +8 -0
  38. data/lib/formtastic-bootstrap/inputs/datetime_input.rb +10 -0
  39. data/lib/formtastic-bootstrap/inputs/datetime_picker_input.rb +9 -0
  40. data/lib/formtastic-bootstrap/inputs/datetime_select_input.rb +8 -0
  41. data/lib/formtastic-bootstrap/inputs/email_input.rb +15 -0
  42. data/lib/formtastic-bootstrap/inputs/file_input.rb +14 -0
  43. data/lib/formtastic-bootstrap/inputs/hidden_input.rb +12 -0
  44. data/lib/formtastic-bootstrap/inputs/number_input.rb +15 -0
  45. data/lib/formtastic-bootstrap/inputs/password_input.rb +15 -0
  46. data/lib/formtastic-bootstrap/inputs/phone_input.rb +15 -0
  47. data/lib/formtastic-bootstrap/inputs/radio_input.rb +46 -0
  48. data/lib/formtastic-bootstrap/inputs/range_input.rb +15 -0
  49. data/lib/formtastic-bootstrap/inputs/search_input.rb +15 -0
  50. data/lib/formtastic-bootstrap/inputs/select_input.rb +16 -0
  51. data/lib/formtastic-bootstrap/inputs/string_input.rb +8 -0
  52. data/lib/formtastic-bootstrap/inputs/text_input.rb +14 -0
  53. data/lib/formtastic-bootstrap/inputs/time_input.rb +10 -0
  54. data/lib/formtastic-bootstrap/inputs/time_select_input.rb +8 -0
  55. data/lib/formtastic-bootstrap/inputs/time_zone_input.rb +14 -0
  56. data/lib/formtastic-bootstrap/inputs/url_input.rb +14 -0
  57. data/lib/formtastic-bootstrap/version.rb +3 -0
  58. metadata +62 -3
@@ -0,0 +1,29 @@
1
+ # TODO See if this can be refactored to make use of some of the Choices code.
2
+ module FormtasticBootstrap
3
+ module Inputs
4
+ class BooleanInput < Formtastic::Inputs::BooleanInput
5
+ include Base
6
+
7
+ def to_html
8
+ control_group_wrapping do
9
+ (options[:label_outside] ? control_label_html : "".html_safe) <<
10
+ hidden_field_html <<
11
+ controls_wrapping do
12
+ label_with_nested_checkbox
13
+ end
14
+ end
15
+ end
16
+
17
+ def label_with_nested_checkbox
18
+ builder.label(
19
+ method,
20
+ options[:label_outside] ? check_box_html : label_text_with_embedded_checkbox,
21
+ label_html_options.tap do |options|
22
+ options[:class] << "checkbox"
23
+ end
24
+ )
25
+ end
26
+
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,40 @@
1
+ module FormtasticBootstrap
2
+ module Inputs
3
+ class CheckBoxesInput < Formtastic::Inputs::CheckBoxesInput
4
+ include Base
5
+ include Base::Choices
6
+
7
+ # TODO Make sure help blocks work correctly.
8
+ # TODO Support .inline
9
+
10
+ def to_html
11
+ control_group_wrapping do
12
+ control_label_html <<
13
+ hidden_field_for_all <<
14
+ controls_wrapping do
15
+ collection.map { |choice|
16
+ choice_html(choice)
17
+ }.join("\n").html_safe
18
+ end
19
+ end
20
+ end
21
+
22
+ def choice_wrapping_html_options(choice)
23
+ super(choice).tap do |options|
24
+ options[:class] = ((options[:class].split) << "checkbox").join(" ")
25
+ end
26
+ end
27
+
28
+ def choice_html(choice)
29
+ template.content_tag(:label,
30
+ hidden_fields? ?
31
+ check_box_with_hidden_input(choice) :
32
+ check_box_without_hidden_input(choice) <<
33
+ choice_label(choice),
34
+ label_html_options.merge(choice_label_html_options(choice))
35
+ )
36
+ end
37
+
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,14 @@
1
+ module FormtasticBootstrap
2
+ module Inputs
3
+ class CountryInput < Formtastic::Inputs::CountryInput
4
+ include Base
5
+
6
+ def to_html
7
+ bootstrap_wrapping do
8
+ builder.country_select(method, priority_countries, input_options, input_html_options)
9
+ end
10
+ end
11
+
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,10 @@
1
+ module FormtasticBootstrap
2
+ module Inputs
3
+ class DateInput < FormtasticBootstrap::Inputs::DateSelectInput
4
+ def to_html
5
+ ::ActiveSupport::Deprecation.warn("DateInput (:as => :date) has been renamed to DateSelectInput (:as => :date_select) and will be removed or changed in the next version of Formtastic, please update your forms.", caller(2))
6
+ super
7
+ end
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,9 @@
1
+ module FormtasticBootstrap
2
+ module Inputs
3
+ class DatePickerInput < Formtastic::Inputs::DatePickerInput
4
+ include Base
5
+ include Base::Stringish
6
+ include Base::DatetimePickerish
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,8 @@
1
+ module FormtasticBootstrap
2
+ module Inputs
3
+ class DateSelectInput < Formtastic::Inputs::DateSelectInput
4
+ include Base
5
+ include Base::Timeish
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,10 @@
1
+ module FormtasticBootstrap
2
+ module Inputs
3
+ class DatetimeInput < FormtasticBootstrap::Inputs::DatetimeSelectInput
4
+ def to_html
5
+ ::ActiveSupport::Deprecation.warn("DatetimeInput (:as => :datetime) has been renamed to DatetimeSelectInput (:as => :datetime_select) and will be removed or changed in the next version of Formtastic, please update your forms.", caller(2))
6
+ super
7
+ end
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,9 @@
1
+ module FormtasticBootstrap
2
+ module Inputs
3
+ class DatetimePickerInput < Formtastic::Inputs::DatetimePickerInput
4
+ include Base
5
+ include Base::Stringish
6
+ include Base::DatetimePickerish
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,8 @@
1
+ module FormtasticBootstrap
2
+ module Inputs
3
+ class DatetimeSelectInput < Formtastic::Inputs::DatetimeSelectInput
4
+ include Base
5
+ include Base::Timeish
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,15 @@
1
+ module FormtasticBootstrap
2
+ module Inputs
3
+ class EmailInput < Formtastic::Inputs::EmailInput
4
+ include Base
5
+ include Base::Stringish
6
+
7
+ def to_html
8
+ bootstrap_wrapping do
9
+ builder.email_field(method, input_html_options)
10
+ end
11
+ end
12
+
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,14 @@
1
+ module FormtasticBootstrap
2
+ module Inputs
3
+ class FileInput < Formtastic::Inputs::FileInput
4
+ include Base
5
+
6
+ def to_html
7
+ bootstrap_wrapping do
8
+ builder.file_field(method, input_html_options)
9
+ end
10
+ end
11
+
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,12 @@
1
+ module FormtasticBootstrap
2
+ module Inputs
3
+ class HiddenInput < Formtastic::Inputs::HiddenInput
4
+ include Base
5
+ def to_html
6
+ bootstrap_wrapping do
7
+ builder.hidden_field(method, input_html_options)
8
+ end
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,15 @@
1
+ module FormtasticBootstrap
2
+ module Inputs
3
+ class NumberInput < Formtastic::Inputs::NumberInput
4
+ include Base
5
+ include Base::Numeric
6
+
7
+ def to_html
8
+ bootstrap_wrapping do
9
+ builder.number_field(method, input_html_options)
10
+ end
11
+ end
12
+
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,15 @@
1
+ module FormtasticBootstrap
2
+ module Inputs
3
+ class PasswordInput < Formtastic::Inputs::PasswordInput
4
+ include Base
5
+ include Base::Stringish
6
+
7
+ def to_html
8
+ bootstrap_wrapping do
9
+ builder.password_field(method, input_html_options)
10
+ end
11
+ end
12
+
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,15 @@
1
+ module FormtasticBootstrap
2
+ module Inputs
3
+ class PhoneInput < Formtastic::Inputs::PhoneInput
4
+ include Base
5
+ include Base::Stringish
6
+
7
+ def to_html
8
+ bootstrap_wrapping do
9
+ builder.phone_field(method, input_html_options)
10
+ end
11
+ end
12
+
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,46 @@
1
+ module FormtasticBootstrap
2
+ module Inputs
3
+ class RadioInput < Formtastic::Inputs::RadioInput
4
+ include Base
5
+ include Base::Choices
6
+
7
+ # TODO Make sure help blocks work correctly.
8
+ # TODO Support .inline
9
+
10
+ def to_html
11
+ control_group_wrapping do
12
+ control_label_html <<
13
+ controls_wrapping do
14
+ collection.map { |choice|
15
+ choice_html(choice)
16
+ }.join("\n").html_safe
17
+ end
18
+ end
19
+ end
20
+
21
+ def wrapper_html_options
22
+ # Formtastic marks these as 'radio' but Bootstrap does something
23
+ # with that, so change it to 'radio_buttons'.
24
+ super.tap do |options|
25
+ options[:class] = options[:class].gsub("radio", "radio_buttons")
26
+ end
27
+ end
28
+
29
+ # This came from check_boxes. Do needed refactoring.
30
+ def choice_wrapping_html_options(choice)
31
+ super(choice).tap do |options|
32
+ options[:class] = ((options[:class].split) << "radio").join(" ")
33
+ end
34
+ end
35
+
36
+ def choice_html(choice)
37
+ template.content_tag(:label,
38
+ builder.radio_button(input_name, choice_value(choice), input_html_options.merge(choice_html_options(choice)).merge(:required => false)) <<
39
+ choice_label(choice),
40
+ label_html_options.merge(choice_label_html_options(choice))
41
+ )
42
+ end
43
+
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,15 @@
1
+ module FormtasticBootstrap
2
+ module Inputs
3
+ class RangeInput < Formtastic::Inputs::RangeInput
4
+ include Base
5
+ include Base::Stringish
6
+
7
+ def to_html
8
+ bootstrap_wrapping do
9
+ builder.range_field(method, input_html_options)
10
+ end
11
+ end
12
+
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,15 @@
1
+ module FormtasticBootstrap
2
+ module Inputs
3
+ class SearchInput < Formtastic::Inputs::SearchInput
4
+ include Base
5
+ include Base::Stringish
6
+
7
+ def to_html
8
+ bootstrap_wrapping do
9
+ builder.search_field(method, input_html_options)
10
+ end
11
+ end
12
+
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,16 @@
1
+ module FormtasticBootstrap
2
+ module Inputs
3
+ class SelectInput < Formtastic::Inputs::SelectInput
4
+ include Base
5
+ include Base::Collections
6
+ include Base::GroupedCollections
7
+
8
+ def to_html
9
+ bootstrap_wrapping do
10
+ options[:group_by] ? grouped_select_html : select_html
11
+ end
12
+ end
13
+
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,8 @@
1
+ module FormtasticBootstrap
2
+ module Inputs
3
+ class StringInput < Formtastic::Inputs::StringInput
4
+ include Base
5
+ include Base::Stringish
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,14 @@
1
+ module FormtasticBootstrap
2
+ module Inputs
3
+ class TextInput < Formtastic::Inputs::TextInput
4
+ include Base
5
+
6
+ def to_html
7
+ bootstrap_wrapping do
8
+ builder.text_area(method, input_html_options)
9
+ end
10
+ end
11
+
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,10 @@
1
+ module FormtasticBootstrap
2
+ module Inputs
3
+ class TimeInput < FormtasticBootstrap::Inputs::TimeSelectInput
4
+ def to_html
5
+ ::ActiveSupport::Deprecation.warn("TimeInput (:as => :time) has been renamed to TimeSelectInput (:as => :time_select) and will be removed or changed in the next version of Formtastic, please update your forms.", caller(2))
6
+ super
7
+ end
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,8 @@
1
+ module FormtasticBootstrap
2
+ module Inputs
3
+ class TimeSelectInput < Formtastic::Inputs::TimeSelectInput
4
+ include Base
5
+ include Base::Timeish
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,14 @@
1
+ module FormtasticBootstrap
2
+ module Inputs
3
+ class TimeZoneInput < Formtastic::Inputs::TimeZoneInput
4
+ include Base
5
+
6
+ def to_html
7
+ bootstrap_wrapping do
8
+ builder.time_zone_select(method, priority_zones, input_options, input_html_options)
9
+ end
10
+ end
11
+
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,14 @@
1
+ module FormtasticBootstrap
2
+ module Inputs
3
+ class UrlInput < Formtastic::Inputs::UrlInput
4
+ include Base
5
+ include Base::Stringish
6
+
7
+ def to_html
8
+ bootstrap_wrapping do
9
+ builder.url_field(method, input_html_options)
10
+ end
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,3 @@
1
+ module FormtasticBootstrap
2
+ VERSION = "2.1.1"
3
+ end
metadata CHANGED
@@ -1,15 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: formtastic-bootstrap
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
8
8
  - Matthew Bellantoni
9
+ - Aaron Stone
9
10
  autorequire:
10
11
  bindir: bin
11
12
  cert_chain: []
12
- date: 2013-04-19 00:00:00.000000000 Z
13
+ date: 2013-04-20 00:00:00.000000000 Z
13
14
  dependencies:
14
15
  - !ruby/object:Gem::Dependency
15
16
  name: formtastic
@@ -140,7 +141,9 @@ dependencies:
140
141
  - !ruby/object:Gem::Version
141
142
  version: '0'
142
143
  description: Formtastic form builder to generate Twitter Bootstrap-friendly markup.
143
- email: mjbellantoni@yahoo.com
144
+ email:
145
+ - mjbellantoni@yahoo.com
146
+ - aaron@serendipity.cx
144
147
  executables: []
145
148
  extensions: []
146
149
  extra_rdoc_files:
@@ -151,6 +154,62 @@ files:
151
154
  - LICENSE.txt
152
155
  - README.md
153
156
  - VERSION
157
+ - lib/action_view/helpers/text_field_date_helper.rb
158
+ - lib/formtastic-bootstrap/actions/base.rb
159
+ - lib/formtastic-bootstrap/actions/button_action.rb
160
+ - lib/formtastic-bootstrap/actions/input_action.rb
161
+ - lib/formtastic-bootstrap/actions/link_action.rb
162
+ - lib/formtastic-bootstrap/actions.rb
163
+ - lib/formtastic-bootstrap/engine.rb
164
+ - lib/formtastic-bootstrap/form_builder.rb
165
+ - lib/formtastic-bootstrap/helpers/action_helper.rb
166
+ - lib/formtastic-bootstrap/helpers/actions_helper.rb
167
+ - lib/formtastic-bootstrap/helpers/errors_helper.rb
168
+ - lib/formtastic-bootstrap/helpers/fieldset_wrapper.rb
169
+ - lib/formtastic-bootstrap/helpers/input_helper.rb
170
+ - lib/formtastic-bootstrap/helpers/inputs_helper.rb
171
+ - lib/formtastic-bootstrap/helpers.rb
172
+ - lib/formtastic-bootstrap/inputs/base/choices.rb
173
+ - lib/formtastic-bootstrap/inputs/base/collections.rb
174
+ - lib/formtastic-bootstrap/inputs/base/datetime_pickerish.rb
175
+ - lib/formtastic-bootstrap/inputs/base/errors.rb
176
+ - lib/formtastic-bootstrap/inputs/base/grouped_collections.rb
177
+ - lib/formtastic-bootstrap/inputs/base/hints.rb
178
+ - lib/formtastic-bootstrap/inputs/base/html.rb
179
+ - lib/formtastic-bootstrap/inputs/base/labelling.rb
180
+ - lib/formtastic-bootstrap/inputs/base/numeric.rb
181
+ - lib/formtastic-bootstrap/inputs/base/placeholder.rb
182
+ - lib/formtastic-bootstrap/inputs/base/stringish.rb
183
+ - lib/formtastic-bootstrap/inputs/base/timeish.rb
184
+ - lib/formtastic-bootstrap/inputs/base/wrapping.rb
185
+ - lib/formtastic-bootstrap/inputs/base.rb
186
+ - lib/formtastic-bootstrap/inputs/boolean_input.rb
187
+ - lib/formtastic-bootstrap/inputs/check_boxes_input.rb
188
+ - lib/formtastic-bootstrap/inputs/country_input.rb
189
+ - lib/formtastic-bootstrap/inputs/date_input.rb
190
+ - lib/formtastic-bootstrap/inputs/date_picker_input.rb
191
+ - lib/formtastic-bootstrap/inputs/date_select_input.rb
192
+ - lib/formtastic-bootstrap/inputs/datetime_input.rb
193
+ - lib/formtastic-bootstrap/inputs/datetime_picker_input.rb
194
+ - lib/formtastic-bootstrap/inputs/datetime_select_input.rb
195
+ - lib/formtastic-bootstrap/inputs/email_input.rb
196
+ - lib/formtastic-bootstrap/inputs/file_input.rb
197
+ - lib/formtastic-bootstrap/inputs/hidden_input.rb
198
+ - lib/formtastic-bootstrap/inputs/number_input.rb
199
+ - lib/formtastic-bootstrap/inputs/password_input.rb
200
+ - lib/formtastic-bootstrap/inputs/phone_input.rb
201
+ - lib/formtastic-bootstrap/inputs/radio_input.rb
202
+ - lib/formtastic-bootstrap/inputs/range_input.rb
203
+ - lib/formtastic-bootstrap/inputs/search_input.rb
204
+ - lib/formtastic-bootstrap/inputs/select_input.rb
205
+ - lib/formtastic-bootstrap/inputs/string_input.rb
206
+ - lib/formtastic-bootstrap/inputs/text_input.rb
207
+ - lib/formtastic-bootstrap/inputs/time_input.rb
208
+ - lib/formtastic-bootstrap/inputs/time_select_input.rb
209
+ - lib/formtastic-bootstrap/inputs/time_zone_input.rb
210
+ - lib/formtastic-bootstrap/inputs/url_input.rb
211
+ - lib/formtastic-bootstrap/inputs.rb
212
+ - lib/formtastic-bootstrap/version.rb
154
213
  - lib/formtastic-bootstrap.rb
155
214
  - vendor/assets/stylesheets/formtastic-bootstrap.css
156
215
  homepage: http://github.com/mjbellantoni/formtastic-bootstrap