formtastic-bootstrap 1.2.0 → 2.0.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 (90) hide show
  1. data/Gemfile +5 -3
  2. data/Gemfile.lock +72 -60
  3. data/README.md +4 -1
  4. data/Rakefile +1 -1
  5. data/VERSION +1 -1
  6. data/formtastic-bootstrap.gemspec +49 -16
  7. data/lib/formtastic-bootstrap/actions/base.rb +22 -0
  8. data/lib/formtastic-bootstrap/actions/button_action.rb +13 -0
  9. data/lib/formtastic-bootstrap/actions/input_action.rb +13 -0
  10. data/lib/formtastic-bootstrap/actions/link_action.rb +12 -0
  11. data/lib/formtastic-bootstrap/actions.rb +10 -0
  12. data/lib/formtastic-bootstrap/form_builder.rb +4 -2
  13. data/lib/formtastic-bootstrap/helpers/action_helper.rb +12 -0
  14. data/lib/formtastic-bootstrap/helpers/actions_helper.rb +24 -0
  15. data/lib/formtastic-bootstrap/helpers/fieldset_wrapper.rb +2 -4
  16. data/lib/formtastic-bootstrap/helpers/inputs_helper.rb +0 -2
  17. data/lib/formtastic-bootstrap/helpers.rb +6 -8
  18. data/lib/formtastic-bootstrap/inputs/base/choices.rb +6 -35
  19. data/lib/formtastic-bootstrap/inputs/base/collections.rb +9 -0
  20. data/lib/formtastic-bootstrap/inputs/base/grouped_collections.rb +9 -0
  21. data/lib/formtastic-bootstrap/inputs/base/hints.rb +1 -1
  22. data/lib/formtastic-bootstrap/inputs/base/labelling.rb +14 -3
  23. data/lib/formtastic-bootstrap/inputs/base/numeric.rb +9 -0
  24. data/lib/formtastic-bootstrap/inputs/base/stringish.rb +4 -5
  25. data/lib/formtastic-bootstrap/inputs/base/timeish.rb +38 -18
  26. data/lib/formtastic-bootstrap/inputs/base/wrapping.rb +22 -34
  27. data/lib/formtastic-bootstrap/inputs/base.rb +29 -6
  28. data/lib/formtastic-bootstrap/inputs/boolean_input.rb +14 -18
  29. data/lib/formtastic-bootstrap/inputs/check_boxes_input.rb +16 -11
  30. data/lib/formtastic-bootstrap/inputs/date_input.rb +3 -9
  31. data/lib/formtastic-bootstrap/inputs/date_select_input.rb +8 -0
  32. data/lib/formtastic-bootstrap/inputs/datetime_input.rb +3 -12
  33. data/lib/formtastic-bootstrap/inputs/datetime_select_input.rb +8 -0
  34. data/lib/formtastic-bootstrap/inputs/email_input.rb +1 -1
  35. data/lib/formtastic-bootstrap/inputs/file_input.rb +1 -1
  36. data/lib/formtastic-bootstrap/inputs/hidden_input.rb +1 -1
  37. data/lib/formtastic-bootstrap/inputs/number_input.rb +3 -3
  38. data/lib/formtastic-bootstrap/inputs/password_input.rb +1 -1
  39. data/lib/formtastic-bootstrap/inputs/phone_input.rb +1 -1
  40. data/lib/formtastic-bootstrap/inputs/radio_input.rb +28 -14
  41. data/lib/formtastic-bootstrap/inputs/range_input.rb +1 -1
  42. data/lib/formtastic-bootstrap/inputs/search_input.rb +1 -1
  43. data/lib/formtastic-bootstrap/inputs/select_input.rb +3 -1
  44. data/lib/formtastic-bootstrap/inputs/string_input.rb +0 -7
  45. data/lib/formtastic-bootstrap/inputs/text_input.rb +1 -1
  46. data/lib/formtastic-bootstrap/inputs/time_input.rb +3 -9
  47. data/lib/formtastic-bootstrap/inputs/time_select_input.rb +8 -0
  48. data/lib/formtastic-bootstrap/inputs/time_zone_input.rb +1 -1
  49. data/lib/formtastic-bootstrap/inputs/url_input.rb +1 -1
  50. data/lib/formtastic-bootstrap/inputs.rb +30 -23
  51. data/lib/formtastic-bootstrap.rb +16 -1
  52. data/spec/actions/button_action_spec.rb +63 -0
  53. data/spec/actions/input_action_spec.rb +59 -0
  54. data/spec/actions/link_action_spec.rb +92 -0
  55. data/spec/helpers/action_helper_spec.rb +368 -0
  56. data/spec/helpers/actions_helper_spec.rb +147 -0
  57. data/spec/helpers/input_helper_spec.rb +238 -259
  58. data/spec/helpers/inputs_helper_spec.rb +84 -25
  59. data/spec/inputs/boolean_input_spec.rb +108 -75
  60. data/spec/inputs/check_boxes_input_spec.rb +106 -91
  61. data/spec/inputs/date_select_input_spec.rb +164 -0
  62. data/spec/inputs/datetime_select_input_spec.rb +112 -0
  63. data/spec/inputs/deprecated_time_date_datetime_inputs_spec.rb +48 -0
  64. data/spec/inputs/email_input_spec.rb +30 -3
  65. data/spec/inputs/file_input_spec.rb +31 -4
  66. data/spec/inputs/hidden_input_spec.rb +63 -32
  67. data/spec/inputs/number_input_spec.rb +37 -8
  68. data/spec/inputs/password_input_spec.rb +30 -3
  69. data/spec/inputs/phone_input_spec.rb +30 -3
  70. data/spec/inputs/radio_input_spec.rb +87 -60
  71. data/spec/inputs/range_input_spec.rb +32 -5
  72. data/spec/inputs/search_input_spec.rb +29 -3
  73. data/spec/inputs/select_input_spec.rb +164 -107
  74. data/spec/inputs/string_input_spec.rb +33 -22
  75. data/spec/inputs/text_input_spec.rb +39 -14
  76. data/spec/inputs/time_select_input_spec.rb +191 -0
  77. data/spec/inputs/time_zone_input_spec.rb +17 -19
  78. data/spec/inputs/url_input_spec.rb +30 -3
  79. data/spec/spec_helper.rb +21 -15
  80. data/spec/support/custom_macros.rb +61 -228
  81. data/spec/support/fb_custom_macros.rb +23 -0
  82. metadata +109 -28
  83. data/lib/formtastic-bootstrap/helpers/buttons_helper.rb +0 -52
  84. data/spec/builder/errors_spec.rb +0 -214
  85. data/spec/helpers/buttons_helper_spec.rb +0 -149
  86. data/spec/inputs/date_input_spec.rb +0 -147
  87. data/spec/inputs/datetime_input_spec.rb +0 -101
  88. data/spec/inputs/time_input_spec.rb +0 -206
  89. data/spec/support/depracation.rb +0 -6
  90. data/spec/support/formtastic_spec_helper.rb +0 -382
data/Gemfile CHANGED
@@ -1,10 +1,12 @@
1
1
  source "http://rubygems.org"
2
2
 
3
- gem 'formtastic'
4
- gem 'rails', '~> 3.1.0'
3
+ gemspec
4
+
5
+ gem 'formtastic', "~> 2.2"
5
6
 
6
7
  group :development, :test do
7
- gem "rspec"
8
+ gem "ammeter"
9
+ gem "rspec-rails", "~> 2.8.0"
8
10
  gem "bundler"
9
11
  gem "jeweler"
10
12
  gem "rcov", ">= 0"
data/Gemfile.lock CHANGED
@@ -1,40 +1,51 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ formtastic-bootstrap (1.2.0)
5
+ formtastic
6
+ rails (>= 3.1.0)
7
+
1
8
  GEM
2
9
  remote: http://rubygems.org/
3
10
  specs:
4
- actionmailer (3.1.3)
5
- actionpack (= 3.1.3)
6
- mail (~> 2.3.0)
7
- actionpack (3.1.3)
8
- activemodel (= 3.1.3)
9
- activesupport (= 3.1.3)
11
+ actionmailer (3.2.3)
12
+ actionpack (= 3.2.3)
13
+ mail (~> 2.4.4)
14
+ actionpack (3.2.3)
15
+ activemodel (= 3.2.3)
16
+ activesupport (= 3.2.3)
10
17
  builder (~> 3.0.0)
11
18
  erubis (~> 2.7.0)
12
- i18n (~> 0.6)
13
- rack (~> 1.3.5)
14
- rack-cache (~> 1.1)
15
- rack-mount (~> 0.8.2)
19
+ journey (~> 1.0.1)
20
+ rack (~> 1.4.0)
21
+ rack-cache (~> 1.2)
16
22
  rack-test (~> 0.6.1)
