bootstrap-form 1.0.0 → 3.0.0.rc2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b7ffd8809005417c3cbef505e3283572f37dd566
4
- data.tar.gz: f3e582b3e5c67de249325d16b6e47608113a6cab
3
+ metadata.gz: 550f8154589e3409ab3f1ea4e527ea00715702f3
4
+ data.tar.gz: 9f58ff608b6d2e3a82704f79169794a4377158ab
5
5
  SHA512:
6
- metadata.gz: be9ceec1e7f83257db098b2a2379cab03bf2a0204c5e740a3658f9291de4bf0d6c0d65e1ea98c773cf2bc2bb52fbd37dac1334258e1180a941de1b399c41d0f1
7
- data.tar.gz: 50adcf7462bf78b2828be3859680c7d312920cdda8978f5ee3de59a3b4d1124e04c50d6c11c2b6cbf737896abc8d8bf39e0602bb2b697b12b6f80a97856e27d7
6
+ metadata.gz: ac6e895c213b1b503e852accf572e6ac30436390c4759ae9e5c1872dbf18fe97724fbf4dd5057ec4be9f802c2d302f36a71503b15727170405361840cc08e56c
7
+ data.tar.gz: 7d208337c7fb92dd6a9bc0327293e0a13b5ab767a8d61a913e44cd5601a88a427c252a25a3169b140e33b56f451ee7e01d9a5df2ac4c2cee83545c6a1509d19a
@@ -1,3 +1,6 @@
1
1
  rvm:
2
- - 1.8.7
3
- - 1.9.2
2
+ - 1.9.3
3
+ - 2.0.0
4
+ gemfile:
5
+ - Gemfile.rails.3.2
6
+ - Gemfile.rails.4.0
@@ -0,0 +1,7 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in bootstrap-form.gemspec
4
+ gemspec
5
+
6
+ gem 'railties', '~> 3.2'
7
+ gem 'actionpack', '~> 3.2'
@@ -0,0 +1,7 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in bootstrap-form.gemspec
4
+ gemspec
5
+
6
+ gem 'railties', '4.0.0'
7
+ gem 'actionpack', '4.0.0'
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2013 David Padilla
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md CHANGED
@@ -1,10 +1,14 @@
1
1
  # Bootstrap Form
2
2
 
