formtastic-bootstrap 2.0.0 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (89) hide show
  1. data/README.md +11 -2
  2. data/VERSION +1 -1
  3. data/vendor/assets/stylesheets/formtastic-bootstrap.css +4 -0
  4. metadata +51 -154
  5. data/.rspec +0 -1
  6. data/Gemfile +0 -14
  7. data/Gemfile.lock +0 -131
  8. data/Rakefile +0 -49
  9. data/formtastic-bootstrap.gemspec +0 -166
  10. data/lib/action_view/helpers/text_field_date_helper.rb +0 -166
  11. data/lib/formtastic-bootstrap/actions.rb +0 -10
  12. data/lib/formtastic-bootstrap/actions/base.rb +0 -22
  13. data/lib/formtastic-bootstrap/actions/button_action.rb +0 -13
  14. data/lib/formtastic-bootstrap/actions/input_action.rb +0 -13
  15. data/lib/formtastic-bootstrap/actions/link_action.rb +0 -12
  16. data/lib/formtastic-bootstrap/engine.rb +0 -4
  17. data/lib/formtastic-bootstrap/form_builder.rb +0 -40
  18. data/lib/formtastic-bootstrap/helpers.rb +0 -17
  19. data/lib/formtastic-bootstrap/helpers/action_helper.rb +0 -12
  20. data/lib/formtastic-bootstrap/helpers/actions_helper.rb +0 -24
  21. data/lib/formtastic-bootstrap/helpers/fieldset_wrapper.rb +0 -35
  22. data/lib/formtastic-bootstrap/helpers/input_helper.rb +0 -12
  23. data/lib/formtastic-bootstrap/helpers/inputs_helper.rb +0 -34
  24. data/lib/formtastic-bootstrap/inputs.rb +0 -36
  25. data/lib/formtastic-bootstrap/inputs/base.rb +0 -45
  26. data/lib/formtastic-bootstrap/inputs/base/choices.rb +0 -20
  27. data/lib/formtastic-bootstrap/inputs/base/collections.rb +0 -9
  28. data/lib/formtastic-bootstrap/inputs/base/errors.rb +0 -48
  29. data/lib/formtastic-bootstrap/inputs/base/grouped_collections.rb +0 -9
  30. data/lib/formtastic-bootstrap/inputs/base/hints.rb +0 -27
  31. data/lib/formtastic-bootstrap/inputs/base/html.rb +0 -21
  32. data/lib/formtastic-bootstrap/inputs/base/labelling.rb +0 -29
  33. data/lib/formtastic-bootstrap/inputs/base/numeric.rb +0 -9
  34. data/lib/formtastic-bootstrap/inputs/base/stringish.rb +0 -17
  35. data/lib/formtastic-bootstrap/inputs/base/timeish.rb +0 -55
  36. data/lib/formtastic-bootstrap/inputs/base/wrapping.rb +0 -55
  37. data/lib/formtastic-bootstrap/inputs/boolean_input.rb +0 -29
  38. data/lib/formtastic-bootstrap/inputs/check_boxes_input.rb +0 -40
  39. data/lib/formtastic-bootstrap/inputs/date_input.rb +0 -10
  40. data/lib/formtastic-bootstrap/inputs/date_select_input.rb +0 -8
  41. data/lib/formtastic-bootstrap/inputs/datetime_input.rb +0 -10
  42. data/lib/formtastic-bootstrap/inputs/datetime_select_input.rb +0 -8
  43. data/lib/formtastic-bootstrap/inputs/email_input.rb +0 -15
  44. data/lib/formtastic-bootstrap/inputs/file_input.rb +0 -14
  45. data/lib/formtastic-bootstrap/inputs/hidden_input.rb +0 -12
  46. data/lib/formtastic-bootstrap/inputs/number_input.rb +0 -15
  47. data/lib/formtastic-bootstrap/inputs/password_input.rb +0 -15
  48. data/lib/formtastic-bootstrap/inputs/phone_input.rb +0 -15
  49. data/lib/formtastic-bootstrap/inputs/radio_input.rb +0 -46
  50. data/lib/formtastic-bootstrap/inputs/range_input.rb +0 -15
  51. data/lib/formtastic-bootstrap/inputs/search_input.rb +0 -15
  52. data/lib/formtastic-bootstrap/inputs/select_input.rb +0 -16
  53. data/lib/formtastic-bootstrap/inputs/string_input.rb +0 -8
  54. data/lib/formtastic-bootstrap/inputs/text_input.rb +0 -14
  55. data/lib/formtastic-bootstrap/inputs/time_input.rb +0 -10
  56. data/lib/formtastic-bootstrap/inputs/time_select_input.rb +0 -8
  57. data/lib/formtastic-bootstrap/inputs/time_zone_input.rb +0 -14
  58. data/lib/formtastic-bootstrap/inputs/url_input.rb +0 -14
  59. data/spec/actions/button_action_spec.rb +0 -63
  60. data/spec/actions/input_action_spec.rb +0 -59
  61. data/spec/actions/link_action_spec.rb +0 -92
  62. data/spec/builder/semantic_fields_for_spec.rb +0 -130
  63. data/spec/helpers/action_helper_spec.rb +0 -368
  64. data/spec/helpers/actions_helper_spec.rb +0 -147
  65. data/spec/helpers/input_helper_spec.rb +0 -935
  66. data/spec/helpers/inputs_helper_spec.rb +0 -636
  67. data/spec/inputs/boolean_input_spec.rb +0 -226
  68. data/spec/inputs/check_boxes_input_spec.rb +0 -454
  69. data/spec/inputs/date_select_input_spec.rb +0 -164
  70. data/spec/inputs/datetime_select_input_spec.rb +0 -112
  71. data/spec/inputs/deprecated_time_date_datetime_inputs_spec.rb +0 -48
  72. data/spec/inputs/email_input_spec.rb +0 -86
  73. data/spec/inputs/file_input_spec.rb +0 -90
  74. data/spec/inputs/hidden_input_spec.rb +0 -153
  75. data/spec/inputs/number_input_spec.rb +0 -816
  76. data/spec/inputs/password_input_spec.rb +0 -100
  77. data/spec/inputs/phone_input_spec.rb +0 -86
  78. data/spec/inputs/radio_input_spec.rb +0 -267
  79. data/spec/inputs/range_input_spec.rb +0 -506
  80. data/spec/inputs/search_input_spec.rb +0 -85
  81. data/spec/inputs/select_input_spec.rb +0 -624
  82. data/spec/inputs/string_input_spec.rb +0 -210
  83. data/spec/inputs/text_input_spec.rb +0 -188
  84. data/spec/inputs/time_select_input_spec.rb +0 -191
  85. data/spec/inputs/time_zone_input_spec.rb +0 -118
  86. data/spec/inputs/url_input_spec.rb +0 -86
  87. data/spec/spec_helper.rb +0 -30
  88. data/spec/support/custom_macros.rb +0 -537
  89. data/spec/support/fb_custom_macros.rb +0 -23