17
- sprockets (~> 2.0.3)
18
- activemodel (3.1.3)
19
- activesupport (= 3.1.3)
23
+ sprockets (~> 2.1.2)
24
+ activemodel (3.2.3)
25
+ activesupport (= 3.2.3)
20
26
  builder (~> 3.0.0)
21
- i18n (~> 0.6)
22
- activerecord (3.1.3)
23
- activemodel (= 3.1.3)
24
- activesupport (= 3.1.3)
25
- arel (~> 2.2.1)
27
+ activerecord (3.2.3)
28
+ activemodel (= 3.2.3)
29
+ activesupport (= 3.2.3)
30
+ arel (~> 3.0.2)
26
31
  tzinfo (~> 0.3.29)
27
- activeresource (3.1.3)
28
- activemodel (= 3.1.3)
29
- activesupport (= 3.1.3)
30
- activesupport (3.1.3)
32
+ activeresource (3.2.3)
33
+ activemodel (= 3.2.3)
34
+ activesupport (= 3.2.3)
35
+ activesupport (3.2.3)
36
+ i18n (~> 0.6)
31
37
  multi_json (~> 1.0)
32
- arel (2.2.1)
38
+ ammeter (0.2.4)
39
+ activesupport (>= 3.0)
40
+ railties (>= 3.0)
41
+ rspec (>= 2.2)
42
+ rspec-rails (>= 2.2)
43
+ arel (3.0.2)
33
44
  builder (3.0.0)
34
45
  diff-lcs (1.1.3)
35
46
  erubis (2.7.0)
36
- formtastic (2.0.2)
37
- rails (~> 3.0)
47
+ formtastic (2.2.0)
48
+ actionpack (>= 3.0)
38
49
  git (1.2.5)
39
50
  hike (1.2.1)
40
51
  i18n (0.6.0)
@@ -42,35 +53,34 @@ GEM
42
53
  bundler (~> 1.0)
43
54
  git (>= 1.2.5)
44
55
  rake
45
- json (1.6.3)
46
- mail (2.3.0)
56
+ journey (1.0.3)
57
+ json (1.7.3)
58
+ mail (2.4.4)
47
59
  i18n (>= 0.4.0)
48
60
  mime-types (~> 1.16)
49
61
  treetop (~> 1.4.8)
50
- mime-types (1.17.2)
51
- multi_json (1.0.4)
52
- nokogiri (1.5.0)
62
+ mime-types (1.18)
63
+ multi_json (1.3.6)
64
+ nokogiri (1.5.3)
53
65
  polyglot (0.3.3)
54
- rack (1.3.5)
55
- rack-cache (1.1)
66
+ rack (1.4.1)
67
+ rack-cache (1.2)
56
68
  rack (>= 0.4)
57
- rack-mount (0.8.3)
58
- rack (>= 1.0.0)
59
69
  rack-ssl (1.3.2)
60
70
  rack
61
71
  rack-test (0.6.1)
62
72
  rack (>= 1.0)
63
- rails (3.1.3)
64
- actionmailer (= 3.1.3)
65
- actionpack (= 3.1.3)
66
- activerecord (= 3.1.3)
67
- activeresource (= 3.1.3)
68
- activesupport (= 3.1.3)
73
+ rails (3.2.3)
74
+ actionmailer (= 3.2.3)
75
+ actionpack (= 3.2.3)
76
+ activerecord (= 3.2.3)
77
+ activeresource (= 3.2.3)
78
+ activesupport (= 3.2.3)
69
79
  bundler (~> 1.0)
70
- railties (= 3.1.3)
71
- railties (3.1.3)
72
- actionpack (= 3.1.3)
73
- activesupport (= 3.1.3)
80
+ railties (= 3.2.3)
81
+ railties (3.2.3)
82
+ actionpack (= 3.2.3)
83
+ activesupport (= 3.2.3)
74
84
  rack-ssl (~> 1.3.2)
75
85
  rake (>= 0.8.7)
76
86
  rdoc (~> 3.4)
@@ -79,23 +89,23 @@ GEM
79
89
  rcov (0.9.11)
80
90
  rdoc (3.12)
81
91
  json (~> 1.4)
82
- rspec (2.7.0)
83
- rspec-core (~> 2.7.0)
84
- rspec-expectations (~> 2.7.0)
85
- rspec-mocks (~> 2.7.0)
86
- rspec-core (2.7.1)
87
- rspec-expectations (2.7.0)
92
+ rspec (2.8.0)
93
+ rspec-core (~> 2.8.0)
94
+ rspec-expectations (~> 2.8.0)
95
+ rspec-mocks (~> 2.8.0)
96
+ rspec-core (2.8.0)
97
+ rspec-expectations (2.8.0)
88
98
  diff-lcs (~> 1.1.2)