3
- Form Helpers to make your form inputs [look like this](http://twitter.github.com/bootstrap/#forms).
3
+ [![Build Status](https://travis-ci.org/dabit/bootstrap-form.png?branch=master)](https://travis-ci.org/dabit/bootstrap-form)
4
+
5
+ Form Helpers to make your form inputs [look like this](http://twitter.github.io/bootstrap/base-css.html#forms).
4
6
 
5
7
  Helps you to create beautiful mocks really quickly.
6
8
 
7
- Works with Bootstrap 2.3.0 and Rails 3.2+ (including Rails 4)
9
+ Works with Bootstrap 3 and Rails 3.2+ (including Rails 4)
10
+
11
+ For older versions of Bootstrap use version 1.0.x of this gem.
8
12
 
9
13
  ## Usage
10
14
 
@@ -32,11 +36,9 @@ You write this:
32
36
 
33
37
  You get something like this:
34
38
 
35
- <div class="control-group">
39
+ <div class="form-group">
36
40
  <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">
39
- </div>
41
+ <input class="form-control" id="account_name" name="account_name" size="30" type="text">
40
42
  </div>
41
43
 
42
44
  Pretty straight forward.
@@ -52,11 +54,9 @@ option:
52
54
 
53
55
  Then, you get something like this:
54
56
 
55
- <div class="control-group">
57
+ <div class="form-group">
56
58
  <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">
59
- </div>
59
+ <input class="form-control" id="account_name" name="account_name" size="30" type="text">
60
60
  </div>
61
61
 
62
62
  ## Current Helpers List
@@ -19,9 +19,9 @@ Gem::Specification.new do |s|
19
19
  s.require_paths = ["lib"]
20
20
 
21
21
 
22
- s.add_dependency 'railties', '>= 3.2'
23
- s.add_dependency 'actionpack', '>= 3.2'
22
+ s.add_dependency 'railties', '> 3.2'
23
+ s.add_dependency 'actionpack', '> 3.2'
24
24
 
25
- s.add_development_dependency "minitest"
25
+ s.add_development_dependency "minitest", "~> 4.7.5"
26
26
  s.add_development_dependency "rr"
27
27
  end
@@ -5,40 +5,47 @@ module ActionView
5
5
  BOOTSTRAP_OPTIONS = [:label, :hint].freeze
6
6
 
7
7
  def bootstrap_text_field(object_name, method, options={})
8
+ options[:class] = (options[:class] ? options[:class] + " form-control" : "form-control")
8
9
  bootstrap_control_group_wrap(object_name, method, text_field(object_name, method, extract_input_options(options)), options)
9
10
  end
10
11
 
11
12
  def bootstrap_email_field(object_name, method, options={})
13
+ options[:class] = (options[:class] ? options[:class] + " form-control" : "form-control")
12
14
  bootstrap_control_group_wrap(object_name, method, email_field(object_name, method, extract_input_options(options)), options)
13
15
  end
14
16
 
15
17
  def bootstrap_password_field(object_name, method, options={})
18
+ options[:class] = (options[:class] ? options[:class] + " form-control" : "form-control")
16
19
  bootstrap_control_group_wrap(object_name, method, password_field(object_name, method, extract_input_options(options)), options)
17
20
  end
18
21
 
19
22
  def bootstrap_collection_select(object_name, method, collection, value_method, text_method, options = {}, html_options = {})
23
+ html_options[:class] = (html_options[:class] ? html_options[:class] + " form-control" : "form-control")
20
24
  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
25
  end
22
26
 
23
- def bootstrap_select(object_name, method, choices, options, html_options)
27
+ def bootstrap_select(object_name, method, choices, options={}, html_options={})
28
+ html_options[:class] = (html_options[:class] ? html_options[:class] + " form-control" : "form-control")
24
29
  bootstrap_control_group_wrap(object_name, method, select(object_name, method, choices, extract_input_options(options), html_options), options)
25
30
  end
26
31
 
27
32
  def bootstrap_file_field(object_name, method, options={})
33
+ options[:class] = (options[:class] ? options[:class] + " form-control" : "form-control")
28
34
  bootstrap_control_group_wrap(object_name, method, file_field(object_name, method, extract_input_options(options)), options)
29
35
  end
30
36
 
31
37
  def bootstrap_text_area(object_name, method, options={})
38
+ options[:class] = (options[:class] ? options[:class] + " form-control" : "form-control")
32
39
  bootstrap_control_group_wrap(object_name, method, text_area(object_name, method, extract_input_options(options)), options)
33
40
  end
34
41
 
35
42
  def bootstrap_control_group_wrap(object_name, method, content, options={})
36
- error_messages = options[:object].errors[method]
37
- control_group_tag = error_messages.blank? ? 'control-group' : 'control-group error'
38
- inline_help = inline_help_tag(error_messages.presence || options[:hint])
43
+ error_messages = options[:object].errors[method]
44
+ control_group_tag = error_messages.blank? ? 'form-group' : 'form-group has-error'
45
+ inline_help = inline_help_tag(error_messages.presence || options[:hint])
39
46
 
40
47
  content_tag(:div, label(object_name, method, options[:label], :class => 'control-label') +
41
- content_tag(:div, content + inline_help, :class => 'controls'),
48
+ content + inline_help,
42
49
  :class => control_group_tag)
43
50
  end
44
51
 
@@ -46,7 +53,7 @@ module ActionView
46
53
  messages = Array.wrap(messages)
47
54
  return '' if messages.empty?
48
55
  message_span = ActiveSupport::SafeBuffer.new(" #{messages.to_sentence}")
49
- content_tag(:span, message_span, :class => 'help-inline')
56
+ content_tag(:span, message_span, :class => 'help-block')
50
57
  end
51
58
 
52
59
  private
@@ -1,5 +1,5 @@
1
1
  module Bootstrap
2
2
  module Form
3
- VERSION = "1.0.0"
3
+ VERSION = "3.0.0.rc2"
4
4
  end
5
5
  end
@@ -9,7 +9,7 @@ class FormHelperTest < ActionView::TestCase
9
9
  stub(object).errors { errors }
10
10
  stub(object).name { 'Object Name' }
11
11
 
12
- expected_code = %{<div class="control-group"><label class="control-label" for="post_name">Name</label><div class="controls">content</div></div>}
12
+ expected_code = %{<div class="form-group"><label class="control-label" for="post_name">Name</label>content</div>}
13
13
  assert_equal expected_code, bootstrap_control_group_wrap(:post, :name, content, options)
14
14
  end
15
15
 
@@ -21,7 +21,7 @@ class FormHelperTest < ActionView::TestCase
21
21
  stub(object).errors { errors }
22
22
  stub(object).name { 'Object Name' }
23
23
 
24
- expected_code = %{<div class="control-group"><label class="control-label" for="post_name">Custom</label><div class="controls">content</div></div>}
24
+ expected_code = %{<div class="form-group"><label class="control-label" for="post_name">Custom</label>content</div>}
25
25
  assert_equal expected_code, bootstrap_control_group_wrap(:post, :name, content, options)
26
26
  end
27
27
 
@@ -33,7 +33,7 @@ class FormHelperTest < ActionView::TestCase
33
33
  stub(object).errors { errors }
34
34
  stub(object).name { 'Object Name' }
35
35
 
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>}
36
+ expected_code = %{<div class="form-group has-error"><label class="control-label" for="post_name">Name</label>content<span class="help-block"> can't be blank</span></div>}
37
37
  assert_equal expected_code, bootstrap_control_group_wrap(:post, :name, content, options)
38
38
  end
39
39
 
@@ -45,7 +45,7 @@ class FormHelperTest < ActionView::TestCase
45
45
  stub(object).errors { errors }
46
46
  stub(object).name { 'Object Name' }
47
47
 
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>}
48
+ expected_code = %{<div class="form-group has-error"><label class="control-label" for="post_name">Name</label>content<span class="help-block"> has already been taken, is reserved, and must be odd</span></div>}
49
49
  assert_equal expected_code, bootstrap_control_group_wrap(:post, :name, content, options)
50
50
  end
51
51
 
@@ -57,7 +57,7 @@ class FormHelperTest < ActionView::TestCase
57
57
  stub(object).errors { errors }
58
58
  stub(object).name { 'Object Name' }
59
59
 
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>}
60
+ expected_code = %{<div class="form-group"><label class="control-label" for="post_name">Name</label>content<span class="help-block"> format matters</span></div>}
61
61
  assert_equal expected_code, bootstrap_control_group_wrap(:post, :name, content, options)
62
62
  end
63
63
 
@@ -69,7 +69,7 @@ class FormHelperTest < ActionView::TestCase
69
69
  stub(object).errors { errors }
70
70
  stub(object).name { 'Object Name' }
71
71
 
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>}
72
+ expected_code = %{<div class="form-group has-error"><label class="control-label" for="post_name">Name</label>content<span class="help-block"> can't be blank</span></div>}
73
73
  assert_equal expected_code, bootstrap_control_group_wrap(:post, :name, content, options)
74
74
  end
75
75
 
@@ -24,7 +24,3 @@ end
24
24
  BootstrapForm::Application.config.secret_key_base = 'bootstrap'
25
25
 
26
26
  ActionController::Base.send :include, BootstrapForm::Application.routes.url_helpers
27
-
28
- class MiniTest::Unit::TestCase
29
- include RR::Adapters::TestUnit
30
- end
metadata CHANGED
@@ -1,57 +1,57 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bootstrap-form
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 3.0.0.rc2
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Padilla
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-02-23 00:00:00.000000000 Z
11
+ date: 2013-08-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - '>'
18
18
  - !ruby/object:Gem::Version
19
19
  version: '3.2'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - '>'
25
25
  - !ruby/object:Gem::Version
26
26
  version: '3.2'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: actionpack
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - '>'
32
32
  - !ruby/object:Gem::Version
33
33
  version: '3.2'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - '>'
39
39
  - !ruby/object:Gem::Version
40
40
  version: '3.2'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: minitest
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ~>
46
46
  - !ruby/object:Gem::Version
47
- version: '0'
47
+ version: 4.7.5
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - ~>
53
53
  - !ruby/object:Gem::Version
54
- version: '0'
54
+ version: 4.7.5
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rr
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -76,6 +76,9 @@ files:
76
76
  - .gitignore
77
77
  - .travis.yml
78
78
  - Gemfile
79
+ - Gemfile.rails.3.2
80
+ - Gemfile.rails.4.0
81
+ - LICENSE
79
82
  - README.md
80
83
  - Rakefile
81
84
  - bootsrap-form.gemspec
@@ -98,12 +101,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
98
101
  version: '0'
99
102
  required_rubygems_version: !ruby/object:Gem::Requirement
100
103
  requirements:
101
- - - '>='
104
+ - - '>'
102
105
  - !ruby/object:Gem::Version
103
- version: '0'
106
+ version: 1.3.1
104
107
  requirements: []
105
108
  rubyforge_project: bootstrap-form
106
- rubygems_version: 2.0.0.rc.2
109
+ rubygems_version: 2.0.3
107
110
  signing_key:
108
111
  specification_version: 4
109
112
  summary: Twitter Bootstrap Form helpers