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,4 +0,0 @@
1
- module FormtasticBootstrap
2
- class Engine < ::Rails::Engine
3
- end
4
- end
@@ -1,40 +0,0 @@
1
- module FormtasticBootstrap
2
-
3
- class FormBuilder < Formtastic::FormBuilder
4
-
5
- configure :default_inline_error_class, 'help-inline'
6
- configure :default_block_error_class, 'help-block'
7
- configure :default_inline_hint_class, 'help-inline'
8
- configure :default_block_hint_class, 'help-block'
9
-
10
- def self.default_error_class
11
- # self.default_inline_error_class
12
- raise
13
- end
14
-
15
- def self.default_error_class=(error_class)
16
- # self.default_inline_error_class = error_class
17
- # self.default_block_error_class = error_class
18
- raise
19
- end
20
-
21
- def self.default_hint_class
22
- # self.default_inline_hint_class
23
- raise
24
- end
25
-
26
- def self.default_hint_class=(hint_class)
27
- # self.default_inline_hint_class = hint_class
28
- # self.default_block_hint_class = hint_class
29
- raise
30
- end
31
-
32
- include FormtasticBootstrap::Helpers::InputHelper # Revisit
33
- include FormtasticBootstrap::Helpers::InputsHelper
34
- include FormtasticBootstrap::Helpers::ActionHelper
35
- include FormtasticBootstrap::Helpers::ActionsHelper
36
- # include Formtastic::Helpers::ErrorsHelper
37
-
38
- end
39
-
40
- end
@@ -1,17 +0,0 @@
1
- module FormtasticBootstrap
2
- module Helpers
3
-
4
- autoload :ActionHelper, 'formtastic-bootstrap/helpers/action_helper'
5
- autoload :ActionsHelper, 'formtastic-bootstrap/helpers/actions_helper'
6
- # autoload :ErrorsHelper, 'formtastic/helpers/errors_helper'
7
- autoload :FieldsetWrapper, 'formtastic-bootstrap/helpers/fieldset_wrapper'
8
- # autoload :FileColumnDetection, 'formtastic/helpers/file_column_detection'
9
- # autoload :FormHelper, 'formtastic/helpers/form_helper'
10
- autoload :InputHelper, 'formtastic-bootstrap/helpers/input_helper'
11
- autoload :InputsHelper, 'formtastic-bootstrap/helpers/inputs_helper'
12
- # autoload :LabelHelper, 'formtastic/helpers/label_helper'
13
- # autoload :SemanticFormHelper, 'formtastic/helpers/semantic_form_helper'
14
- # autoload :Reflection, 'formtastic/helpers/reflection'
15
- end
16
- end
17
-
@@ -1,12 +0,0 @@
1
- module FormtasticBootstrap
2
- module Helpers
3
- module ActionHelper
4
-
5
- # :as => :button # => FormtasticBootstrap::Actions::ButtonAction
6
- def standard_action_class_name(as)
7
- "FormtasticBootstrap::Actions::#{as.to_s.camelize}Action"
8
- end
9
-
10
- end
11
- end
12
- end
@@ -1,24 +0,0 @@
1
- module FormtasticBootstrap
2
- module Helpers
3
- module ActionsHelper
4
-
5
- include Formtastic::Helpers::ActionsHelper
6
- include FormtasticBootstrap::Helpers::FieldsetWrapper
7
-
8
- def actions(*args, &block)
9
-
10
- html_options = args.extract_options!
11
- html_options[:class] ||= "form-actions"
12
-
13
- if block_given?
14
- field_set_and_list_wrapping(html_options, &block)
15
- else
16
- args = default_actions if args.empty?
17
- contents = args.map { |action_name| action(action_name) }
18
- field_set_and_list_wrapping(html_options, contents)
19
- end
20
- end
21
-
22
- end
23
- end
24
- end
@@ -1,35 +0,0 @@
1
- module FormtasticBootstrap
2
- module Helpers
3
- module FieldsetWrapper
4
-
5
- include Formtastic::Helpers::FieldsetWrapper
6
-
7
- protected
8
-
9
- def field_set_and_list_wrapping(*args, &block) #:nodoc:
10
- contents = args.last.is_a?(::Hash) ? '' : args.pop.flatten
11
- html_options = args.extract_options!
12
-
13
- if block_given?
14
- contents = if template.respond_to?(:is_haml?) && template.is_haml?
15
- template.capture_haml(&block)
16
- else
17
- template.capture(&block)
18
- end
19
- end
20
-
21
- # Ruby 1.9: String#to_s behavior changed, need to make an explicit join.
22
- contents = contents.join if contents.respond_to?(:join)
23
-
24
- legend = field_set_legend(html_options)
25
- fieldset = template.content_tag(:fieldset,
26
- Formtastic::Util.html_safe(legend) << Formtastic::Util.html_safe(contents),
27
- html_options.except(:builder, :parent, :name)
28
- )
29
-
30
- fieldset
31
- end
32
-
33
- end
34
- end
35
- end
@@ -1,12 +0,0 @@
1
- module FormtasticBootstrap
2
- module Helpers
3
- module InputHelper
4
- include Formtastic::Helpers::InputHelper
5
-
6
- def standard_input_class_name(as)
7
- "FormtasticBootstrap::Inputs::#{as.to_s.camelize}Input"
8
- end
9
-
10
- end
11
- end
12
- end
@@ -1,34 +0,0 @@
1
- module FormtasticBootstrap
2
- module Helpers
3
- module InputsHelper
4
-
5
- def inputs(*args, &block)
6
- wrap_it = @already_in_an_inputs_block ? true : false
7
- @already_in_an_inputs_block = true
8
-
9
- title = field_set_title_from_args(*args)
10
- html_options = args.extract_options!
11
- html_options[:class] ||= "inputs"
12
- html_options[:name] = title
13
-
14
- out = begin
15
- if html_options[:for] # Nested form
16
- inputs_for_nested_attributes(*(args << html_options), &block)
17
- elsif block_given?
18
- field_set_and_list_wrapping(*(args << html_options), &block)
19
- else
20
- legend = args.shift if args.first.is_a?(::String)
21
- args = default_columns_for_object if @object && args.empty?
22
- contents = fieldset_contents_from_column_list(args)
23
- args.unshift(legend) if legend.present?
24
- field_set_and_list_wrapping(*((args << html_options) << contents))
25
- end
26
- end
27
-
28
- @already_in_an_inputs_block = false
29
- out
30
- end
31
-
32
- end
33
- end
34
- end
@@ -1,36 +0,0 @@
1
- module FormtasticBootstrap
2
- module Inputs
3
-
4
- autoload :Base, "formtastic-bootstrap/inputs/base"
5
- # autoload :Basic
6
- autoload :BooleanInput, "formtastic-bootstrap/inputs/boolean_input"
7
- autoload :CheckBoxesInput, "formtastic-bootstrap/inputs/check_boxes_input"
8
- # autoload :CountryInput # TODO Come back to this.
9
- autoload :DateInput, "formtastic-bootstrap/inputs/date_input"
10
- # autoload :DatePickerInput # TODO Come back to this.
11
- # autoload :DatetimePickerInput # TODO Come back to this.
12
- autoload :DateSelectInput, "formtastic-bootstrap/inputs/date_select_input"
13
- autoload :DatetimeInput, "formtastic-bootstrap/inputs/datetime_input"
14
- autoload :DatetimeSelectInput, "formtastic-bootstrap/inputs/datetime_select_input"
15
- autoload :EmailInput, "formtastic-bootstrap/inputs/email_input"
16
- autoload :FileInput, "formtastic-bootstrap/inputs/file_input"
17
- autoload :HiddenInput, "formtastic-bootstrap/inputs/hidden_input"
18
- autoload :NumberInput, "formtastic-bootstrap/inputs/number_input"
19
- # autoload :NumericInput # TODO Where does Formtastic actually define this?
20
- autoload :PasswordInput, "formtastic-bootstrap/inputs/password_input"
21
- autoload :PhoneInput, "formtastic-bootstrap/inputs/phone_input"
22
- autoload :RadioInput, "formtastic-bootstrap/inputs/radio_input"
23
- autoload :RangeInput, "formtastic-bootstrap/inputs/range_input"
24
- autoload :SearchInput, "formtastic-bootstrap/inputs/search_input"
25
- autoload :SelectInput, "formtastic-bootstrap/inputs/select_input"
26
- autoload :StringInput, "formtastic-bootstrap/inputs/string_input"
27
- autoload :TextInput, "formtastic-bootstrap/inputs/text_input"
28
- autoload :TimeInput, "formtastic-bootstrap/inputs/time_input"
29
- # autoload :TimePickerInput # TODO Come back to this.
30
- autoload :TimeSelectInput, "formtastic-bootstrap/inputs/time_select_input"
31
- autoload :TimeZoneInput, "formtastic-bootstrap/inputs/time_zone_input"
32
- # autoload :Timeish # This seems like a mistake.
33
- autoload :UrlInput, "formtastic-bootstrap/inputs/url_input"
34
-
35
- end
36
- end
@@ -1,45 +0,0 @@
1
- require "formtastic-bootstrap/inputs/base/errors"
2
- require "formtastic-bootstrap/inputs/base/hints"
3
- require "formtastic-bootstrap/inputs/base/html"
4
- require "formtastic-bootstrap/inputs/base/labelling"
5
-
6
- module FormtasticBootstrap
7
- module Inputs
8
- module Base
9
-
10
- # autoload :DatetimePickerish
11
- # autoload :Associations
12
- autoload :Collections, "formtastic-bootstrap/inputs/base/collections"
13
- autoload :Choices, "formtastic-bootstrap/inputs/base/choices"
14
- # autoload :Database
15
- # autoload :Errors
16
- # autoload :Fileish
17
- autoload :GroupedCollections, "formtastic-bootstrap/inputs/base/grouped_collections"
18
- # autoload :Hints
19
- # autoload :Html
20
- # autoload :Labelling
21
- # autoload :Naming
22
- autoload :Numeric, "formtastic-bootstrap/inputs/base/numeric"
23
- # autoload :Options
24
- # autoload :Placeholder
25
- autoload :Stringish, "formtastic-bootstrap/inputs/base/stringish"
26
- autoload :Timeish, "formtastic-bootstrap/inputs/base/timeish"
27
- # autoload :Validations
28
- autoload :Wrapping, "formtastic-bootstrap/inputs/base/wrapping"
29
-
30
- include Html
31
- # include Options
32
- # include Database
33
- # include Database
34
- include Errors
35
- include Hints
36
- # include Naming
37
- # include Validations
38
- # include Fileish
39
- # include Associations
40
- include Labelling
41
- include Wrapping
42
-
43
- end
44
- end
45
- end
@@ -1,20 +0,0 @@
1
- module FormtasticBootstrap
2
- module Inputs
3
- module Base
4
- module Choices
5
- include Formtastic::Inputs::Base::Choices
6
-
7
- def choice_wrapping_html_options(choice)
8
- super(choice).tap do |options|
9
- options[:for] = choice_input_dom_id(choice)
10
- end
11
- end
12
-
13
- def choice_label_html_options(choice)
14
- choice_wrapping_html_options(choice)
15
- end
16
-
17
- end
18
- end
19
- end
20
- end
@@ -1,9 +0,0 @@
1
- module FormtasticBootstrap
2
- module Inputs
3
- module Base
4
- module Collections
5
- include Formtastic::Inputs::Base::Collections
6
- end
7
- end
8
- end
9
- end
@@ -1,48 +0,0 @@
1
- module FormtasticBootstrap
2
- module Inputs
3
- module Base
4
- module Errors
5
-
6
- include Formtastic::Inputs::Base::Errors
7
-
8
- def error_html(inline_or_block = :inline)
9
- errors? ? send(:"error_#{builder.inline_errors}_html", inline_or_block) : ""
10
- end
11
-
12
- def error_sentence_html(inline_or_block)
13
- error_class = if inline_or_block == :inline
14
- options[:error_class] || builder.default_inline_error_class
15
- else
16
- options[:error_class] || builder.default_block_error_class
17
- end
18
- template.content_tag(:span, Formtastic::Util.html_safe(errors.to_sentence.html_safe), :class => error_class)
19
- end
20
-
21
- def error_list_html(ignore)
22
- super()
23
- # error_class = options[:error_class] || builder.default_error_list_class
24
- # list_elements = []
25
- # errors.each do |error|
26
- # list_elements << template.content_tag(:li, Formtastic::Util.html_safe(error.html_safe))
27
- # end
28
- # template.content_tag(:ul, Formtastic::Util.html_safe(list_elements.join("\n")), :class => error_class)
29
- end
30
-
31
- def error_first_html(inline_or_block = :inline)
32
- error_class = if inline_or_block == :inline
33
- options[:error_class] || builder.default_inline_error_class
34
- else
35
- options[:error_class] || builder.default_block_error_class
36
- end
37
- template.content_tag(:span, Formtastic::Util.html_safe(errors.first.untaint), :class => error_class)
38
- end
39
-
40
- def error_none_html(ignore)
41
- # super
42
- ""
43
- end
44
-
45
- end
46
- end
47
- end
48
- end
@@ -1,9 +0,0 @@
1
- module FormtasticBootstrap
2
- module Inputs
3
- module Base
4
- module GroupedCollections
5
- include Formtastic::Inputs::Base::GroupedCollections
6
- end
7
- end
8
- end
9
- end
@@ -1,27 +0,0 @@
1
- module FormtasticBootstrap
2
- module Inputs
3
- module Base
4
- module Hints
5
-
6
- include Formtastic::Inputs::Base::Hints
7
-
8
- def hint_html(inline_or_block = :block)
9
- if hint?
10
- hint_class = if inline_or_block == :inline
11
- options[:hint_class] || builder.default_inline_hint_class
12
- else
13
- options[:hint_class] || builder.default_block_hint_class
14
- end
15
- template.content_tag(
16
- :span,
17
- Formtastic::Util.html_safe(hint_text),
18
- :class => hint_class
19
- )
20
- end
21
- end
22
-
23
- end
24
- end
25
- end
26
- end
27
-
@@ -1,21 +0,0 @@
1
- module FormtasticBootstrap
2
- module Inputs
3
- module Base
4
- module Html
5
-
6
- include Formtastic::Inputs::Base::Html
7
-
8
- def input_html_options
9
- if errors?
10
- {
11
- :class => "error"
12
- }.merge(super)
13
- else
14
- super
15
- end
16
- end
17
-
18
- end
19
- end
20
- end
21
- end
@@ -1,29 +0,0 @@
1
- module FormtasticBootstrap
2
- module Inputs
3
- module Base
4
- module Labelling
5
-
6
- include Formtastic::Inputs::Base::Labelling
7
-
8
- def label_html_options
9
- super.tap do |options|
10
- # Bootstrap defines class 'label'
11
- options[:class] = options[:class].reject { |c| c == 'label' }
12
- # options[:class] << "control-label"
13
- end
14
- end
15
-
16
- def control_label_html_options
17
- label_html_options.tap do |options|
18
- options[:class] << "control-label"
19
- end
20
- end
21
-
22
- def control_label_html
23
- render_label? ? builder.label(input_name, label_text, control_label_html_options) : "".html_safe
24
- end
25
-
26
- end
27
- end
28
- end
29
- end