89
- rspec-mocks (2.7.0)
90
- rspec-rails (2.7.0)
91
- actionpack (~> 3.0)
92
- activesupport (~> 3.0)
93
- railties (~> 3.0)
94
- rspec (~> 2.7.0)
99
+ rspec-mocks (2.8.0)
100
+ rspec-rails (2.8.1)
101
+ actionpack (>= 3.0)
102
+ activesupport (>= 3.0)
103
+ railties (>= 3.0)
104
+ rspec (~> 2.8.0)
95
105
  rspec_tag_matchers (1.0.0)
96
106
  nokogiri (>= 1.4.0)
97
107
  rspec-rails (>= 1.2.6)
98
- sprockets (2.0.3)
108
+ sprockets (2.1.3)
99
109
  hike (~> 1.2)
100
110
  rack (~> 1.0)
101
111
  tilt (~> 1.1, != 1.3.0)
@@ -104,16 +114,18 @@ GEM
104
114
  treetop (1.4.10)
105
115
  polyglot
106
116
  polyglot (>= 0.3.1)
107
- tzinfo (0.3.31)
117
+ tzinfo (0.3.33)
108
118
 
109
119
  PLATFORMS
110
120
  ruby
111
121
 
112
122
  DEPENDENCIES
123
+ ammeter
113
124
  bundler
114
- formtastic
125
+ formtastic (~> 2.2)
126
+ formtastic-bootstrap!
115
127
  jeweler
116
- rails (~> 3.1.0)
117
128
  rcov
118
129
  rspec
130
+ rspec-rails (~> 2.8.0)
119
131
  rspec_tag_matchers
data/README.md CHANGED
@@ -8,7 +8,7 @@ You can follow [FormBoot on twitter](http://twitter.com/FormBoot) for update ann
8
8
 
9
9
  ### Dependencies
10
10
 
11
- Formtastic Bootstrap has only been tested with Ruby 1.9.2, Rails 3.1, Formtastic 2.0 and Twitter Bootstrap 1.3.
11
+ Formtastic Bootstrap has only been tested with Ruby 1.9.2, Rails 3.2.x, Formtastic 2.2.x and Twitter Bootstrap 2.x.
12
12
 
13
13
  #### Installation
14
14
 
@@ -39,6 +39,7 @@ Make sure you've already downloaded and installed Formtastic!
39
39
 
40
40
  ## Formtastic vs. Formtastic Bootstrap
41
41
 
42
+ THIS SECTION IS OUT OF DATE.
42
43
 
43
44
  ### Overview
44
45
 
@@ -97,6 +98,8 @@ made to generate the HTML expected by Bootstrap while still generating the rich
97
98
 
98
99
  ### Major Difference in Behavior
99
100
 
101
+ THIS SECTION IS OUT OF DATE
102
+
100
103
  * Formtastic Bootstrap omits the <tt>label</tt> class on label tags since Twitter Bootstrap uses this tag in another context (and it makes bad things happen.)
101
104
  * Formtastic Bootstrap puts the <tt>input</tt> label in a different place because it makes Bootstrap behave correctly.
102
105
  * Formtastic Bootstrap renders <tt>:date</tt>, <tt>:datetime</tt> and <tt>:time</tt> as text fields since this is how Twitter Bootstrap presents these data types (Formtastic renders them as dropdowns.) Some Rails magic may have been lost here. Additionally:
data/Rakefile CHANGED
@@ -38,7 +38,7 @@ end
38
38
 
39
39
  task :default => :spec
40
40
 
41
- require 'rake/rdoctask'
41
+ require 'rdoc/task'
42
42
  Rake::RDocTask.new do |rdoc|
43
43
  version = File.exist?('VERSION') ? File.read('VERSION') : ""
44
44
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.2.0
1
+ 2.0.0
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "formtastic-bootstrap"
8
- s.version = "1.2.0"
8
+ s.version = "2.0.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Matthew Bellantoni"]
12
- s.date = "2012-02-05"
12
+ s.date = "2012-09-05"
13
13
  s.description = "Formtastic form builder to generate Twitter Bootstrap-friendly markup."
14
14
  s.email = "mjbellantoni@yahoo.com"
