bh 1.3.0 → 1.3.1

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: a5ee96b17731875a1201eb7ec0cf89f1835e44ed
4
- data.tar.gz: 538d55809b170aa39b2bf7dc533bf57b601627ed
3
+ metadata.gz: 3044213572c129233bf23c8f9d4e9ddf67307c3c
4
+ data.tar.gz: 3dce30164e6a204a736c4dda91b775d427ac0c0e
5
5
  SHA512:
6
- metadata.gz: 34dc9102e88461797920f35beb0192c13590dbffab164262a6451be3e2224b276b68826dff4c389a7e06a1606653a74b12417e9c863c26ab269e0867257eaecc
7
- data.tar.gz: 63405566998bc759a03dfb472aa7b96976d9c3580fec01f1497bfdb1eac3ea6c4d58a7a9d0e5cb1cb33ce2c7eaf5a7e3ab42658bb4c39e1f0b3b736bd89158a0
6
+ metadata.gz: 5716a1e8ee975c605c011b967f10d2e01b878504837e1bbbb8dc763c8aff9de5d682243f9e73fc4e75e94fe955cffec358241e39d918d587175a10f7a5668bc4
7
+ data.tar.gz: 664b527fb7fac7619fe9e1f7917cc784d0cfc35476f1a37dbc45c5f376282323ce21f2a73267720b6d27fd23ce211e300c383bd14b2d586d89f9ada2501e4346
@@ -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 options[:offset]), 'col-sm-9']
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, " #{label}"
114
+ label_and_field.insert index, label
112
115
  else
113
- label_and_field.concat " #{label}"
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
 
@@ -1,3 +1,3 @@
1
1
  module Bh
2
- VERSION = '1.3.0'
2
+ VERSION = '1.3.1'
3
3
  end
@@ -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.0
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-03 00:00:00.000000000 Z
11
+ date: 2015-02-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport