trenni-formatters 2.1.0 → 2.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/trenni/formatters/html/radio_select.rb +6 -3
- data/lib/trenni/formatters/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1036d2369c3b3bde480f8bad87942960ba4a7b22
|
4
|
+
data.tar.gz: e7d467c11f019cc49ae0e23a3383548d8673bcfc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f7cc27f561472dd8c22148278484a73e58331a7efec5b13bd09cd0548b78bb93f56a0def9abdf632e5d790567c0dac6159d6280a0cd5fbf2bc3ccc92eecc664a
|
7
|
+
data.tar.gz: 1cfd277dafd6b61868df9893595c921a5de35eccbeb357f6e7b0947f276bbdb94c4ca804ab7b61df64d3f46118a99ff88b3e714f882c48517dcbe5535d04849a
|
@@ -34,6 +34,8 @@ module Trenni
|
|
34
34
|
def initialize(formatter, options, builder)
|
35
35
|
@formatter = formatter
|
36
36
|
@object = formatter.object
|
37
|
+
|
38
|
+
@options = options
|
37
39
|
@field = options[:field]
|
38
40
|
|
39
41
|
@builder = builder
|
@@ -55,8 +57,9 @@ module Trenni
|
|
55
57
|
return {
|
56
58
|
:type => :radio,
|
57
59
|
:name => @field,
|
58
|
-
|
59
|
-
:
|
60
|
+
# We set a default value to empty string, otherwise it becomes "on".
|
61
|
+
:value => value_for(options) || "",
|
62
|
+
:checked => options.fetch(:selected){ value_for(@options) == value_for(options) },
|
60
63
|
:data => options[:data],
|
61
64
|
}
|
62
65
|
end
|
@@ -67,7 +70,7 @@ module Trenni
|
|
67
70
|
builder.inline(:td, :class => :handle) do
|
68
71
|
builder.tag :input, radio_attributes_for(options)
|
69
72
|
end
|
70
|
-
|
73
|
+
|
71
74
|
builder.inline(:td, :class => :item) do
|
72
75
|
if block_given?
|
73
76
|
builder.append Trenni::Template.capture(self, &block)
|