15
15
  s.extra_rdoc_files = [
@@ -28,27 +28,38 @@ Gem::Specification.new do |s|
28
28
  "formtastic-bootstrap.gemspec",
29
29
  "lib/action_view/helpers/text_field_date_helper.rb",
30
30
  "lib/formtastic-bootstrap.rb",
31
+ "lib/formtastic-bootstrap/actions.rb",
32
+ "lib/formtastic-bootstrap/actions/base.rb",
33
+ "lib/formtastic-bootstrap/actions/button_action.rb",
34
+ "lib/formtastic-bootstrap/actions/input_action.rb",
35
+ "lib/formtastic-bootstrap/actions/link_action.rb",
31
36
  "lib/formtastic-bootstrap/engine.rb",
32
37
  "lib/formtastic-bootstrap/form_builder.rb",
33
38
  "lib/formtastic-bootstrap/helpers.rb",
34
- "lib/formtastic-bootstrap/helpers/buttons_helper.rb",
39
+ "lib/formtastic-bootstrap/helpers/action_helper.rb",
40
+ "lib/formtastic-bootstrap/helpers/actions_helper.rb",
35
41
  "lib/formtastic-bootstrap/helpers/fieldset_wrapper.rb",
36
42
  "lib/formtastic-bootstrap/helpers/input_helper.rb",
37
43
  "lib/formtastic-bootstrap/helpers/inputs_helper.rb",
38
44
  "lib/formtastic-bootstrap/inputs.rb",
39
45
  "lib/formtastic-bootstrap/inputs/base.rb",
40
46
  "lib/formtastic-bootstrap/inputs/base/choices.rb",
47
+ "lib/formtastic-bootstrap/inputs/base/collections.rb",
41
48
  "lib/formtastic-bootstrap/inputs/base/errors.rb",
49
+ "lib/formtastic-bootstrap/inputs/base/grouped_collections.rb",
42
50
  "lib/formtastic-bootstrap/inputs/base/hints.rb",
43
51
  "lib/formtastic-bootstrap/inputs/base/html.rb",
44
52
  "lib/formtastic-bootstrap/inputs/base/labelling.rb",
53
+ "lib/formtastic-bootstrap/inputs/base/numeric.rb",
45
54
  "lib/formtastic-bootstrap/inputs/base/stringish.rb",
46
55
  "lib/formtastic-bootstrap/inputs/base/timeish.rb",
47
56
  "lib/formtastic-bootstrap/inputs/base/wrapping.rb",
48
57
  "lib/formtastic-bootstrap/inputs/boolean_input.rb",
49
58
  "lib/formtastic-bootstrap/inputs/check_boxes_input.rb",
50
59
  "lib/formtastic-bootstrap/inputs/date_input.rb",
60
+ "lib/formtastic-bootstrap/inputs/date_select_input.rb",
51
61
  "lib/formtastic-bootstrap/inputs/datetime_input.rb",
62
+ "lib/formtastic-bootstrap/inputs/datetime_select_input.rb",
52
63
  "lib/formtastic-bootstrap/inputs/email_input.rb",
53
64
  "lib/formtastic-bootstrap/inputs/file_input.rb",
54
65
  "lib/formtastic-bootstrap/inputs/hidden_input.rb",
@@ -62,17 +73,22 @@ Gem::Specification.new do |s|
62
73
  "lib/formtastic-bootstrap/inputs/string_input.rb",
63
74
  "lib/formtastic-bootstrap/inputs/text_input.rb",
64
75
  "lib/formtastic-bootstrap/inputs/time_input.rb",
76
+ "lib/formtastic-bootstrap/inputs/time_select_input.rb",
65
77
  "lib/formtastic-bootstrap/inputs/time_zone_input.rb",
66
78
  "lib/formtastic-bootstrap/inputs/url_input.rb",
67
- "spec/builder/errors_spec.rb",
79
+ "spec/actions/button_action_spec.rb",
80
+ "spec/actions/input_action_spec.rb",
81
+ "spec/actions/link_action_spec.rb",
68
82
  "spec/builder/semantic_fields_for_spec.rb",
69
- "spec/helpers/buttons_helper_spec.rb",
83
+ "spec/helpers/action_helper_spec.rb",
84
+ "spec/helpers/actions_helper_spec.rb",
70
85
  "spec/helpers/input_helper_spec.rb",
71
86
  "spec/helpers/inputs_helper_spec.rb",
72
87
  "spec/inputs/boolean_input_spec.rb",
73
88
  "spec/inputs/check_boxes_input_spec.rb",
74
- "spec/inputs/date_input_spec.rb",
75
- "spec/inputs/datetime_input_spec.rb",
89
+ "spec/inputs/date_select_input_spec.rb",
90
+ "spec/inputs/datetime_select_input_spec.rb",
91
+ "spec/inputs/deprecated_time_date_datetime_inputs_spec.rb",
76
92
  "spec/inputs/email_input_spec.rb",
77
93
  "spec/inputs/file_input_spec.rb",
78
94
  "spec/inputs/hidden_input_spec.rb",
@@ -85,13 +101,12 @@ Gem::Specification.new do |s|
85
101
  "spec/inputs/select_input_spec.rb",
86
102
  "spec/inputs/string_input_spec.rb",
87
103
  "spec/inputs/text_input_spec.rb",
88
- "spec/inputs/time_input_spec.rb",
104
+ "spec/inputs/time_select_input_spec.rb",
89
105
  "spec/inputs/time_zone_input_spec.rb",
90
106
  "spec/inputs/url_input_spec.rb",
91
107
  "spec/spec_helper.rb",
92
108
  "spec/support/custom_macros.rb",
93
- "spec/support/depracation.rb",
94
- "spec/support/formtastic_spec_helper.rb",
109
+ "spec/support/fb_custom_macros.rb",
95
110
  "vendor/assets/stylesheets/formtastic-bootstrap.css"
96
111
  ]
