formatted_form 1.1.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (82) hide show
  1. data/Gemfile +7 -0
  2. data/{LICENSE.txt → LICENSE} +1 -1
  3. data/README.md +121 -29
  4. data/Rakefile +29 -10
  5. data/VERSION +1 -1
  6. data/app/assets/javascripts/formatted_form.js +12 -0
  7. data/app/assets/stylesheets/formatted_form.css +0 -0
  8. data/app/views/formatted_form/_check_box.html.erb +1 -0
  9. data/app/views/formatted_form/_date_select.html.erb +1 -0
  10. data/app/views/formatted_form/_datetime_select.html.erb +1 -0
  11. data/app/views/formatted_form/_element.html.erb +1 -0
  12. data/app/views/formatted_form/_email_field.html.erb +1 -0
  13. data/app/views/formatted_form/_file_field.html.erb +1 -0
  14. data/app/views/formatted_form/_number_field.html.erb +1 -0
  15. data/app/views/formatted_form/_password_field.html.erb +1 -0
  16. data/app/views/formatted_form/_phone_field.html.erb +1 -0
  17. data/app/views/formatted_form/_radio_button.html.erb +1 -0
  18. data/app/views/formatted_form/_range_field.html.erb +1 -0
  19. data/app/views/formatted_form/_search_field.html.erb +1 -0
  20. data/app/views/formatted_form/_select.html.erb +1 -0
  21. data/app/views/formatted_form/_submit.html.erb +1 -0
  22. data/app/views/formatted_form/_telephone_field.html.erb +1 -0
  23. data/app/views/formatted_form/_text_area.html.erb +1 -0
  24. data/app/views/formatted_form/_text_field.html.erb +1 -0
  25. data/app/views/formatted_form/_time_select.html.erb +1 -0
  26. data/app/views/formatted_form/_time_zone_select.html.erb +1 -0
  27. data/app/views/formatted_form/templates/_choices.html.erb +35 -0
  28. data/app/views/formatted_form/templates/_field.html.erb +34 -0
  29. data/formatted_form.gemspec +76 -26
  30. data/lib/formatted_form/engine.rb +6 -11
  31. data/lib/formatted_form/form_builder.rb +125 -0
  32. data/lib/formatted_form/view_helper.rb +49 -0
  33. data/lib/formatted_form.rb +3 -20
  34. data/test/dummy/README.rdoc +261 -0
  35. data/test/dummy/Rakefile +7 -0
  36. data/test/dummy/app/assets/javascripts/application.js +15 -0
  37. data/test/dummy/app/assets/stylesheets/application.css +13 -0
  38. data/test/dummy/app/controllers/application_controller.rb +3 -0
  39. data/test/dummy/app/helpers/application_helper.rb +2 -0
  40. data/test/dummy/app/mailers/.gitkeep +0 -0
  41. data/test/dummy/app/models/.gitkeep +0 -0
  42. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  43. data/test/dummy/config/application.rb +65 -0
  44. data/test/dummy/config/boot.rb +10 -0
  45. data/test/dummy/config/environment.rb +5 -0
  46. data/test/dummy/config/environments/development.rb +31 -0
  47. data/test/dummy/config/environments/production.rb +64 -0
  48. data/test/dummy/config/environments/test.rb +35 -0
  49. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  50. data/test/dummy/config/initializers/inflections.rb +15 -0
  51. data/test/dummy/config/initializers/mime_types.rb +5 -0
  52. data/test/dummy/config/initializers/secret_token.rb +7 -0
  53. data/test/dummy/config/initializers/session_store.rb +8 -0
  54. data/test/dummy/config/initializers/wrap_parameters.rb +10 -0
  55. data/test/dummy/config/locales/en.yml +5 -0
  56. data/test/dummy/config/routes.rb +58 -0
  57. data/test/dummy/config.ru +4 -0
  58. data/test/dummy/lib/assets/.gitkeep +0 -0
  59. data/test/dummy/log/.gitkeep +0 -0
  60. data/test/dummy/public/404.html +26 -0
  61. data/test/dummy/public/422.html +26 -0
  62. data/test/dummy/public/500.html +25 -0
  63. data/test/dummy/public/favicon.ico +0 -0
  64. data/test/dummy/script/rails +6 -0
  65. data/test/form_builder_test.rb +391 -0
  66. data/test/test_helper.rb +47 -0
  67. metadata +105 -25
  68. data/app/views/formatted_form/_check_box.html.haml +0 -14
  69. data/app/views/formatted_form/_default_field.html.haml +0 -17
  70. data/app/views/formatted_form/_radio_button.html.haml +0 -17
  71. data/app/views/formatted_form/_submit.html.haml +0 -3
  72. data/app/views/twitter_bootstrap/_check_box.html.haml +0 -18
  73. data/app/views/twitter_bootstrap/_default_field.html.haml +0 -10
  74. data/app/views/twitter_bootstrap/_radio_button.html.haml +0 -24
  75. data/app/views/twitter_bootstrap/_submit.html.haml +0 -3
  76. data/lib/formatted_form/builder.rb +0 -178
  77. data/lib/formatted_form/configuration.rb +0 -16
  78. data/lib/formatted_form/helper.rb +0 -10
  79. data/lib/generators/formatted_form/javascripts/javascripts_generator.rb +0 -11
  80. data/lib/generators/formatted_form/stylesheets/stylesheets_generator.rb +0 -11
  81. data/templates/javascripts/formatted_form.js +0 -17
  82. data/templates/stylesheets/formatted_form.sass +0 -121
