bootstrap-form 0.0.8 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: b7ffd8809005417c3cbef505e3283572f37dd566
4
+ data.tar.gz: f3e582b3e5c67de249325d16b6e47608113a6cab
5
+ SHA512:
6
+ metadata.gz: be9ceec1e7f83257db098b2a2379cab03bf2a0204c5e740a3658f9291de4bf0d6c0d65e1ea98c773cf2bc2bb52fbd37dac1334258e1180a941de1b399c41d0f1
7
+ data.tar.gz: 50adcf7462bf78b2828be3859680c7d312920cdda8978f5ee3de59a3b4d1124e04c50d6c11c2b6cbf737896abc8d8bf39e0602bb2b697b12b6f80a97856e27d7
@@ -0,0 +1,3 @@
1
+ rvm:
2
+ - 1.8.7
3
+ - 1.9.2
data/README.md CHANGED
@@ -4,6 +4,8 @@ Form Helpers to make your form inputs [look like this](http://twitter.github.com
4
4
 
5
5
  Helps you to create beautiful mocks really quickly.
6
6
 
7
+ Works with Bootstrap 2.3.0 and Rails 3.2+ (including Rails 4)
8
+
7
9
  ## Usage
8
10
 
9
11
  Add the gem to your Gemfile
@@ -30,10 +32,10 @@ You write this:
30
32
 
31
33
  You get something like this:
32
34
 
33
- <div class="clearfix">
34
- <label for="account_name">Name</label>
35
- <div class="input">
36
- <input class="xlarge" id="account_name" name="account_name" size="30" type="text">
35
+ <div class="control-group">
36
+ <label class="control-label" for="account_name">Name</label>
37
+ <div class="controls">
38
+ <input id="account_name" name="account_name" size="30" type="text">
37
39
  </div>
38
40
  </div>
39
41
 
@@ -50,10 +52,10 @@ option:
50
52
 
51
53
  Then, you get something like this:
52
54
 
53
- <div class="clearfix">
54
- <label for="account_name">A custom label</label>
55
- <div class="input">
56
- <input class="xlarge" id="account_name" name="account_name" size="30" type="text">
55
+ <div class="control-group">
56
+ <label class="control-label" for="account_name">A custom label</label>
57
+ <div class="controls">
58
+ <input id="account_name" name="account_name" size="30" type="text">
57
59
  </div>
58
60
  </div>
59
61
 
@@ -69,7 +71,7 @@ Then, you get something like this:
69
71
 
70
72
  ## Error handling
71
73
 
72
- All fields will automatically add the classes to show errors with the Twitter
74
+ All fields will automatically add the classes to show errors with Twitter
73
75
  bootstrap styles.
74
76
 
75
77
  ## TODO
@@ -19,8 +19,8 @@ Gem::Specification.new do |s|
19
19
  s.require_paths = ["lib"]
20
20
 
21
21
 
22
- s.add_dependency 'railties', '~> 3.0'
23
- s.add_dependency 'actionpack', '~> 3.0'
22
+ s.add_dependency 'railties', '>= 3.2'
23
+ s.add_dependency 'actionpack', '>= 3.2'
24
24
 
25
25
  s.add_development_dependency "minitest"
26
26
  s.add_development_dependency "rr"
@@ -5,41 +5,41 @@ module ActionView
5
5
  BOOTSTRAP_OPTIONS = [:label, :hint].freeze
6
6
 
7
7
  def bootstrap_text_field(object_name, method, options={})
8
- bootstrap_clearfix_wrap(object_name, method, text_field(object_name, method, extract_input_options(options)), options)
8
+ bootstrap_control_group_wrap(object_name, method, text_field(object_name, method, extract_input_options(options)), options)
9
9
  end
10
10
 
11
11
  def bootstrap_email_field(object_name, method, options={})
12
- bootstrap_clearfix_wrap(object_name, method, email_field(object_name, method, extract_input_options(options)), options)
12
+ bootstrap_control_group_wrap(object_name, method, email_field(object_name, method, extract_input_options(options)), options)
13
13
  end
14
14
 
15
15
  def bootstrap_password_field(object_name, method, options={})
16
- bootstrap_clearfix_wrap(object_name, method, password_field(object_name, method, extract_input_options(options)), options)
16
+ bootstrap_control_group_wrap(object_name, method, password_field(object_name, method, extract_input_options(options)), options)
17
17
  end
18
18
 
19
19
  def bootstrap_collection_select(object_name, method, collection, value_method, text_method, options = {}, html_options = {})
20
- bootstrap_clearfix_wrap(object_name, method, collection_select(object_name, method, collection, value_method, text_method, extract_input_options(options), html_options), options)
20
+ bootstrap_control_group_wrap(object_name, method, collection_select(object_name, method, collection, value_method, text_method, extract_input_options(options), html_options), options)
21
21
  end
22
22
 
23
23
  def bootstrap_select(object_name, method, choices, options, html_options)
24
- bootstrap_clearfix_wrap(object_name, method, select(object_name, method, choices, extract_input_options(options), html_options), options)
24
+ bootstrap_control_group_wrap(object_name, method, select(object_name, method, choices, extract_input_options(options), html_options), options)
25
25
  end
26
26
 
27
27
  def bootstrap_file_field(object_name, method, options={})
28
- bootstrap_clearfix_wrap(object_name, method, file_field(object_name, method, extract_input_options(options)), options)
28
+ bootstrap_control_group_wrap(object_name, method, file_field(object_name, method, extract_input_options(options)), options)
29
29
  end
30
30
 
31
31
  def bootstrap_text_area(object_name, method, options={})
32
- bootstrap_clearfix_wrap(object_name, method, text_area(object_name, method, extract_input_options(options)), options)
32
+ bootstrap_control_group_wrap(object_name, method, text_area(object_name, method, extract_input_options(options)), options)
33
33
  end
34
34
 
35
- def bootstrap_clearfix_wrap(object_name, method, content, options={})
35
+ def bootstrap_control_group_wrap(object_name, method, content, options={})
36
36
  error_messages = options[:object].errors[method]
37
- clearfix_tag = error_messages.blank? ? 'clearfix' : 'clearfix error'
38
- inline_help = inline_help_tag(error_messages.presence || options[:hint])
37
+ control_group_tag = error_messages.blank? ? 'control-group' : 'control-group error'
38
+ inline_help = inline_help_tag(error_messages.presence || options[:hint])
39
39
 
40
- content_tag(:div, label(object_name, method, options[:label]) +
41
- content_tag(:div, content + inline_help, :class => 'input'),
42
- :class => clearfix_tag)
40
+ content_tag(:div, label(object_name, method, options[:label], :class => 'control-label') +
41
+ content_tag(:div, content + inline_help, :class => 'controls'),
42
+ :class => control_group_tag)
43
43
  end
44
44
 
45
45
  def inline_help_tag(messages)
@@ -1,5 +1,5 @@
1
1
  module Bootstrap
2
2
  module Form
3
- VERSION = "0.0.8"
3
+ VERSION = "1.0.0"
4
4
  end
5
5
  end
@@ -1,7 +1,7 @@
1
1
  require 'test_helper'
2
2
 
3
3
  class FormHelperTest < ActionView::TestCase
4
- def test_bootstrap_clearfix_wrap
4
+ def test_bootstrap_control_group_wrap
5
5
  object = mock
6
6
  errors = { :name => [] }
7
7
  options = { :object => object }
@@ -9,11 +9,11 @@ class FormHelperTest < ActionView::TestCase
9
9
  stub(object).errors { errors }
10
10
  stub(object).name { 'Object Name' }
11
11
 
12
- expected_code = %{<div class="clearfix"><label for="post_name">Name</label><div class="input">content</div></div>}
13
- assert_equal expected_code, bootstrap_clearfix_wrap(:post, :name, content, options)
12
+ expected_code = %{<div class="control-group"><label class="control-label" for="post_name">Name</label><div class="controls">content</div></div>}
13
+ assert_equal expected_code, bootstrap_control_group_wrap(:post, :name, content, options)
14
14
  end
15
15
 
16
- def test_bootstrap_clearfix_wrap_with_label
16
+ def test_bootstrap_control_group_wrap_with_label
17
17
  object = mock
18
18
  errors = { :name => [] }
19
19
  options = { :object => object, :label => "Custom" }
@@ -21,11 +21,11 @@ class FormHelperTest < ActionView::TestCase
21
21
  stub(object).errors { errors }
22
22
  stub(object).name { 'Object Name' }
23
23
 
24
- expected_code = %{<div class="clearfix"><label for="post_name">Custom</label><div class="input">content</div></div>}
25
- assert_equal expected_code, bootstrap_clearfix_wrap(:post, :name, content, options)
24
+ expected_code = %{<div class="control-group"><label class="control-label" for="post_name">Custom</label><div class="controls">content</div></div>}
25
+ assert_equal expected_code, bootstrap_control_group_wrap(:post, :name, content, options)
26
26
  end
27
27
 
28
- def test_bootstrap_clearfix_wrap_with_errors
28
+ def test_bootstrap_control_group_wrap_with_errors
29
29
  object = mock
30
30
  errors = { :name => ["can't be blank"] }
31
31
  options = { :object => object }
@@ -33,11 +33,11 @@ class FormHelperTest < ActionView::TestCase
33
33
  stub(object).errors { errors }
34
34
  stub(object).name { 'Object Name' }
35
35
 
36
- expected_code = %{<div class="clearfix error"><label for="post_name">Name</label><div class="input">content<span class="help-inline"> can't be blank</span></div></div>}
37
- assert_equal expected_code, bootstrap_clearfix_wrap(:post, :name, content, options)
36
+ expected_code = %{<div class="control-group error"><label class="control-label" for="post_name">Name</label><div class="controls">content<span class="help-inline"> can't be blank</span></div></div>}
37
+ assert_equal expected_code, bootstrap_control_group_wrap(:post, :name, content, options)
38
38
  end
39
39
 
40
- def test_bootstrap_clearfix_wrap_with_many_errors
40
+ def test_bootstrap_control_group_wrap_with_many_errors
41
41
  object = mock
42
42
  errors = { :name => ["has already been taken", "is reserved", "must be odd"] }
43
43
  options = { :object => object }
@@ -45,11 +45,11 @@ class FormHelperTest < ActionView::TestCase
45
45
  stub(object).errors { errors }
46
46
  stub(object).name { 'Object Name' }
47
47
 
48
- expected_code = %{<div class="clearfix error"><label for="post_name">Name</label><div class="input">content<span class="help-inline"> has already been taken, is reserved, and must be odd</span></div></div>}
49
- assert_equal expected_code, bootstrap_clearfix_wrap(:post, :name, content, options)
48
+ expected_code = %{<div class="control-group error"><label class="control-label" for="post_name">Name</label><div class="controls">content<span class="help-inline"> has already been taken, is reserved, and must be odd</span></div></div>}
49
+ assert_equal expected_code, bootstrap_control_group_wrap(:post, :name, content, options)
50
50
  end
51
51
 
52
- def test_bootstrap_clearfix_wrap_with_hint
52
+ def test_bootstrap_control_group_wrap_with_hint
53
53
  object = mock
54
54
  errors = {}
55
55
  options = { :object => object, :hint => "format matters" }
@@ -57,11 +57,11 @@ class FormHelperTest < ActionView::TestCase
57
57
  stub(object).errors { errors }
58
58
  stub(object).name { 'Object Name' }
59
59
 
60
- expected_code = %{<div class="clearfix"><label for="post_name">Name</label><div class="input">content<span class="help-inline"> format matters</span></div></div>}
61
- assert_equal expected_code, bootstrap_clearfix_wrap(:post, :name, content, options)
60
+ expected_code = %{<div class="control-group"><label class="control-label" for="post_name">Name</label><div class="controls">content<span class="help-inline"> format matters</span></div></div>}
61
+ assert_equal expected_code, bootstrap_control_group_wrap(:post, :name, content, options)
62
62
  end
63
63
 
64
- def test_bootstrap_clearfix_wrap_with_hint_and_errors
64
+ def test_bootstrap_control_group_wrap_with_hint_and_errors
65
65
  object = mock
66
66
  errors = { :name => ["can't be blank"] }
67
67
  options = { :object => object, :hint => "format matters" }
@@ -69,8 +69,8 @@ class FormHelperTest < ActionView::TestCase
69
69
  stub(object).errors { errors }
70
70
  stub(object).name { 'Object Name' }
71
71
 
72
- expected_code = %{<div class="clearfix error"><label for="post_name">Name</label><div class="input">content<span class="help-inline"> can't be blank</span></div></div>}
73
- assert_equal expected_code, bootstrap_clearfix_wrap(:post, :name, content, options)
72
+ expected_code = %{<div class="control-group error"><label class="control-label" for="post_name">Name</label><div class="controls">content<span class="help-inline"> can't be blank</span></div></div>}
73
+ assert_equal expected_code, bootstrap_control_group_wrap(:post, :name, content, options)
74
74
  end
75
75
 
76
76
  def test_bootstrap_text_field
@@ -78,7 +78,7 @@ class FormHelperTest < ActionView::TestCase
78
78
  options = { :object => mock }
79
79
 
80
80
  mock(self).text_field(:post, :name, options) { text_field }
81
- mock(self).bootstrap_clearfix_wrap(:post, :name, text_field, options.dup) { html }
81
+ mock(self).bootstrap_control_group_wrap(:post, :name, text_field, options.dup) { html }
82
82
  assert_equal html, bootstrap_text_field(:post, :name, options)
83
83
  end
84
84
 
@@ -87,7 +87,7 @@ class FormHelperTest < ActionView::TestCase
87
87
  options = { :object => mock }
88
88
 
89
89
  mock(self).email_field(:post, :email, options) { email_field }
90
- mock(self).bootstrap_clearfix_wrap(:post, :email, email_field, options.dup) { html }
90
+ mock(self).bootstrap_control_group_wrap(:post, :email, email_field, options.dup) { html }
91
91
  assert_equal html, bootstrap_email_field(:post, :email, options)
92
92
  end
93
93
 
@@ -96,7 +96,7 @@ class FormHelperTest < ActionView::TestCase
96
96
  options = { :object => mock }
97
97
 
98
98
  mock(self).password_field(:post, :password, options) { password_field }
99
- mock(self).bootstrap_clearfix_wrap(:post, :password, password_field, options.dup) { html }
99
+ mock(self).bootstrap_control_group_wrap(:post, :password, password_field, options.dup) { html }
100
100
  assert_equal html, bootstrap_password_field(:post, :password, options)
101
101
  end
102
102
 
@@ -105,7 +105,7 @@ class FormHelperTest < ActionView::TestCase
105
105
  options = { :object => mock }
106
106
 
107
107
  mock(self).collection_select(:post, :name, collection, :id, :name, options, {}) { collection_select_html }
108
- mock(self).bootstrap_clearfix_wrap(:post, :name, collection_select_html, options.dup) { html }
108
+ mock(self).bootstrap_control_group_wrap(:post, :name, collection_select_html, options.dup) { html }
109
109
 
110
110
  assert_equal html, bootstrap_collection_select(:post, :name, collection, :id ,:name, options)
111
111
  end
@@ -115,7 +115,7 @@ class FormHelperTest < ActionView::TestCase
115
115
  options = { :object => mock }
116
116
 
117
117
  mock(self).select(:post, :name, choices, options, {}) { select_html }
118
- mock(self).bootstrap_clearfix_wrap(:post, :name, select_html, options.dup) { html }
118
+ mock(self).bootstrap_control_group_wrap(:post, :name, select_html, options.dup) { html }
119
119
 
120
120
  assert_equal html, bootstrap_select(:post, :name, choices, options, {})
121
121
  end
@@ -125,7 +125,7 @@ class FormHelperTest < ActionView::TestCase
125
125
  options = { :object => mock }
126
126
 
127
127
  mock(self).file_field(:post, :attachment, options) { text_field }
128
- mock(self).bootstrap_clearfix_wrap(:post, :attachment, text_field, options.dup) { html }
128
+ mock(self).bootstrap_control_group_wrap(:post, :attachment, text_field, options.dup) { html }
129
129
  assert_equal html, bootstrap_file_field(:post, :attachment, options)
130
130
  end
131
131
 
@@ -134,7 +134,7 @@ class FormHelperTest < ActionView::TestCase
134
134
  options = { :object => mock }
135
135
 
136
136
  mock(self).text_area(:post, :description, options) { text_area }
137
- mock(self).bootstrap_clearfix_wrap(:post, :description, text_area, options.dup) { html }
137
+ mock(self).bootstrap_control_group_wrap(:post, :description, text_area, options.dup) { html }
138
138
  assert_equal html, bootstrap_text_area(:post, :description, options)
139
139
  end
140
140
 
@@ -143,7 +143,7 @@ class FormHelperTest < ActionView::TestCase
143
143
  options = { :object => mock, :label => "Custom", :hint => "be careful" }
144
144
 
145
145
  mock(self).text_area(:post, :description, options.except(:label, :hint)) { text_area }
146
- mock(self).bootstrap_clearfix_wrap(:post, :description, text_area, options.dup) { html }
146
+ mock(self).bootstrap_control_group_wrap(:post, :description, text_area, options.dup) { html }
147
147
  assert_equal html, bootstrap_text_area(:post, :description, options)
148
148
  end
149
149
 
@@ -19,11 +19,12 @@ module BootstrapForm
19
19
  end
20
20
 
21
21
  BootstrapForm::Application.routes.draw do
22
- match '/:controller(/:action(/:id))'
22
+ get '/:controller(/:action(/:id))'
23
23
  end
24
+ BootstrapForm::Application.config.secret_key_base = 'bootstrap'
24
25
 
25
26
  ActionController::Base.send :include, BootstrapForm::Application.routes.url_helpers
26
27
 
27
- class Test::Unit::TestCase
28
+ class MiniTest::Unit::TestCase
28
29
  include RR::Adapters::TestUnit
29
30
  end
metadata CHANGED
@@ -1,60 +1,71 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bootstrap-form
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
5
- prerelease:
4
+ version: 1.0.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - David Padilla
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2011-11-08 00:00:00.000000000 Z
11
+ date: 2013-02-23 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: railties
16
- requirement: &70199655132100 !ruby/object:Gem::Requirement
17
- none: false
15
+ requirement: !ruby/object:Gem::Requirement
18
16
  requirements:
19
- - - ~>
17
+ - - '>='
20
18
  - !ruby/object:Gem::Version
21
- version: '3.0'
19
+ version: '3.2'
22
20
  type: :runtime
23
21
  prerelease: false
24
- version_requirements: *70199655132100
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '3.2'
25
27
  - !ruby/object:Gem::Dependency
26
28
  name: actionpack
27
- requirement: &70199655131600 !ruby/object:Gem::Requirement
28
- none: false
29
+ requirement: !ruby/object:Gem::Requirement
29
30
  requirements:
30
- - - ~>
31
+ - - '>='
31
32
  - !ruby/object:Gem::Version
32
- version: '3.0'
33
+ version: '3.2'
33
34
  type: :runtime
34
35
  prerelease: false
35
- version_requirements: *70199655131600
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '3.2'
36
41
  - !ruby/object:Gem::Dependency
37
42
  name: minitest
38
- requirement: &70199655131220 !ruby/object:Gem::Requirement
39
- none: false
43
+ requirement: !ruby/object:Gem::Requirement
40
44
  requirements:
41
- - - ! '>='
45
+ - - '>='
42
46
  - !ruby/object:Gem::Version
43
47
  version: '0'
44
48
  type: :development
45
49
  prerelease: false
46
- version_requirements: *70199655131220
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
47
55
  - !ruby/object:Gem::Dependency
48
56
  name: rr
49
- requirement: &70199655130760 !ruby/object:Gem::Requirement
50
- none: false
57
+ requirement: !ruby/object:Gem::Requirement
51
58
  requirements:
52
- - - ! '>='
59
+ - - '>='
53
60
  - !ruby/object:Gem::Version
54
61
  version: '0'
55
62
  type: :development
56
63
  prerelease: false
57
- version_requirements: *70199655130760
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
58
69
  description: Twitter Bootstrap Form helpers
59
70
  email:
60
71
  - david@crowdint.com
@@ -63,6 +74,7 @@ extensions: []
63
74
  extra_rdoc_files: []
64
75
  files:
65
76
  - .gitignore
77
+ - .travis.yml
66
78
  - Gemfile
67
79
  - README.md
68
80
  - Rakefile
@@ -74,27 +86,26 @@ files:
74
86
  - test/test_helper.rb
75
87
  homepage: ''
76
88
  licenses: []
89
+ metadata: {}
77
90
  post_install_message:
78
91
  rdoc_options: []
79
92
  require_paths:
80
93
  - lib
81
94
  required_ruby_version: !ruby/object:Gem::Requirement
82
- none: false
83
95
  requirements:
84
- - - ! '>='
96
+ - - '>='
85
97
  - !ruby/object:Gem::Version
86
98
  version: '0'
87
99
  required_rubygems_version: !ruby/object:Gem::Requirement
88
- none: false
89
100
  requirements:
90
- - - ! '>='
101
+ - - '>='
91
102
  - !ruby/object:Gem::Version
92
103
  version: '0'
93
104
  requirements: []
94
105
  rubyforge_project: bootstrap-form
95
- rubygems_version: 1.8.10
106
+ rubygems_version: 2.0.0.rc.2
96
107
  signing_key:
97
- specification_version: 3
108
+ specification_version: 4
98
109
  summary: Twitter Bootstrap Form helpers
99
110
  test_files:
100
111
  - test/lib/action_view/helpers/form_helper_test.rb