Permalink
Browse files

Merge pull request #38 from mjbellantoni/v2.0.0-wip

Move v2.0.0-wip into master.
  • Loading branch information...
mjbellantoni committed Sep 5, 2012
2 parents 66f4eb5 + 5daf79c commit 9a0be55ae68d8a584dbeb7e5165e81f8b27abaa1
Showing with 3,022 additions and 2,536 deletions.
  1. +3 −2 Gemfile
  2. +65 −60 Gemfile.lock
  3. +4 −1 README.md
  4. +1 −1 Rakefile
  5. +16 −1 lib/formtastic-bootstrap.rb
  6. +10 −0 lib/formtastic-bootstrap/actions.rb
  7. +22 −0 lib/formtastic-bootstrap/actions/base.rb
  8. +13 −0 lib/formtastic-bootstrap/actions/button_action.rb
  9. +13 −0 lib/formtastic-bootstrap/actions/input_action.rb
  10. +12 −0 lib/formtastic-bootstrap/actions/link_action.rb
  11. +4 −2 lib/formtastic-bootstrap/form_builder.rb
  12. +6 −8 lib/formtastic-bootstrap/helpers.rb
  13. +12 −0 lib/formtastic-bootstrap/helpers/action_helper.rb
  14. +24 −0 lib/formtastic-bootstrap/helpers/actions_helper.rb
  15. +0 −52 lib/formtastic-bootstrap/helpers/buttons_helper.rb
  16. +2 −4 lib/formtastic-bootstrap/helpers/fieldset_wrapper.rb
  17. +0 −2 lib/formtastic-bootstrap/helpers/inputs_helper.rb
  18. +30 −23 lib/formtastic-bootstrap/inputs.rb
  19. +29 −6 lib/formtastic-bootstrap/inputs/base.rb
  20. +6 −35 lib/formtastic-bootstrap/inputs/base/choices.rb
  21. +9 −0 lib/formtastic-bootstrap/inputs/base/collections.rb
  22. +9 −0 lib/formtastic-bootstrap/inputs/base/grouped_collections.rb
  23. +1 −1 lib/formtastic-bootstrap/inputs/base/hints.rb
  24. +14 −3 lib/formtastic-bootstrap/inputs/base/labelling.rb
  25. +9 −0 lib/formtastic-bootstrap/inputs/base/numeric.rb
  26. +4 −5 lib/formtastic-bootstrap/inputs/base/stringish.rb
  27. +38 −18 lib/formtastic-bootstrap/inputs/base/timeish.rb
  28. +22 −34 lib/formtastic-bootstrap/inputs/base/wrapping.rb
  29. +14 −18 lib/formtastic-bootstrap/inputs/boolean_input.rb
  30. +16 −11 lib/formtastic-bootstrap/inputs/check_boxes_input.rb
  31. +3 −9 lib/formtastic-bootstrap/inputs/date_input.rb
  32. +8 −0 lib/formtastic-bootstrap/inputs/date_select_input.rb
  33. +3 −12 lib/formtastic-bootstrap/inputs/datetime_input.rb
  34. +8 −0 lib/formtastic-bootstrap/inputs/datetime_select_input.rb
  35. +1 −1 lib/formtastic-bootstrap/inputs/email_input.rb
  36. +1 −1 lib/formtastic-bootstrap/inputs/file_input.rb
  37. +1 −1 lib/formtastic-bootstrap/inputs/hidden_input.rb
  38. +3 −3 lib/formtastic-bootstrap/inputs/number_input.rb
  39. +1 −1 lib/formtastic-bootstrap/inputs/password_input.rb
  40. +1 −1 lib/formtastic-bootstrap/inputs/phone_input.rb
  41. +28 −14 lib/formtastic-bootstrap/inputs/radio_input.rb
  42. +1 −1 lib/formtastic-bootstrap/inputs/range_input.rb
  43. +1 −1 lib/formtastic-bootstrap/inputs/search_input.rb
  44. +3 −1 lib/formtastic-bootstrap/inputs/select_input.rb
  45. +0 −7 lib/formtastic-bootstrap/inputs/string_input.rb
  46. +1 −1 lib/formtastic-bootstrap/inputs/text_input.rb
  47. +3 −9 lib/formtastic-bootstrap/inputs/time_input.rb
  48. +8 −0 lib/formtastic-bootstrap/inputs/time_select_input.rb
  49. +1 −1 lib/formtastic-bootstrap/inputs/time_zone_input.rb
  50. +1 −1 lib/formtastic-bootstrap/inputs/url_input.rb
  51. +63 −0 spec/actions/button_action_spec.rb
  52. +59 −0 spec/actions/input_action_spec.rb
  53. +92 −0 spec/actions/link_action_spec.rb
  54. +0 −214 spec/builder/errors_spec.rb
  55. +368 −0 spec/helpers/action_helper_spec.rb
  56. +147 −0 spec/helpers/actions_helper_spec.rb
  57. +0 −149 spec/helpers/buttons_helper_spec.rb
  58. +238 −259 spec/helpers/input_helper_spec.rb
  59. +84 −25 spec/helpers/inputs_helper_spec.rb
  60. +108 −75 spec/inputs/boolean_input_spec.rb
  61. +106 −91 spec/inputs/check_boxes_input_spec.rb
  62. +0 −147 spec/inputs/date_input_spec.rb
  63. +164 −0 spec/inputs/date_select_input_spec.rb
  64. +0 −101 spec/inputs/datetime_input_spec.rb
  65. +112 −0 spec/inputs/datetime_select_input_spec.rb
  66. +48 −0 spec/inputs/deprecated_time_date_datetime_inputs_spec.rb
  67. +30 −3 spec/inputs/email_input_spec.rb
  68. +31 −4 spec/inputs/file_input_spec.rb
  69. +63 −32 spec/inputs/hidden_input_spec.rb
  70. +37 −8 spec/inputs/number_input_spec.rb
  71. +30 −3 spec/inputs/password_input_spec.rb
  72. +30 −3 spec/inputs/phone_input_spec.rb
  73. +87 −60 spec/inputs/radio_input_spec.rb
  74. +32 −5 spec/inputs/range_input_spec.rb
  75. +29 −3 spec/inputs/search_input_spec.rb
  76. +164 −107 spec/inputs/select_input_spec.rb
  77. +33 −22 spec/inputs/string_input_spec.rb
  78. +39 −14 spec/inputs/text_input_spec.rb
  79. +0 −206 spec/inputs/time_input_spec.rb
  80. +191 −0 spec/inputs/time_select_input_spec.rb
  81. +17 −19 spec/inputs/time_zone_input_spec.rb
  82. +30 −3 spec/inputs/url_input_spec.rb
  83. +21 −15 spec/spec_helper.rb
  84. +61 −228 spec/support/custom_macros.rb
  85. +0 −6 spec/support/depracation.rb
  86. +23 −0 spec/support/fb_custom_macros.rb
  87. +0 −382 spec/support/formtastic_spec_helper.rb
