bs_form_builder 0.1.0 → 0.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 15b24e8ba1b8c22cc9b14ba7e1e82cf94e07abd3
4
- data.tar.gz: 95f25b04a5a076a14721671d7f488a45b657a4c0
3
+ metadata.gz: cbdf79b579803ea0f7c6e9c53ebeac00c918ac3c
4
+ data.tar.gz: 391ab911f9a6f3cd3469376c4da29615c8092596
5
5
  SHA512:
6
- metadata.gz: edb2b9e976e90c3ab6829e57b7ebc632613b597eb7309333fd29e4a2d07a1b63cfd64703bc402a99598205ba70d0abf182518acd6e3ede4a49984cd249b769ca
7
- data.tar.gz: 424dbcf73953980a35785e946b627d65fcaa7048ed70d6bf2af6c89cf4b2525b28bb31689e76f6b7bb684128ff30400ba600f3e4c8b5d5b0d848fad034bb5519
6
+ metadata.gz: 03ab1a7fc7568e23b34a9a9019fc7ea1ac2b065a389a7e3dcb8f87afa16c05f754f490bde567f59a781cb904eef6cbc5243f7f8302e8d0f4cc8993a87a6b5972
7
+ data.tar.gz: edb6f3c3c52b2cd5fed50a31c0f6d9cfd0dd60146b287a6f9a21f812622210f0094f2ec86dcbabcdc405b76216b087facc3b4caa23bb92e0bac92865960b3ca6
@@ -50,12 +50,22 @@ class BootstrapFormBuilder::HorizontalFormBuilder < ActionView::Helpers::FormBui
50
50
 
51
51
  def check_box(name, opts = {})
52
52
  form_group(name, opts.slice(:label_options, :group_options, :tip_options)) do
53
- @template.content_tag(:div,
54
- @template.content_tag(:label, super(name, opts) + (help(name) || "&nbsp;").html_safe),
55
- :class => 'checkbox')
53
+ simple_check_box(name, opts)
56
54
  end
57
55
  end
58
56
 
57
+ # A checkbox without the form group and control label
58
+ def simple_check_box(name, options = {}, checked_value = '1', unchecked_value = '0')
59
+ @template.content_tag(:div,
60
+ @template.content_tag(:label,
61
+ @template.check_box(@object_name, name,
62
+ objectify_options(options),
63
+ checked_value,
64
+ unchecked_value) +
65
+ label_text(name).html_safe),
66
+ :class => 'checkbox')
67
+ end
68
+
59
69
  # uses bootstrap option to stretch the buttons to the full enclosing width
60
70
  # if you use this, you may need to add the following style to your
61
71
  # stylesheet to re-hide the radio-button circle
@@ -158,6 +168,10 @@ class BootstrapFormBuilder::HorizontalFormBuilder < ActionView::Helpers::FormBui
158
168
  end
159
169
  end
160
170
 
171
+ def label_text(name)
172
+ I18n.t("helpers.label.#{object_name}.#{name}", :default => "")
173
+ end
174
+
161
175
  def tip(name, options = {})
162
176
  i18n_name = "helpers.tips.#{object_name}.#{name}"
163
177
  if I18n.exists?(i18n_name)
@@ -1,3 +1,3 @@
1
1
  module BootstrapFormBuilder
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bs_form_builder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sean Geoghegan