97
112
  s.homepage = "http://github.com/mjbellantoni/formtastic-bootstrap"
@@ -104,30 +119,48 @@ Gem::Specification.new do |s|
104
119
  s.specification_version = 3
105
120
 
106
121
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
107
- s.add_runtime_dependency(%q<formtastic>, [">= 0"])
108
- s.add_runtime_dependency(%q<rails>, ["~> 3.1.0"])
122
+ s.add_runtime_dependency(%q<formtastic-bootstrap>, [">= 0"])
123
+ s.add_runtime_dependency(%q<formtastic>, ["~> 2.2"])
109
124
  s.add_development_dependency(%q<rspec>, [">= 0"])
110
125
  s.add_development_dependency(%q<bundler>, [">= 0"])
111
126
  s.add_development_dependency(%q<jeweler>, [">= 0"])
112
127
  s.add_development_dependency(%q<rcov>, [">= 0"])
113
128
  s.add_development_dependency(%q<rspec_tag_matchers>, [">= 0"])
129
+ s.add_development_dependency(%q<ammeter>, [">= 0"])
130
+ s.add_development_dependency(%q<rspec-rails>, ["~> 2.8.0"])
131
+ s.add_development_dependency(%q<bundler>, [">= 0"])
132
+ s.add_development_dependency(%q<jeweler>, [">= 0"])
133
+ s.add_development_dependency(%q<rcov>, [">= 0"])
134
+ s.add_development_dependency(%q<rspec_tag_matchers>, [">= 0"])
114
135
  else
115
- s.add_dependency(%q<formtastic>, [">= 0"])
116
- s.add_dependency(%q<rails>, ["~> 3.1.0"])
136
+ s.add_dependency(%q<formtastic-bootstrap>, [">= 0"])
137
+ s.add_dependency(%q<formtastic>, ["~> 2.2"])
117
138
  s.add_dependency(%q<rspec>, [">= 0"])
118
139
  s.add_dependency(%q<bundler>, [">= 0"])
119
140
  s.add_dependency(%q<jeweler>, [">= 0"])
120
141
  s.add_dependency(%q<rcov>, [">= 0"])
121
142
  s.add_dependency(%q<rspec_tag_matchers>, [">= 0"])
143
+ s.add_dependency(%q<ammeter>, [">= 0"])
144
+ s.add_dependency(%q<rspec-rails>, ["~> 2.8.0"])
145
+ s.add_dependency(%q<bundler>, [">= 0"])
146
+ s.add_dependency(%q<jeweler>, [">= 0"])
147
+ s.add_dependency(%q<rcov>, [">= 0"])
148
+ s.add_dependency(%q<rspec_tag_matchers>, [">= 0"])
122
149
  end
123
150
  else
124
- s.add_dependency(%q<formtastic>, [">= 0"])
125
- s.add_dependency(%q<rails>, ["~> 3.1.0"])
151
+ s.add_dependency(%q<formtastic-bootstrap>, [">= 0"])
152
+ s.add_dependency(%q<formtastic>, ["~> 2.2"])
126
153
  s.add_dependency(%q<rspec>, [">= 0"])
127
154
  s.add_dependency(%q<bundler>, [">= 0"])
128
155
  s.add_dependency(%q<jeweler>, [">= 0"])
129
156
  s.add_dependency(%q<rcov>, [">= 0"])