View
@@ -2,10 +2,11 @@ source "http://rubygems.org"
gemspec
-gem 'formtastic'
+gem 'formtastic', "~> 2.2"
group :development, :test do
- gem "rspec"
+ gem "ammeter"
+ gem "rspec-rails", "~> 2.8.0"
gem "bundler"
gem "jeweler"
gem "rcov", ">= 0"
View
@@ -1,83 +1,86 @@
PATH
remote: .
specs:
- formtastic-bootstrap (1.1.2)
+ formtastic-bootstrap (1.2.0)
formtastic
rails (>= 3.1.0)
GEM
remote: http://rubygems.org/
specs:
- actionmailer (3.1.3)
- actionpack (= 3.1.3)
- mail (~> 2.3.0)
- actionpack (3.1.3)
- activemodel (= 3.1.3)
- activesupport (= 3.1.3)
+ actionmailer (3.2.3)
+ actionpack (= 3.2.3)
+ mail (~> 2.4.4)
+ actionpack (3.2.3)
+ activemodel (= 3.2.3)
+ activesupport (= 3.2.3)
builder (~> 3.0.0)
erubis (~> 2.7.0)
- i18n (~> 0.6)
- rack (~> 1.3.5)
- rack-cache (~> 1.1)
- rack-mount (~> 0.8.2)
+ journey (~> 1.0.1)
+ rack (~> 1.4.0)
+ rack-cache (~> 1.2)
rack-test (~> 0.6.1)
- sprockets (~> 2.0.3)
- activemodel (3.1.3)
- activesupport (= 3.1.3)
+ sprockets (~> 2.1.2)
+ activemodel (3.2.3)
+ activesupport (= 3.2.3)
builder (~> 3.0.0)
- i18n (~> 0.6)
- activerecord (3.1.3)
- activemodel (= 3.1.3)
- activesupport (= 3.1.3)
- arel (~> 2.2.1)
+ activerecord (3.2.3)
+ activemodel (= 3.2.3)
+ activesupport (= 3.2.3)
+ arel (~> 3.0.2)
tzinfo (~> 0.3.29)
- activeresource (3.1.3)
- activemodel (= 3.1.3)
- activesupport (= 3.1.3)
- activesupport (3.1.3)
+ activeresource (3.2.3)
+ activemodel (= 3.2.3)
+ activesupport (= 3.2.3)
+ activesupport (3.2.3)
+ i18n (~> 0.6)
multi_json (~> 1.0)
- arel (2.2.1)
+ ammeter (0.2.4)
+ activesupport (>= 3.0)
+ railties (>= 3.0)
+ rspec (>= 2.2)
+ rspec-rails (>= 2.2)
+ arel (3.0.2)
builder (3.0.0)
diff-lcs (1.1.3)
erubis (2.7.0)
- formtastic (2.0.2)
- rails (~> 3.0)
+ formtastic (2.2.0)
+ actionpack (>= 3.0)
git (1.2.5)
hike (1.2.1)
i18n (0.6.0)
jeweler (1.6.4)
bundler (~> 1.0)
git (>= 1.2.5)
rake
- json (1.6.3)
- mail (2.3.0)
+ journey (1.0.3)
+ json (1.7.3)
+ mail (2.4.4)
i18n (>= 0.4.0)
mime-types (~> 1.16)
treetop (~> 1.4.8)
- mime-types (1.17.2)
- multi_json (1.0.4)
- nokogiri (1.5.0)
+ mime-types (1.18)
+ multi_json (1.3.6)
+ nokogiri (1.5.3)
polyglot (0.3.3)
- rack (1.3.5)
- rack-cache (1.1)
+ rack (1.4.1)
+ rack-cache (1.2)
rack (>= 0.4)
- rack-mount (0.8.3)
- rack (>= 1.0.0)
rack-ssl (1.3.2)
rack
rack-test (0.6.1)
rack (>= 1.0)
- rails (3.1.3)
- actionmailer (= 3.1.3)
- actionpack (= 3.1.3)
- activerecord (= 3.1.3)
- activeresource (= 3.1.3)
- activesupport (= 3.1.3)
+ rails (3.2.3)
+ actionmailer (= 3.2.3)
+ actionpack (= 3.2.3)
+ activerecord (= 3.2.3)
+ activeresource (= 3.2.3)
+ activesupport (= 3.2.3)
bundler (~> 1.0)
- railties (= 3.1.3)
- railties (3.1.3)
- actionpack (= 3.1.3)
- activesupport (= 3.1.3)
+ railties (= 3.2.3)
+ railties (3.2.3)
+ actionpack (= 3.2.3)
+ activesupport (= 3.2.3)
rack-ssl (~> 1.3.2)
rake (>= 0.8.7)
rdoc (~> 3.4)
@@ -86,23 +89,23 @@ GEM
rcov (0.9.11)
rdoc (3.12)
json (~> 1.4)
- rspec (2.7.0)
- rspec-core (~> 2.7.0)
- rspec-expectations (~> 2.7.0)
- rspec-mocks (~> 2.7.0)
- rspec-core (2.7.1)
- rspec-expectations (2.7.0)
+ rspec (2.8.0)
+ rspec-core (~> 2.8.0)
+ rspec-expectations (~> 2.8.0)
+ rspec-mocks (~> 2.8.0)
+ rspec-core (2.8.0)
+ rspec-expectations (2.8.0)
diff-lcs (~> 1.1.2)
- rspec-mocks (2.7.0)
- rspec-rails (2.7.0)
- actionpack (~> 3.0)
- activesupport (~> 3.0)
- railties (~> 3.0)
- rspec (~> 2.7.0)
+ rspec-mocks (2.8.0)
+ rspec-rails (2.8.1)
+ actionpack (>= 3.0)
+ activesupport (>= 3.0)
+ railties (>= 3.0)
+ rspec (~> 2.8.0)
rspec_tag_matchers (1.0.0)
nokogiri (>= 1.4.0)
rspec-rails (>= 1.2.6)
- sprockets (2.0.3)
+ sprockets (2.1.3)
hike (~> 1.2)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
@@ -111,16 +114,18 @@ GEM
treetop (1.4.10)
polyglot
polyglot (>= 0.3.1)
- tzinfo (0.3.31)
+ tzinfo (0.3.33)
PLATFORMS
ruby
DEPENDENCIES
+ ammeter
bundler
- formtastic
+ formtastic (~> 2.2)
formtastic-bootstrap!
jeweler
rcov
rspec
+ rspec-rails (~> 2.8.0)
rspec_tag_matchers
View
@@ -8,7 +8,7 @@ You can follow [FormBoot on twitter](http://twitter.com/FormBoot) for update ann
### Dependencies
-Formtastic Bootstrap has only been tested with Ruby 1.9.2, Rails 3.1, Formtastic 2.0 and Twitter Bootstrap 1.3.
+Formtastic Bootstrap has only been tested with Ruby 1.9.2, Rails 3.2.x, Formtastic 2.2.x and Twitter Bootstrap 2.x.
#### Installation
@@ -39,6 +39,7 @@ Make sure you've already downloaded and installed Formtastic!
## Formtastic vs. Formtastic Bootstrap
+THIS SECTION IS OUT OF DATE.
### Overview
@@ -97,6 +98,8 @@ made to generate the HTML expected by Bootstrap while still generating the rich
### Major Difference in Behavior
+THIS SECTION IS OUT OF DATE
+
* 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.)
* Formtastic Bootstrap puts the <tt>input</tt> label in a different place because it makes Bootstrap behave correctly.
* 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:
View
@@ -38,7 +38,7 @@ end
task :default => :spec
-require 'rake/rdoctask'
+require 'rdoc/task'
Rake::RDocTask.new do |rdoc|
version = File.exist?('VERSION') ? File.read('VERSION') : ""
@@ -1,6 +1,21 @@
require "formtastic"
require "formtastic-bootstrap/engine" if defined?(::Rails) # For tests
require "formtastic-bootstrap/helpers"
-require "formtastic-bootstrap/inputs"
require "formtastic-bootstrap/form_builder"
require "action_view/helpers/text_field_date_helper"
+
+module FormtasticBootstrap
+
+ extend ActiveSupport::Autoload
+
+ # autoload :FormBuilder
+ # autoload :Helpers
+ # autoload :HtmlAttributes
+ # autoload :I18n
+ autoload :Inputs, "formtastic-bootstrap/inputs"
+ autoload :Actions, "formtastic-bootstrap/actions"
+ # autoload :LocalizedString
+ # autoload :Localizer
+ # autoload :Util
+
+end
@@ -0,0 +1,10 @@
+module FormtasticBootstrap
+ module Actions
+ extend ActiveSupport::Autoload
+
+ autoload :Base, 'formtastic-bootstrap/actions/base'
+ autoload :InputAction, 'formtastic-bootstrap/actions/input_action'
+ autoload :LinkAction, 'formtastic-bootstrap/actions/link_action'
+ autoload :ButtonAction, 'formtastic-bootstrap/actions/button_action'
+ end
+end
@@ -0,0 +1,22 @@
+module FormtasticBootstrap
+ module Actions
+ module Base
+
+ # Bootstrap doesn't have wrappers.
+ def wrapper(&block)
+ # TODO Detect if user passed wrapper_html_options and issue
+ # a warning that they're ignored. (See the original in
+ # Formtastic.)
+ template.capture(&block)
+ end
+
+ def default_button_html
+ {
+ :accesskey => accesskey,
+ :class => "btn"
+ }
+ end
+
+ end
+ end
+end
@@ -0,0 +1,13 @@
+# <form...>
+# <fieldset class="form-actions">
+# <button class="btn" type="reset" value="Reset">
+# <button class="btn" type="submit" value="Create Post">
+# </fieldset>
+# </form>
+module FormtasticBootstrap
+ module Actions
+ class ButtonAction < Formtastic::Actions::ButtonAction
+ include Base
+ end
+ end
+end
@@ -0,0 +1,13 @@
+# <form...>
+# <fieldset class="form-actions">
+# <input class="btn" type="reset" value="Reset">
+# <input class="btn" type="submit" value="Create Post">
+# </fieldset>
+# </form>
+module FormtasticBootstrap
+ module Actions
+ class InputAction < Formtastic::Actions::InputAction
+ include Base
+ end
+ end
+end
@@ -0,0 +1,12 @@
+# <form...>
+# <fieldset class="form-actions">
+# <a class="btn" href="">Link</a>
+# </fieldset>
+# </form>
+module FormtasticBootstrap
+ module Actions
+ class LinkAction < Formtastic::Actions::LinkAction
+ include Base
+ end
+ end
+end
@@ -29,9 +29,11 @@ def self.default_hint_class=(hint_class)
raise
end
- include FormtasticBootstrap::Helpers::InputHelper
+ include FormtasticBootstrap::Helpers::InputHelper # Revisit
include FormtasticBootstrap::Helpers::InputsHelper
- include FormtasticBootstrap::Helpers::ButtonsHelper
+ include FormtasticBootstrap::Helpers::ActionHelper
+ include FormtasticBootstrap::Helpers::ActionsHelper
+ # include Formtastic::Helpers::ErrorsHelper
end
@@ -1,16 +1,14 @@
-require "formtastic-bootstrap/helpers/buttons_helper"
-require "formtastic-bootstrap/helpers/fieldset_wrapper"
-require "formtastic-bootstrap/helpers/input_helper"
-require "formtastic-bootstrap/helpers/inputs_helper"
-
module FormtasticBootstrap
module Helpers
+
+ autoload :ActionHelper, 'formtastic-bootstrap/helpers/action_helper'
+ autoload :ActionsHelper, 'formtastic-bootstrap/helpers/actions_helper'
# autoload :ErrorsHelper, 'formtastic/helpers/errors_helper'
- # autoload :FieldsetWrapper, 'formtastic/helpers/fieldset_wrapper'
+ autoload :FieldsetWrapper, 'formtastic-bootstrap/helpers/fieldset_wrapper'
# autoload :FileColumnDetection, 'formtastic/helpers/file_column_detection'
# autoload :FormHelper, 'formtastic/helpers/form_helper'
- # autoload :InputHelper, 'formtastic/helpers/input_helper'
- # autoload :InputsHelper, 'formtastic/helpers/inputs_helper'
+ autoload :InputHelper, 'formtastic-bootstrap/helpers/input_helper'
+ autoload :InputsHelper, 'formtastic-bootstrap/helpers/inputs_helper'
# autoload :LabelHelper, 'formtastic/helpers/label_helper'
# autoload :SemanticFormHelper, 'formtastic/helpers/semantic_form_helper'
# autoload :Reflection, 'formtastic/helpers/reflection'
@@ -0,0 +1,12 @@
+module FormtasticBootstrap
+ module Helpers
+ module ActionHelper
+
+ # :as => :button # => FormtasticBootstrap::Actions::ButtonAction
+ def standard_action_class_name(as)
+ "FormtasticBootstrap::Actions::#{as.to_s.camelize}Action"
+ end
+
+ end
+ end
+end
Oops, something went wrong.

0 comments on commit 9a0be55

Please sign in to comment.