@@ -1,9 +0,0 @@
1
- module FormtasticBootstrap
2
- module Inputs
3
- module Base
4
- module Numeric
5
- include Formtastic::Inputs::Base::Numeric
6
- end
7
- end
8
- end
9
- end
@@ -1,17 +0,0 @@
1
- module FormtasticBootstrap
2
- module Inputs
3
- module Base
4
- module Stringish
5
-
6
- include Formtastic::Inputs::Base::Stringish
7
-
8
- def to_html
9
- bootstrap_wrapping do
10
- builder.text_field(method, input_html_options)
11
- end
12
- end
13
-
14
- end
15
- end
16
- end
17
- end
@@ -1,55 +0,0 @@
1
- module FormtasticBootstrap
2
- module Inputs
3
- module Base
4
- module Timeish
5
-
6
- def to_html
7
- control_group_wrapping do
8
- control_label_html <<
9
- controls_wrapping do
10
- hidden_fragments <<
11
- fragments.map do |fragment|
12
- fragment_input_html(fragment)
13
- end.join.html_safe
14
- end
15
- end
16
- end
17
-
18
- def controls_wrapper_html_options
19
- super.tap do |options|
20
- options[:class] = (options[:class].split << "controls-row").join(" ")
21
- end
22
- end
23
-
24
- def fragment_input_html(fragment)
25
- opts = input_options.merge(:prefix => fragment_prefix, :field_name => fragment_name(fragment), :default => value, :include_blank => include_blank?)
26
- template.send(:"select_#{fragment}", value, opts, fragment_input_html_options(fragment))
27
- end
28
-
29
- def fragment_input_html_options(fragment)
30
- input_html_options.tap do |options|
31
- options[:id] = fragment_id(fragment)
32
- options[:class] = ((options[:class] || "").split << fragment_class(fragment)).join(" ")
33
- options[:placeholder] = fragment_placeholder(fragment)
34
- end
35
- end
36
-
37
- def fragment_class(fragment)
38
- {
39
- :year => "span1",
40
- :month => "span2",
41
- :day => "span1",
42
- :hour => "span1",
43
- :minute => "span1",
44
- :second => "span1"
45
- }[fragment]
46
- end
47
-
48
- def fragment_placeholder(fragment)
49
- "." + fragment_class(fragment)
50
- end
51
-
52
- end
53
- end
54
- end
55
- end
@@ -1,55 +0,0 @@
1
- module FormtasticBootstrap
2
- module Inputs
3
- module Base
4
- module Wrapping
5
-
6
- include Formtastic::Inputs::Base::Wrapping
7
-
8
- def bootstrap_wrapping(&block)
9
- control_group_wrapping do
10
- control_label_html <<
11
- controls_wrapping do
12
- if options[:prepend]
13
- prepended_input_wrapping do
14
- [template.content_tag(:span, options[:prepend], :class => 'add-on'), yield, hint_html].join("\n").html_safe
15
- end
16
- else
17
- [yield, hint_html].join("\n").html_safe
18
- end
19
- end
20
- end
21
- end
22
-
23
- def control_group_wrapping(&block)
24
- template.content_tag(:div,
25
- [template.capture(&block), error_html].join("\n").html_safe,
26
- wrapper_html_options
27
- )
28
- end
29
-
30
- def controls_wrapping(&block)
31
- template.content_tag(:div, template.capture(&block).html_safe, controls_wrapper_html_options)
32
- end
33
-
34
- def controls_wrapper_html_options
35
- {
36
- :class => "controls"
37
- }
38
- end
39
-
40
- def wrapper_html_options
41
- super.tap do |options|
42
- options[:class] << " control-group"
43
- end
44
- end
45
-
46
- # Bootstrap prepend feature
47
- def prepended_input_wrapping(&block)
48
- template.content_tag(:div, :class => 'input-prepend') do
49
- yield
50
- end
51
- end
52
- end
53
- end
54
- end
55
- end
@@ -1,29 +0,0 @@
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
- control_label_html <<
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
- 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
@@ -1,40 +0,0 @@
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
@@ -1,10 +0,0 @@
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
@@ -1,8 +0,0 @@
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
@@ -1,10 +0,0 @@
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
@@ -1,8 +0,0 @@
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
@@ -1,15 +0,0 @@
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
@@ -1,14 +0,0 @@
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
@@ -1,12 +0,0 @@
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
@@ -1,15 +0,0 @@
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
@@ -1,15 +0,0 @@
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
@@ -1,15 +0,0 @@
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
@@ -1,46 +0,0 @@
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
@@ -1,15 +0,0 @@
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
@@ -1,15 +0,0 @@
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
@@ -1,16 +0,0 @@
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