bh 1.3.0 → 1.3.1
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/lib/bh/core_ext/rails/form/base_helper.rb +8 -5
- data/lib/bh/version.rb +1 -1
- data/spec/rails/form/radio_button_helper_spec.rb +5 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3044213572c129233bf23c8f9d4e9ddf67307c3c
|
4
|
+
data.tar.gz: 3dce30164e6a204a736c4dda91b775d427ac0c0e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5716a1e8ee975c605c011b967f10d2e01b878504837e1bbbb8dc763c8aff9de5d682243f9e73fc4e75e94fe955cffec358241e39d918d587175a10f7a5668bc4
|
7
|
+
data.tar.gz: 664b527fb7fac7619fe9e1f7917cc784d0cfc35476f1a37dbc45c5f376282323ce21f2a73267720b6d27fd23ce211e300c383bd14b2d586d89f9ada2501e4346
|
data/CHANGELOG.md
CHANGED
@@ -6,6 +6,12 @@ For more information about changelogs, check
|
|
6
6
|
[Keep a Changelog](http://keepachangelog.com) and
|
7
7
|
[Vandamme](http://tech-angels.github.io/vandamme).
|
8
8
|
|
9
|
+
## 1.3.1 - 2014-02-03
|
10
|
+
|
11
|
+
* [BUGFIX] Do not render the `:offset` option of the field helpers in the DOM
|
12
|
+
* [BUGFIX] Do not render the `:label` option of the field helpers in the DOM
|
13
|
+
* [ENHANCEMENT] Add `:label_options` option to customize the wrapping label of a field
|
14
|
+
|
9
15
|
## 1.3.0 - 2014-02-02
|
10
16
|
|
11
17
|
* [FEATURE] Extend `form_for` to be wrapped in <li> when inside a `nav`, just like `link_to`
|
@@ -21,8 +21,9 @@ module Bh
|
|
21
21
|
|
22
22
|
|
23
23
|
def field_container(options = {}, &block)
|
24
|
+
offset = options.delete :offset
|
24
25
|
if horizontal_form?
|
25
|
-
klass = [('col-sm-offset-3' if
|
26
|
+
klass = [('col-sm-offset-3' if offset), 'col-sm-9']
|
26
27
|
content_tag :div, class: klass.compact.join(' '), &block
|
27
28
|
else
|
28
29
|
yield
|
@@ -105,15 +106,17 @@ module Bh
|
|
105
106
|
# Bootstrap inline form unless the label is inserted within
|
106
107
|
# the div itself.
|
107
108
|
def label_and_field(container_class, method, options = {}, &block)
|
109
|
+
label = safe_join [' ' , options.delete(:label)]
|
110
|
+
label_options = options.delete(:label_options) || {}
|
111
|
+
|
108
112
|
label_and_field = @template.capture(&block)
|
109
|
-
label = options.delete(:label)
|
110
113
|
if index = label_and_field =~ %r{</div>$}
|
111
|
-
label_and_field.insert index,
|
114
|
+
label_and_field.insert index, label
|
112
115
|
else
|
113
|
-
label_and_field.concat
|
116
|
+
label_and_field.concat label
|
114
117
|
end
|
115
118
|
content_tag :div, class: container_class do
|
116
|
-
content_tag :label, label_and_field
|
119
|
+
content_tag :label, label_and_field, label_options
|
117
120
|
end
|
118
121
|
end
|
119
122
|
|
data/lib/bh/version.rb
CHANGED
@@ -22,6 +22,11 @@ describe 'radio_button' do
|
|
22
22
|
it { expect(form).to include '> Jerry</label>' }
|
23
23
|
end
|
24
24
|
|
25
|
+
context 'given a label_options option, passes the options to the label' do
|
26
|
+
let(:options) { {label_options: {class: 'col-sm-6', data: {js: 2}}} }
|
27
|
+
it { expect(form).to match %r{<label class="col-sm-6" data-js="2"><input.+? /> Jeremy</label>} }
|
28
|
+
end
|
29
|
+
|
25
30
|
context 'not given a help option, does not display a help box' do
|
26
31
|
it { expect(form).not_to include 'help-block' }
|
27
32
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bh
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Claudio Baccigalupo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-02-
|
11
|
+
date: 2015-02-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|