data/Gemfile ADDED
@@ -0,0 +1,7 @@
1
+ source 'http://rubygems.org'
2
+
3
+ gem 'rails', '>=3.1.0'
4
+
5
+ group :development do
6
+ gem 'jeweler'
7
+ end
@@ -1,4 +1,4 @@
1
- Copyright (c) 2011 Jack Neto
1
+ Copyright (c) 2012 Jack Neto, The Working Group
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -1,46 +1,138 @@
1
- # Formatted Form
2
- Author: [The Working Group](http://www.theworkinggroup.ca)
1
+ # Formatted Form [![Build Status](https://secure.travis-ci.org/twg/formatted_form.png)](http://travis-ci.org/twg/formatted_form)
3
2
 
4
- ---
3
+ A Rails form builder that generates [Twitter Bootstrap](http://twitter.github.com/bootstrap) markup and helps keep your code clean.
5
4
 
6
- ## What is it?
5
+ * Uses existing Rails helpers
6
+ * Auto-generates labels
7
+ * Generates horizontal, vertical and inline forms
8
+ * Groups of checkboxes
9
+ * Groups of radio buttons
10
+ * Prevents double clicking on submit buttons
7
11
 
8
- A Rails form builder to simplify your forms and keep your views clean.
9
-
10
-
11
- ## Install
12
+ ## Installation
12
13
 
13
- ### 1. Add the gem definition to your Gemfile:
14
-
15
- config.gem 'form_builder'
16
-
17
- ### 2. From within your Rails project run:
14
+ Add gem definition to your Gemfile and run `bundle install`:
18
15
 
19
- bundle install
16
+ ``` ruby
17
+ gem 'formatted_form'
18
+ ```
20
19
 
21
- ### 3. Generate the javascript file
20
+ Require it in your CSS and JS manifest files:
22
21
 
23
- rails g formatted_form:javascripts
22
+ ``` css
23
+ //= require formatted_form
24
+ ```
24
25
 
25
- This will create `public/javascripts/formatted_form.js` and you should load it using:
26
-
27
- javascript_include_tag 'formatted_form'
26
+ ## Usage (with haml)
28
27
 
29
- ### 4. (Optionaly) generate the stylesshet (SASS) file
28
+ Use `formatted_form_for` when you want to render a form with Bootstrap markup.
30
29
 
31
- rails g formatted_form:stylesheets
30
+ ### A sample user form
32
31
 
33
- This will create `app/views/stylesheets/formatted_form.sass` and you can move it to wherever you keep your SASS files and load it using:
32
+ ``` ruby
33
+ = formatted_form_for [:admin, @user] do |f|
34
+ = f.text_field :name
35
+ = f.number_field :age, nil, :in => 1...100
36
+ = f.email_field :email, :prepend => '@'
37
+ = f.phone_field :phone
38
+ = f.password_field :password
39
+ = f.password_field :password_confirmation
40
+ = f.select :role, User::ROLES
41
+ = f.time_zone_select :time_zone
42
+ = f.check_box :reminder, :label => 'Send Daily Reminder?'
43
+ = f.submit 'Save'
44
+ ```
34
45
 
35
- stylesheet_link_tag 'formatted_form'
46
+ ### A login form
36
47
 
48
+ Add a class to the form or any field to change the way it is rendered.
37
49
 
50
+ ``` ruby
51
+ = formatted_form_for @session_user, :url => login_path, :class => 'form-horizontal' do |f|
52
+ = f.text_field :email
53
+ = f.password_field :password
54
+ = f.check_box :remember_me, :label => 'Remember me when I come back'
55
+ = f.submit 'Log In'
56
+ ```
38
57
 
39
- ## Usage (with haml)
58
+ ### A search form
59
+
60
+ Hide the label by passing `:label => ''` on any field. (Useful for inline search forms)
40
61
 
41
- = formatted_form_for @session_user, :url => login_path do |f|
42
- = f.text_field :email, :label => 'Email address'
43
- = f.password_field :password
44
- = f.check_box :remember_me, :label => 'Remember me when I come back'
45
- = f.submit 'Log In', :change_to_text => 'Logging you in ...', :image => true
62
+
63
+ ``` ruby
64
+ = formatted_form_for @search, :url => [:admin, :users], :html => {:method => :get, :class => 'form-search'} do |f|
65
+ = f.text_field :name_equals, :label => 'Find by', :placeholder => 'Name'
66
+ = f.select :role_equals, User::ROLES, :label => ''
67
+ = f.submit 'Search', :class => 'btn-default'
68
+ ```
69
+
70
+ *(Example using [MetaSearch](https://github.com/ernie/meta_search) helpers)*
71
+
72
+ ### Checkboxes
73
+
74
+ A single checkbox:
75
+
76
+ ``` ruby
77
+ = f.check_box :send_reminder
78
+ ```
79
+
80
+ A group of checkboxes:
46
81
 
82
+ ``` ruby
83
+ = f.check_box :colours, :values => [['Red', 1], ['Green', 2], ['Blue', 3]]
84
+ ```
85
+
86
+ Use the :help_block option to show the label on the right side:
87
+
88
+ ``` ruby
89
+ = f.check_box :approved, :help_block => 'Label on the Right'
90
+ ```
91
+
92
+
93
+ ### Radio buttons
94
+
95
+ A single radio button:
96
+
97
+ ``` ruby
98
+ = f.check_box :role, 'admin'
99
+ ```
100
+
101
+ A group of radio buttons:
102
+
103
+ ``` ruby
104
+ = f.radio_button :role, [['Admin', 1], ['Manager', 2], ['Editor', 3]]
105
+ ```
106
+
107
+ ### Submit
108
+ If you add 'formatted_builder' to your Javascript manifest you'll be able to add an extra `data-loading-text` option to submit buttons. This will prevent accidental multiple form submits.
109
+
110
+ ``` ruby
111
+ = f.submit 'Log In', :data => {:loading_text => 'Saving ...'}
112
+ ```
113
+
114
+ ### More examples
115
+
116
+ Override the autogenerated label by using the `:label` option on any element.
117
+
118
+ ``` ruby
119
+ = f.text_field :name, :label => 'Full name'
120
+ ```
121
+
122
+ Use `:append` and `:prepend` on any field:
123
+
124
+ ``` ruby
125
+ = f.text_field :price, :append => '.00'
126
+ = f.email_field :email, :prepend => '@'
127
+ ```
128
+
129
+ Use `:help_block` to provide extra description to a fields:
130
+
131
+ ``` ruby
132
+ = f.email_field :email, :help_block => 'Please enter your emails address'
133
+ ```
134
+
135
+ ---
136
+
137
+ Copyright 2012 Jack Neto, Oleg Khabarov, [The Working Group, Inc](http://twg.ca)
138
+
data/Rakefile CHANGED
@@ -1,14 +1,33 @@
1
+ begin
2
+ require 'bundler/setup'
3
+ rescue LoadError
4
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
+ end
6
+
1
7
  require 'rubygems'
2
8
  require 'rake'
3
- require 'jeweler'
4
9
 
5
- Jeweler::Tasks.new do |gem|
6
- gem.name = "formatted_form"
7
- gem.homepage = "http://github.com/twg/formatted_form"
8
- gem.license = "MIT"
9
- gem.summary = "A Rails form builder to simplify your forms"
10
- gem.description = ''
11
- gem.email = "jack@theworkinggroup.ca"
12
- gem.authors = ["Jack Neto"]
10
+ begin
11
+ require 'jeweler'
12
+ Jeweler::Tasks.new do |gem|
13
+ gem.name = "formatted_form"
14
+ gem.homepage = "http://github.com/twg/formatted_form"
15
+ gem.license = "MIT"
16
+ gem.summary = "A Rails form builder that generates Twitter Bootstrap markup and helps keep your code clean"
17
+ gem.description = ''
18
+ gem.email = "jack@twg.ca"
19
+ gem.authors = ["Jack Neto", 'Oleg Khabarov', 'The Working Group Inc.']
20
+ end
21
+ Jeweler::RubygemsDotOrgTasks.new
22
+ rescue LoadError
23
+ puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
24
+ end
25
+
26
+ require 'rake/testtask'
27
+ Rake::TestTask.new(:test) do |t|
28
+ t.libs << 'lib'
29
+ t.libs << 'test'
30
+ t.pattern = 'test/**/*_test.rb'
31
+ t.verbose = false
13
32
  end
14
- Jeweler::RubygemsDotOrgTasks.new
33
+ task :default => :test
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.1.0
1
+ 2.0.0
@@ -0,0 +1,12 @@
1
+ // Reset the state of the submit button
2
+ $(document).ready(function() {
3
+
4
+ $('input[type=submit][data-loading-text]').each(function(i, button){
5
+ $(button).button('reset');
6
+ });
7
+
8
+ $('form').on('submit', function(event){
9
+ $('input[type=submit][data-loading-text]', event.target).button('loading');
10
+ });
11
+
12
+ });
File without changes
@@ -0,0 +1 @@
1
+ <%= render :partial => 'formatted_form/templates/choices', :locals => {:options => options} %>
@@ -0,0 +1 @@
1
+ <%= render :partial => 'formatted_form/templates/field', :locals => {:options => options} %>
@@ -0,0 +1 @@
1
+ <%= render :partial => 'formatted_form/templates/field', :locals => {:options => options} %>
@@ -0,0 +1 @@
1
+ <%= render :partial => 'formatted_form/templates/field', :locals => {:options => options} %>
@@ -0,0 +1 @@
1
+ <%= render :partial => 'formatted_form/templates/field', :locals => {:options => options} %>
@@ -0,0 +1 @@
1
+ <%= render :partial => 'formatted_form/templates/field', :locals => {:options => options} %>
@@ -0,0 +1 @@
1
+ <%= render :partial => 'formatted_form/templates/field', :locals => {:options => options} %>
@@ -0,0 +1 @@
1
+ <%= render :partial => 'formatted_form/templates/field', :locals => {:options => options} %>
@@ -0,0 +1 @@
1
+ <%= render :partial => 'formatted_form/templates/field', :locals => {:options => options} %>
@@ -0,0 +1 @@
1
+ <%= render :partial => 'formatted_form/templates/choices', :locals => {:options => options} %>
@@ -0,0 +1 @@
1
+ <%= render :partial => 'formatted_form/templates/field', :locals => {:options => options} %>
@@ -0,0 +1 @@
1
+ <%= render :partial => 'formatted_form/templates/field', :locals => {:options => options} %>
@@ -0,0 +1 @@
1
+ <%= render :partial => 'formatted_form/templates/field', :locals => {:options => options} %>
@@ -0,0 +1 @@
1
+ <%= options[:content] %>
@@ -0,0 +1 @@
1
+ <%= render :partial => 'formatted_form/templates/field', :locals => {:options => options} %>
@@ -0,0 +1 @@
1
+ <%= render :partial => 'formatted_form/templates/field', :locals => {:options => options} %>
@@ -0,0 +1 @@
1
+ <%= render :partial => 'formatted_form/templates/field', :locals => {:options => options} %>
@@ -0,0 +1 @@
1
+ <%= render :partial => 'formatted_form/templates/field', :locals => {:options => options} %>
@@ -0,0 +1 @@
1
+ <%= render :partial => 'formatted_form/templates/field', :locals => {:options => options} %>
@@ -0,0 +1,35 @@
1
+ <%
2
+ control_group_class = 'control-group'
3
+ control_group_class << " cg-#{options[:method].to_s.dasherize}" if options[:method]
4
+ control_group_class << ' error' if options[:errors]
5
+ %>
6
+
7
+ <%= content_tag(:div, :class => control_group_class) do %>
8
+
9
+ <% unless options[:label] == '' %>
10
+ <%= content_tag(:div, :class => 'control-label') do %>
11
+ <% if options[:choices].size == 1 %>
12
+ <%= options[:builder].label(options[:method], options[:label]) %>
13
+ <% else %>
14
+ <%= options[:label] || options[:method].to_s.humanize %>
15
+ <% end %>
16
+ <% end %>
17
+ <% end %>
18
+
19
+ <%= content_tag(:div, :class => 'controls') do %>
20
+ <% options[:choices].each do |field, label, inline| %>
21
+ <% if options[:choices].size == 1 %>
22
+ <%= field %>
23
+ <% else%>
24
+ <% label_class = options[:field_name].to_s.gsub(/(_button$|_)/, '') %>
25
+ <% label_class << ' inline' if inline %>
26
+ <%= content_tag(:label, :class => label_class) do %>
27
+ <%= field %><%= label %>
28
+ <% end %>
29
+ <% end %>
30
+ <% end %>
31
+ <%= content_tag(:span, options[:errors], :class => 'help-inline') if options[:errors] %>
32
+ <%= content_tag(:span, options[:help_block], :class => 'help-block') if options[:help_block] %>
33
+ <% end %>
34
+
35
+ <% end %>
@@ -0,0 +1,34 @@
1
+ <%
2
+ inline_form = [:inline, :search].member?(options[:builder].options[:type])
3
+
4
+ control_group_class = 'control-group'
5
+ control_group_class << " cg-#{options[:method].to_s.dasherize}" if options[:method]
6
+ control_group_class << ' error' if options[:errors]
7
+
8
+ if ([:prepend, :append, :prepend_html, :append_html] & options.keys).present?
9
+ wrapper_class = "#{wrapper_class} input-prepend".strip if options[:prepend] || options[:prepend_html]
10
+ wrapper_class = "#{wrapper_class} input-append".strip if options[:append] || options[:append_html]
11
+ end
12
+ %>
13
+
14
+ <%= content_tag_unless(inline_form, :div, :class => control_group_class) do %>
15
+
16
+ <% unless ['', false].include?(options[:label]) %>
17
+ <%= options[:builder].label(options[:method], options[:label], :class => 'control-label') %>
18
+ <% end %>
19
+
20
+ <%= content_tag_unless(inline_form, :div, :class => 'controls') do %>
21
+
22
+ <%= content_tag_if(wrapper_class, :div, :class => wrapper_class) do %>
23
+ <%= options[:prepend_html].html_safe if options[:prepend_html] %>
24
+ <%= content_tag(:span, options[:prepend], :class => 'add-on') if options[:prepend] %>
25
+ <%= options[:content] %>
26
+ <%= content_tag(:span, options[:append], :class => 'add-on') if options[:append] %>
27
+ <%= options[:append_html].html_safe if options[:append_html] %>
28
+ <% end %>
29
+
30
+ <%= content_tag(:span, options[:errors], :class => 'help-inline') if options[:errors] %>
31
+ <%= content_tag(:span, options[:help_block], :class => 'help-block') if options[:help_block] %>
32
+ <% end %>
33
+
34
+ <% end %>
@@ -4,55 +4,105 @@
4
4
  # -*- encoding: utf-8 -*-
5
5
 
6
6
  Gem::Specification.new do |s|
7
- s.name = %q{formatted_form}
8
- s.version = "1.1.0"
7
+ s.name = "formatted_form"
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
- s.authors = ["Jack Neto"]
12
- s.date = %q{2011-10-16}
13
- s.description = %q{}
14
- s.email = %q{jack@theworkinggroup.ca}
11
+ s.authors = ["Jack Neto", "Oleg Khabarov", "The Working Group Inc."]
12
+ s.date = "2012-12-03"
13
+ s.description = ""
14
+ s.email = "jack@twg.ca"
15
15
  s.extra_rdoc_files = [
16
- "LICENSE.txt",
16
+ "LICENSE",
17
17
  "README.md"
18
18
  ]
19
19
  s.files = [
20
- "LICENSE.txt",
20
+ "Gemfile",
21
+ "LICENSE",
21
22
  "README.md",
22
23
  "Rakefile",
23
24
  "VERSION",
24
- "app/views/formatted_form/_check_box.html.haml",
25
- "app/views/formatted_form/_default_field.html.haml",
26
- "app/views/formatted_form/_radio_button.html.haml",
27
- "app/views/formatted_form/_submit.html.haml",
28
- "app/views/twitter_bootstrap/_check_box.html.haml",
29
- "app/views/twitter_bootstrap/_default_field.html.haml",
30
- "app/views/twitter_bootstrap/_radio_button.html.haml",
31
- "app/views/twitter_bootstrap/_submit.html.haml",
25
+ "app/assets/javascripts/formatted_form.js",
26
+ "app/assets/stylesheets/formatted_form.css",
27
+ "app/views/formatted_form/_check_box.html.erb",
28
+ "app/views/formatted_form/_date_select.html.erb",
29
+ "app/views/formatted_form/_datetime_select.html.erb",
30
+ "app/views/formatted_form/_element.html.erb",
31
+ "app/views/formatted_form/_email_field.html.erb",
32
+ "app/views/formatted_form/_file_field.html.erb",
33
+ "app/views/formatted_form/_number_field.html.erb",
34
+ "app/views/formatted_form/_password_field.html.erb",
35
+ "app/views/formatted_form/_phone_field.html.erb",
36
+ "app/views/formatted_form/_radio_button.html.erb",
37
+ "app/views/formatted_form/_range_field.html.erb",
38
+ "app/views/formatted_form/_search_field.html.erb",
39
+ "app/views/formatted_form/_select.html.erb",
40
+ "app/views/formatted_form/_submit.html.erb",
41
+ "app/views/formatted_form/_telephone_field.html.erb",
42
+ "app/views/formatted_form/_text_area.html.erb",
43
+ "app/views/formatted_form/_text_field.html.erb",
44
+ "app/views/formatted_form/_time_select.html.erb",
45
+ "app/views/formatted_form/_time_zone_select.html.erb",
46
+ "app/views/formatted_form/templates/_choices.html.erb",
47
+ "app/views/formatted_form/templates/_field.html.erb",
32
48
  "formatted_form.gemspec",
33
49
  "lib/formatted_form.rb",
34
- "lib/formatted_form/builder.rb",
35
- "lib/formatted_form/configuration.rb",
36
50
  "lib/formatted_form/engine.rb",
37
- "lib/formatted_form/helper.rb",
38
- "lib/generators/formatted_form/javascripts/javascripts_generator.rb",
39
- "lib/generators/formatted_form/stylesheets/stylesheets_generator.rb",
40
- "templates/javascripts/formatted_form.js",
41
- "templates/stylesheets/formatted_form.sass"
51
+ "lib/formatted_form/form_builder.rb",
52
+ "lib/formatted_form/view_helper.rb",
53
+ "test/dummy/README.rdoc",
54
+ "test/dummy/Rakefile",
55
+ "test/dummy/app/assets/javascripts/application.js",
56
+ "test/dummy/app/assets/stylesheets/application.css",
57
+ "test/dummy/app/controllers/application_controller.rb",
58
+ "test/dummy/app/helpers/application_helper.rb",
59
+ "test/dummy/app/mailers/.gitkeep",
60
+ "test/dummy/app/models/.gitkeep",
61
+ "test/dummy/app/views/layouts/application.html.erb",
62
+ "test/dummy/config.ru",
63
+ "test/dummy/config/application.rb",
64
+ "test/dummy/config/boot.rb",
65
+ "test/dummy/config/environment.rb",
66
+ "test/dummy/config/environments/development.rb",
67
+ "test/dummy/config/environments/production.rb",
68
+ "test/dummy/config/environments/test.rb",
69
+ "test/dummy/config/initializers/backtrace_silencers.rb",
70
+ "test/dummy/config/initializers/inflections.rb",
71
+ "test/dummy/config/initializers/mime_types.rb",
72
+ "test/dummy/config/initializers/secret_token.rb",
73
+ "test/dummy/config/initializers/session_store.rb",
74
+ "test/dummy/config/initializers/wrap_parameters.rb",
75
+ "test/dummy/config/locales/en.yml",
76
+ "test/dummy/config/routes.rb",
77
+ "test/dummy/lib/assets/.gitkeep",
78
+ "test/dummy/log/.gitkeep",
79
+ "test/dummy/public/404.html",
80
+ "test/dummy/public/422.html",
81
+ "test/dummy/public/500.html",
82
+ "test/dummy/public/favicon.ico",
83
+ "test/dummy/script/rails",
84
+ "test/form_builder_test.rb",
85
+ "test/test_helper.rb"
42
86
  ]
43
- s.homepage = %q{http://github.com/twg/formatted_form}
87
+ s.homepage = "http://github.com/twg/formatted_form"
44
88
  s.licenses = ["MIT"]
45
89
  s.require_paths = ["lib"]
46
- s.rubygems_version = %q{1.6.2}
47
- s.summary = %q{A Rails form builder to simplify your forms}
90
+ s.rubygems_version = "1.8.23"
91
+ s.summary = "A Rails form builder that generates Twitter Bootstrap markup and helps keep your code clean"
48
92
 
49
93
  if s.respond_to? :specification_version then
50
94
  s.specification_version = 3
51
95
 
52
96
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
97
+ s.add_runtime_dependency(%q<rails>, [">= 3.1.0"])
98
+ s.add_development_dependency(%q<jeweler>, [">= 0"])
53
99
  else
100
+ s.add_dependency(%q<rails>, [">= 3.1.0"])
101
+ s.add_dependency(%q<jeweler>, [">= 0"])
54
102
  end
55
103
  else
104
+ s.add_dependency(%q<rails>, [">= 3.1.0"])
105
+ s.add_dependency(%q<jeweler>, [">= 0"])
56
106
  end
57
107
  end
58
108
 
@@ -1,17 +1,12 @@
1
- require "formatted_form"
2
- require "rails"
1
+ require 'rails'
2
+ require 'formatted_form'
3
3
 
4
4
  module FormattedForm
5
5
  class Engine < Rails::Engine
6
-
7
- initializer 'formatted_form_helper' do |app|
8
- ActionView::Base.send(:include, FormattedForm::Helper)
9
-
10
- # Removing field_with_errors div araound elemetns with errors
11
- if FormattedForm.config.template == :twitter_bootstrap
12
- ActionView::Base.field_error_proc = proc { |input, instance| input }
13
- end
6
+ initializer 'helper' do |app|
7
+ ActionView::Base.send(:include, FormattedForm::ViewHelper)
8
+ # Remove field_with_errors div around elements with errors
9
+ ActionView::Base.field_error_proc = proc { |input, instance| input }
14
10
  end
15
-
16
11
  end
17
12
  end