bs_form_builder 0.0.4 → 0.0.5
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cb43b999ee5f0362b1544f99f3b1e442240f57d9
|
4
|
+
data.tar.gz: 6c86a155cf8abb5a4731a1a932e42f33e2ab4734
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9427f597d16817ca1669966b6e7861de9ca75dea6901f0c1b55c38727a84be763219105c2009955c2cf6c1a67e0a44d185bf5fae4a474f338e15ef3f6e334a35
|
7
|
+
data.tar.gz: d4b921c2cce23feea98b32e5500d2c56e8a005280c0d60ec81833a296bbd080308a044139780d7feeb90b740c0da890121563bb6adb8260cf07d5286bca0518a
|
@@ -56,14 +56,35 @@ class BootstrapFormBuilder::HorizontalFormBuilder < ActionView::Helpers::FormBui
|
|
56
56
|
end
|
57
57
|
end
|
58
58
|
|
59
|
+
# uses bootstrap option to stretch the buttons to the full enclosing width
|
60
|
+
# if you use this, you may need to add the following style to your
|
61
|
+
# stylesheet to re-hide the radio-button circle
|
62
|
+
# (because Bootstrap's one is too specific to deal with this):
|
63
|
+
#
|
64
|
+
# [data-toggle="buttons"] .btn input[type="radio"] {
|
65
|
+
# position: absolute;
|
66
|
+
# z-index: -1;
|
67
|
+
# opacity: 0;
|
68
|
+
# filter: alpha(opacity=0);
|
69
|
+
#}
|
70
|
+
#
|
71
|
+
def justified_radio_button_group(name, button_options, opts = {})
|
72
|
+
form_group(name) do
|
73
|
+
buttons = button_options.map do |button|
|
74
|
+
@template.content_tag(:div, radio_button_label(name, button), :class => 'btn-group')
|
75
|
+
end.join("\n").html_safe
|
76
|
+
|
77
|
+
@template.content_tag(:div,
|
78
|
+
buttons,
|
79
|
+
:class => 'btn-group btn-group-justified',
|
80
|
+
:data => { :toggle => 'buttons' })
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
59
84
|
def radio_button_group(name, button_options, opts = {})
|
60
85
|
form_group(name) do
|
61
86
|
buttons = button_options.map do |button|
|
62
|
-
|
63
|
-
radio_button(name, button) +
|
64
|
-
I18n.t("#{object_name}.#{name}_options.#{button}",
|
65
|
-
:scope => "helpers.label")
|
66
|
-
end
|
87
|
+
radio_button_label(name, button)
|
67
88
|
end.join("\n").html_safe
|
68
89
|
|
69
90
|
@template.content_tag(:div,
|
@@ -73,6 +94,14 @@ class BootstrapFormBuilder::HorizontalFormBuilder < ActionView::Helpers::FormBui
|
|
73
94
|
end
|
74
95
|
end
|
75
96
|
|
97
|
+
def radio_button_label(name, button)
|
98
|
+
label(name, :value => button, :class => 'btn btn-default') do
|
99
|
+
radio_button(name, button) +
|
100
|
+
I18n.t("#{object_name}.#{name}_options.#{button}",
|
101
|
+
:scope => "helpers.label")
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
76
105
|
def select(name, choices, options = {}, html_options = {})
|
77
106
|
form_group(name) do
|
78
107
|
super(name, choices, options, html_options.reverse_merge(:class => 'form-control'))
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bs_form_builder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sean Geoghegan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-10-
|
11
|
+
date: 2014-10-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionview
|