130
157
  s.add_dependency(%q<rspec_tag_matchers>, [">= 0"])
158
+ s.add_dependency(%q<ammeter>, [">= 0"])
159
+ s.add_dependency(%q<rspec-rails>, ["~> 2.8.0"])
160
+ s.add_dependency(%q<bundler>, [">= 0"])
161
+ s.add_dependency(%q<jeweler>, [">= 0"])
162
+ s.add_dependency(%q<rcov>, [">= 0"])
163
+ s.add_dependency(%q<rspec_tag_matchers>, [">= 0"])
131
164
  end
132
165
  end
133
166
 
@@ -0,0 +1,22 @@
1
+ module FormtasticBootstrap
2
+ module Actions
3
+ module Base
4
+
5
+ # Bootstrap doesn't have wrappers.
6
+ def wrapper(&block)
7
+ # TODO Detect if user passed wrapper_html_options and issue
8
+ # a warning that they're ignored. (See the original in
9
+ # Formtastic.)
10
+ template.capture(&block)
11
+ end
12
+
13
+ def default_button_html
14
+ {
15
+ :accesskey => accesskey,
16
+ :class => "btn"
17
+ }
18
+ end
19
+
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,13 @@
1
+ # <form...>
2
+ # <fieldset class="form-actions">
3
+ # <button class="btn" type="reset" value="Reset">
4
+ # <button class="btn" type="submit" value="Create Post">
5
+ # </fieldset>
6
+ # </form>
7
+ module FormtasticBootstrap
8
+ module Actions
9
+ class ButtonAction < Formtastic::Actions::ButtonAction
10
+ include Base
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,13 @@
1
+ # <form...>
2
+ # <fieldset class="form-actions">
3
+ # <input class="btn" type="reset" value="Reset">
4
+ # <input class="btn" type="submit" value="Create Post">
5
+ # </fieldset>
6
+ # </form>
7
+ module FormtasticBootstrap
8
+ module Actions
9
+ class InputAction < Formtastic::Actions::InputAction
10
+ include Base
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,12 @@
1
+ # <form...>
2
+ # <fieldset class="form-actions">
3
+ # <a class="btn" href="">Link</a>
4
+ # </fieldset>
5
+ # </form>
6
+ module FormtasticBootstrap
7
+ module Actions
8
+ class LinkAction < Formtastic::Actions::LinkAction
9
+ include Base
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,10 @@
1
+ module FormtasticBootstrap
2
+ module Actions
3
+ extend ActiveSupport::Autoload
4
+
5
+ autoload :Base, 'formtastic-bootstrap/actions/base'
6
+ autoload :InputAction, 'formtastic-bootstrap/actions/input_action'
7
+ autoload :LinkAction, 'formtastic-bootstrap/actions/link_action'
8
+ autoload :ButtonAction, 'formtastic-bootstrap/actions/button_action'
9
+ end
10
+ end
@@ -29,9 +29,11 @@ module FormtasticBootstrap
29
29
  raise
30
30
  end
31
31
 
32
- include FormtasticBootstrap::Helpers::InputHelper
32
+ include FormtasticBootstrap::Helpers::InputHelper # Revisit
33
33
  include FormtasticBootstrap::Helpers::InputsHelper
34
- include FormtasticBootstrap::Helpers::ButtonsHelper
34
+ include FormtasticBootstrap::Helpers::ActionHelper
35
+ include FormtasticBootstrap::Helpers::ActionsHelper
36
+ # include Formtastic::Helpers::ErrorsHelper
35
37
 
36
38
  end
37
39
 
@@ -0,0 +1,12 @@
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
@@ -0,0 +1,24 @@
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
@@ -10,10 +10,6 @@ module FormtasticBootstrap
10
10
  contents = args.last.is_a?(::Hash) ? '' : args.pop.flatten
11
11
  html_options = args.extract_options!
12
12
 
13
- legend = (html_options[:name] || '').to_s
14
- legend %= parent_child_index(html_options[:parent]) if html_options[:parent]
15
- legend = template.content_tag(:legend, Formtastic::Util.html_safe(legend)) unless legend.blank?
16
-
17
13
  if block_given?
18
14
  contents = if template.respond_to?(:is_haml?) && template.is_haml?
19
15
  template.capture_haml(&block)
@@ -24,6 +20,8 @@ module FormtasticBootstrap
24
20
 
25
21
  # Ruby 1.9: String#to_s behavior changed, need to make an explicit join.
26
22
  contents = contents.join if contents.respond_to?(:join)
