formtastic-bootstrap 2.0.0 → 2.1.0

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 (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,164 +0,0 @@
1
- # encoding: utf-8
2
- require 'spec_helper'
3
-
4
- describe 'date select input' do
5
-
6
- include FormtasticSpecHelper
7
-
8
- before do
9
- @output_buffer = ''
10
- mock_everything
11
- end
12
-
13
- describe "general" do
14
-
15
- before do
16
- output_buffer.replace ''
17
- concat(semantic_form_for(@new_post) do |builder|
18
- concat(builder.input(:publish_at, :as => :date_select, :order => [:year, :month, :day]))
19
- end)
20
- end
21
-
22
- it_should_have_bootstrap_horizontal_wrapping
23
- it_should_have_input_wrapper_with_class("date_select")
24
- it_should_have_input_wrapper_with_class(:input)
25
- it_should_have_input_wrapper_with_id("post_publish_at_input")
26
- it_should_apply_error_logic_for_input_type(:date_select)
27
-
28
- it 'should have a label with the label text inside the control-group' do
29
- output_buffer.should have_tag('form div.control-group > label.control-label', /Publish at/)
30
- output_buffer.should have_tag('form div.control-group label.control-label[@for="post_publish_at"]')
31
- end
32
-
33
- it 'should not associate the legend label with the first select' do
34
- output_buffer.should_not have_tag('form div.control-group label.control-label[@for="post_publish_at_1i"]')
35
- end
36
-
37
- it 'should not have three labels for year, month and day' do
38
- output_buffer.should_not have_tag('form div.control-group div.controls label', :count => 3)
39
- output_buffer.should_not have_tag('form div.control-group div.controls label', /year/i)
40
- output_buffer.should_not have_tag('form div.control-group div.controls label', /month/i)
41
- output_buffer.should_not have_tag('form div.control-group div.controls label', /day/i)
42
- end
43
-
44
- it 'should have three selects for year, month and day' do
45
- output_buffer.should have_tag('form div.control-group div.controls select', :count => 3)
46
- end
47
- end
48
-
49
- describe "when namespace is provided" do
50
-
51
- before do
52
- output_buffer.replace ''
53
- concat(semantic_form_for(@new_post, :namespace => "context2") do |builder|
54
- concat(builder.input(:publish_at, :as => :date_select, :order => [:year, :month, :day]))
55
- end)
56
- end
57
-
58
- it_should_have_input_wrapper_with_id("context2_post_publish_at_input")
59
- it_should_have_select_with_id("context2_post_publish_at_1i")
60
- it_should_have_select_with_id("context2_post_publish_at_2i")
61
- it_should_have_select_with_id("context2_post_publish_at_3i")
62
-
63
- end
64
-
65
- describe "when index is provided" do
66
-
67
- before do
68
- @output_buffer = ''
69
- mock_everything
70
-
71
- concat(semantic_form_for(@new_post) do |builder|
72
- concat(builder.fields_for(:author, :index => 3) do |author|
73
- concat(author.input(:created_at, :as => :date_select))
74
- end)
75
- end)
76
- end
77
-
78
- it 'should index the id of the control-group' do
79
- output_buffer.should have_tag("div.control-group#post_author_attributes_3_created_at_input")
80
- end
81
-
82
- it 'should index the id of the select tag' do
83
- output_buffer.should have_tag("select#post_author_attributes_3_created_at_1i")
84
- output_buffer.should have_tag("select#post_author_attributes_3_created_at_2i")
85
- output_buffer.should have_tag("select#post_author_attributes_3_created_at_3i")
86
- end
87
-
88
- it 'should index the name of the select tag' do
89
- output_buffer.should have_tag("select[@name='post[author_attributes][3][created_at(1i)]']")
90
- output_buffer.should have_tag("select[@name='post[author_attributes][3][created_at(2i)]']")
91
- output_buffer.should have_tag("select[@name='post[author_attributes][3][created_at(3i)]']")
92
- end
93
-
94
- end
95
-
96
- describe ':labels option' do
97
- it "should provide a message that :labels is not supported" do
98
- pending ':labels is not supported'
99
- end
100
- end
101
-
102
- describe "when required" do
103
- it "should add the required attribute to the input's html options" do
104
- with_config :use_required_attribute, true do
105
- concat(semantic_form_for(@new_post) do |builder|
106
- concat(builder.input(:title, :as => :date_select, :required => true))
107
- end)
108
- output_buffer.should have_tag("select[@required]", :count => 3)
109
- end
110
- end
111
- end
112
-
113
- describe "when order does not include day" do
114
- before do
115
- output_buffer.replace ''
116
- concat(semantic_form_for(@new_post) do |builder|
117
- concat(builder.input(:publish_at, :as => :date_select, :order => [:year, :month]))
118
- end)
119
- end
120
-
121
- it "should include a hidden input for day" do
122
- output_buffer.should have_tag('input[@type="hidden"][@name="post[publish_at(3i)]"][@value="1"]')
123
- end
124
-
125
- it "should not include a select for day" do
126
- output_buffer.should_not have_tag('select[@name="post[publish_at(3i)]"]')
127
- end
128
- end
129
-
130
- describe "when order does not include month" do
131
- before do
132
- output_buffer.replace ''
133
- concat(semantic_form_for(@new_post) do |builder|
134
- concat(builder.input(:publish_at, :as => :date_select, :order => [:year, :day]))
135
- end)
136
- end
137
-
138
- it "should include a hidden input for month" do
139
- output_buffer.should have_tag('input[@type="hidden"][@name="post[publish_at(2i)]"][@value="1"]')
140
- end
141
-
142
- it "should not include a select for month" do
143
- output_buffer.should_not have_tag('select[@name="post[publish_at(2i)]"]')
144
- end
145
- end
146
-
147
- describe "when order does not include year" do
148
- before do
149
- output_buffer.replace ''
150
- concat(semantic_form_for(@new_post) do |builder|
151
- concat(builder.input(:publish_at, :as => :date_select, :order => [:month, :day]))
152
- end)
153
- end
154
-
155
- it "should include a hidden input for month" do
156
- output_buffer.should have_tag("input[@type=\"hidden\"][@name=\"post[publish_at(1i)]\"][@value=\"#{Time.now.year}\"]")
157
- end
158
-
159
- it "should not include a select for month" do
160
- output_buffer.should_not have_tag('select[@name="post[publish_at(1i)]"]')
161
- end
162
- end
163
-
164
- end
@@ -1,112 +0,0 @@
1
- # encoding: utf-8
2
- require 'spec_helper'
3
-
4
- describe 'datetime select input' do
5
-
6
- include FormtasticSpecHelper
7
-
8
- before do
9
- @output_buffer = ''
10
- mock_everything
11
- end
12
-
13
- describe "general" do
14
-
15
- before do
16
- ::I18n.backend.store_translations :en, {}
17
- output_buffer.replace ''
18
- concat(semantic_form_for(@new_post) do |builder|
19
- concat(builder.input(:publish_at, :as => :datetime_select))
20
- end)
21
- end
22
-
23
- it_should_have_bootstrap_horizontal_wrapping
24
- it_should_have_input_wrapper_with_class("datetime_select")
25
- it_should_have_input_wrapper_with_class(:input)
26
- it_should_have_input_wrapper_with_id("post_publish_at_input")
27
- it_should_apply_error_logic_for_input_type(:datetime_select)
28
-
29
- it 'should have a legend and label with the label text inside the fieldset' do
30
- output_buffer.should have_tag('form div.control-group.datetime_select label.control-label', /Publish at/)
31
- end
32
-
33
- it 'should have five selects' do
34
- output_buffer.should have_tag('form div.control-group.datetime_select div.controls select', :count => 5)
35
- end
36
- end
37
-
38
- describe "when namespace is provided" do
39
-
40
- before do
41
- output_buffer.replace ''
42
- concat(semantic_form_for(@new_post, :namespace => "context2") do |builder|
43
- concat(builder.input(:publish_at, :as => :datetime_select))
44
- end)
45
- end
46
-
47
- it_should_have_input_wrapper_with_id("context2_post_publish_at_input")
48
- it_should_have_select_with_id("context2_post_publish_at_1i")
49
- it_should_have_select_with_id("context2_post_publish_at_2i")
50
- it_should_have_select_with_id("context2_post_publish_at_3i")
51
- it_should_have_select_with_id("context2_post_publish_at_4i")
52
- it_should_have_select_with_id("context2_post_publish_at_5i")
53
-
54
- end
55
-
56
- describe "when index is provided" do
57
-
58
- before do
59
- @output_buffer = ''
60
- mock_everything
61
-
62
- concat(semantic_form_for(@new_post) do |builder|
63
- concat(builder.fields_for(:author, :index => 3) do |author|
64
- concat(author.input(:created_at, :as => :datetime_select))
65
- end)
66
- end)
67
- end
68
-
69
- it 'should index the id of the control-group' do
70
- output_buffer.should have_tag("div.control-group#post_author_attributes_3_created_at_input")
71
- end
72
-
73
- it 'should index the id of the select tag' do
74
- output_buffer.should have_tag("select#post_author_attributes_3_created_at_1i")
75
- output_buffer.should have_tag("select#post_author_attributes_3_created_at_2i")
76
- output_buffer.should have_tag("select#post_author_attributes_3_created_at_3i")
77
- output_buffer.should have_tag("select#post_author_attributes_3_created_at_4i")
78
- output_buffer.should have_tag("select#post_author_attributes_3_created_at_5i")
79
- end
80
-
81
- it 'should index the name of the select tag' do
82
- output_buffer.should have_tag("select[@name='post[author_attributes][3][created_at(1i)]']")
83
- output_buffer.should have_tag("select[@name='post[author_attributes][3][created_at(2i)]']")
84
- output_buffer.should have_tag("select[@name='post[author_attributes][3][created_at(3i)]']")
85
- output_buffer.should have_tag("select[@name='post[author_attributes][3][created_at(4i)]']")
86
- output_buffer.should have_tag("select[@name='post[author_attributes][3][created_at(5i)]']")
87
- end
88
-
89
- end
90
-
91
-
92
- describe ':labels option' do
93
- describe ':labels option' do
94
- it "should provide a message that :labels is not supported" do
95
- pending ':labels is not supported'
96
- end
97
- end
98
-
99
- end
100
-
101
- describe "when required" do
102
- it "should add the required attribute to the input's html options" do
103
- with_config :use_required_attribute, true do
104
- concat(semantic_form_for(@new_post) do |builder|
105
- concat(builder.input(:title, :as => :datetime_select, :required => true))
106
- end)
107
- output_buffer.should have_tag("select[@required]", :count => 5)
108
- end
109
- end
110
- end
111
-
112
- end
@@ -1,48 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe 'deprecated time, datetime and date inputs' do
4
- include FormtasticSpecHelper
5
-
6
- before do
7
- @output_buffer = ''
8
- mock_everything
9
- end
10
-
11
- it 'should warn :time is deprecated' do
12
- ::ActiveSupport::Deprecation.should_receive(:warn)
13
- semantic_form_for(@new_post) do |f|
14
- concat(f.input :created_at, :as => :time)
15
- end
16
- end
17
-
18
- it 'should warn :datetime is deprecated' do
19
- ::ActiveSupport::Deprecation.should_receive(:warn)
20
- semantic_form_for(@new_post) do |f|
21
- concat(f.input :created_at, :as => :datetime)
22
- end
23
- end
24
-
25
- it 'should warn :date is deprecated' do
26
- ::ActiveSupport::Deprecation.should_receive(:warn)
27
- semantic_form_for(@new_post) do |f|
28
- concat(f.input :created_at, :as => :date)
29
- end
30
- end
31
-
32
- it 'should use wrapper css class based off :as, not off their parent class' do
33
- with_deprecation_silenced do
34
- concat(semantic_form_for(@new_post) do |f|
35
- concat(f.input :created_at, :as => :time)
36
- concat(f.input :created_at, :as => :datetime)
37
- concat(f.input :created_at, :as => :date)
38
- end)
39
- end
40
- output_buffer.should have_tag('div.control-group.time')
41
- output_buffer.should have_tag('div.control-group.datetime')
42
- output_buffer.should have_tag('div.control-group.date')
43
- output_buffer.should_not have_tag('li.time_select')
44
- output_buffer.should_not have_tag('li.datetime_select')
45
- output_buffer.should_not have_tag('li.date_select')
46
- end
47
-
48
- end
@@ -1,86 +0,0 @@
1
- # encoding: utf-8
2
- require 'spec_helper'
3
-
4
- describe 'email input' do
5
-
6
- include FormtasticSpecHelper
7
-
8
- before do
9
- @output_buffer = ''
10
- mock_everything
11
- end
12
-
13
- describe "when object is provided" do
14
- before do
15
- concat(semantic_form_for(@new_post) do |builder|
16
- concat(builder.input(:email))
17
- end)
18
- end
19
-
20
- it_should_have_bootstrap_horizontal_wrapping
21
- it_should_have_input_wrapper_with_class(:email)
22
- it_should_have_input_wrapper_with_class(:input)
23
- it_should_have_input_wrapper_with_class(:stringish)
24
- it_should_have_input_wrapper_with_id("post_email_input")
25
- it_should_have_label_with_text(/Email/)
26
- it_should_have_label_for("post_email")
27
- it_should_have_input_with_id("post_email")
28
- it_should_have_input_with_type(:email)
29
- it_should_have_input_with_name("post[email]")
30
-
31
- end
32
-
33
- describe "when namespace is provided" do
34
-
35
- before do
36
- concat(semantic_form_for(@new_post, :namespace => 'context2') do |builder|
37
- concat(builder.input(:email))
38
- end)
39
- end
40
-
41
- it_should_have_input_wrapper_with_id("context2_post_email_input")
42
- it_should_have_label_and_input_with_id("context2_post_email")
43
-
44
- end
45
-
46
- describe "when index is provided" do
47
-
48
- before do
49
- @output_buffer = ''
50
- mock_everything
51
-
52
- concat(semantic_form_for(@new_post) do |builder|
53
- concat(builder.fields_for(:author, :index => 3) do |author|
54
- concat(author.input(:name, :as => :email))
55
- end)
56
- end)
57
- end
58
-
59
- it 'should index the id of the wrapper' do
60
- output_buffer.should have_tag("div.control-group#post_author_attributes_3_name_input")
61
- end
62
-
63
- it 'should index the id of the select tag' do
64
- output_buffer.should have_tag("input#post_author_attributes_3_name")
65
- end
66
-
67
- it 'should index the name of the select tag' do
68
- output_buffer.should have_tag("input[@name='post[author_attributes][3][name]']")
69
- end
70
-
71
- end
72
-
73
-
74
- describe "when required" do
75
- it "should add the required attribute to the input's html options" do
76
- with_config :use_required_attribute, true do
77
- concat(semantic_form_for(@new_post) do |builder|
78
- concat(builder.input(:title, :as => :email, :required => true))
79
- end)
80
- output_buffer.should have_tag("input[@required]")
81
- end
82
- end
83
- end
84
-
85
- end
86
-
@@ -1,90 +0,0 @@
1
- # encoding: utf-8
2
- require 'spec_helper'
3
-
4
- describe 'file input' do
5
-
6
- include FormtasticSpecHelper
7
-
8
- before do
9
- @output_buffer = ''
10
- mock_everything
11
-
12
- concat(semantic_form_for(@new_post) do |builder|
13
- concat(builder.input(:body, :as => :file))
14
- end)
15
- end
16
-
17
- it_should_have_bootstrap_horizontal_wrapping
18
- it_should_have_input_wrapper_with_class("file")
19
- it_should_have_input_wrapper_with_class(:input)
20
- it_should_have_input_wrapper_with_id("post_body_input")
21
- it_should_have_label_with_text(/Body/)
22
- it_should_have_label_for("post_body")
23
- it_should_have_input_with_id("post_body")
24
- it_should_have_input_with_name("post[body]")
25
- it_should_apply_error_logic_for_input_type(:file)
26
-
27
- it 'should use input_html to style inputs' do
28
- concat(semantic_form_for(@new_post) do |builder|
29
- concat(builder.input(:title, :as => :file, :input_html => { :class => 'myclass' }))
30
- end)
31
- output_buffer.should have_tag("form div.control-group div.controls input.myclass")
32
- end
33
-
34
- describe "when namespace is provided" do
35
-
36
- before do
37
- @output_buffer = ''
38
- mock_everything
39
-
40
- concat(semantic_form_for(@new_post, :namespace => 'context2') do |builder|
41
- concat(builder.input(:body, :as => :file))
42
- end)
43
- end
44
-
45
- it_should_have_input_wrapper_with_id("context2_post_body_input")
46
- it_should_have_label_and_input_with_id("context2_post_body")
47
-
48
- end
49
-
50
- describe "when index is provided" do
51
-
52
- before do
53
- @output_buffer = ''
54
- mock_everything
55
-
56
- concat(semantic_form_for(@new_post) do |builder|
57
- concat(builder.fields_for(:author, :index => 3) do |author|
58
- concat(author.input(:name, :as => :file))
59
- end)
60
- end)
61
- end
62
-
63
- it 'should index the id of the control group' do
64
- output_buffer.should have_tag("div.control-group#post_author_attributes_3_name_input")
65
- end
66
-
67
- it 'should index the id of the select tag' do
68
- output_buffer.should have_tag("input#post_author_attributes_3_name")
69
- end
70
-
71
- it 'should index the name of the select tag' do
72
- output_buffer.should have_tag("input[@name='post[author_attributes][3][name]']")
73
- end
74
-
75
- end
76
-
77
-
78
- context "when required" do
79
- it "should add the required attribute to the input's html options" do
80
- with_config :use_required_attribute, true do
81
- concat(semantic_form_for(@new_post) do |builder|
82
- concat(builder.input(:title, :as => :file, :required => true))
83
- end)
84
- output_buffer.should have_tag("input[@required]")
85
- end
86
- end
87
- end
88
-
89
- end
90
-