23
+
24
+ legend = field_set_legend(html_options)
27
25
  fieldset = template.content_tag(:fieldset,
28
26
  Formtastic::Util.html_safe(legend) << Formtastic::Util.html_safe(contents),
29
27
  html_options.except(:builder, :parent, :name)
@@ -1,7 +1,6 @@
1
1
  module FormtasticBootstrap
2
2
  module Helpers
3
3
  module InputsHelper
4
- include FormtasticBootstrap::Helpers::FieldsetWrapper
5
4
 
6
5
  def inputs(*args, &block)
7
6
  wrap_it = @already_in_an_inputs_block ? true : false
@@ -26,7 +25,6 @@ module FormtasticBootstrap
26
25
  end
27
26
  end
28
27
 
29
- # out = template.content_tag(:li, out, :class => "input") if wrap_it
30
28
  @already_in_an_inputs_block = false
31
29
  out
32
30
  end
@@ -1,16 +1,14 @@
1
- require "formtastic-bootstrap/helpers/buttons_helper"
2
- require "formtastic-bootstrap/helpers/fieldset_wrapper"
3
- require "formtastic-bootstrap/helpers/input_helper"
4
- require "formtastic-bootstrap/helpers/inputs_helper"
5
-
6
1
  module FormtasticBootstrap
7
2
  module Helpers
3
+
4
+ autoload :ActionHelper, 'formtastic-bootstrap/helpers/action_helper'
5
+ autoload :ActionsHelper, 'formtastic-bootstrap/helpers/actions_helper'
8
6
  # autoload :ErrorsHelper, 'formtastic/helpers/errors_helper'
9
- # autoload :FieldsetWrapper, 'formtastic/helpers/fieldset_wrapper'
7
+ autoload :FieldsetWrapper, 'formtastic-bootstrap/helpers/fieldset_wrapper'
10
8
  # autoload :FileColumnDetection, 'formtastic/helpers/file_column_detection'
11
9
  # autoload :FormHelper, 'formtastic/helpers/form_helper'
12
- # autoload :InputHelper, 'formtastic/helpers/input_helper'
13
- # autoload :InputsHelper, 'formtastic/helpers/inputs_helper'
10
+ autoload :InputHelper, 'formtastic-bootstrap/helpers/input_helper'
11
+ autoload :InputsHelper, 'formtastic-bootstrap/helpers/inputs_helper'
14
12
  # autoload :LabelHelper, 'formtastic/helpers/label_helper'
15
13
  # autoload :SemanticFormHelper, 'formtastic/helpers/semantic_form_helper'
16
14
  # autoload :Reflection, 'formtastic/helpers/reflection'
@@ -2,45 +2,16 @@ module FormtasticBootstrap
2
2
  module Inputs
3
3
  module Base
4
4
  module Choices
5
+ include Formtastic::Inputs::Base::Choices
5
6
 
6
- def input_div_wrapping(&block)
7
- template.content_tag(:div, choices_wrapping_html_options) do
8
- [yield, error_html(:block), hint_html(:block)].join("\n").html_safe
7
+ def choice_wrapping_html_options(choice)
8
+ super(choice).tap do |options|
9
+ options[:for] = choice_input_dom_id(choice)
9
10
  end
10
11
  end
11
12
 
12
- def choices_wrapping_html_options
13
- # TODO Call the Formtastic one explicity and append?
14
- { :class => "choices input" }
15
- end
16
-
17
- def choices_group_wrapping(&block)
18
- template.content_tag(:ul,
19
- template.capture(&block),
20
- choices_group_wrapping_html_options
21
- )
22
- end
23
-
24
- def choices_group_wrapping_html_options
25
- { :class => "choices-group inputs-list" }
26
- end
27
-
28
- def choice_label(choice)
29
- "\n".html_safe + template.content_tag(:span) do
30
- # (choice.is_a?(Array) ? choice.first : choice).to_s
31
- (choice.is_a?(Array) ? choice.first : choice).to_s
32
- end
33
- end
34
-
35
- # This is actually a label in Bootstrap.
36
- def legend_html
37
- template.content_tag(:label, label_html_options) do
38
- render_label? ? label_text : "".html_safe
39
- end
40
- end
41
-
42
- def label_html_options
43
- super.merge(:for => nil)
13
+ def choice_label_html_options(choice)
14
+ choice_wrapping_html_options(choice)
44
15
  end
45
16
 
46
17
  end
@@ -0,0 +1,9 @@
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
@@ -0,0 +1,9 @@
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