trenni-formatters 2.10.0 → 2.11.0
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/definition_list_form.rb +20 -3
- data/lib/trenni/formatters/html/label_form.rb +2 -2
- data/lib/trenni/formatters/html/option_select.rb +7 -6
- data/lib/trenni/formatters/html/radio_select.rb +5 -5
- data/lib/trenni/formatters/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6d6feaaa592cf7b7ee7470871eb4a169485b1141978ca45fc0bae655e76494fc
|
4
|
+
data.tar.gz: 78e3dec788ea4b9439d64a281f13b1dd8a4b4845d65340d595e4e8489437d93c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1ed0633355b499980dadbcb900a651020f9718d43bae54b8dbbe2f8e0c491d06dec7bb9cf63e4eab58f6aa5bdba84742a31f1824711c124e95c2a24f8930fd0f
|
7
|
+
data.tar.gz: 151c6d08577bfc6481591c3b2c0733083b5d847c02f633525c5225629dc717f45b532b6c957fb27450cda2787e88d939e63d1bc4e6c15fe15bc4e570f2b78c4b
|
@@ -116,8 +116,25 @@ module Trenni
|
|
116
116
|
builder.tag :input, submit_attributes_for(**options)
|
117
117
|
end
|
118
118
|
end
|
119
|
-
|
120
|
-
def
|
119
|
+
|
120
|
+
def fieldset(**options, &block)
|
121
|
+
options = @options.merge(**options)
|
122
|
+
buffer = Trenni::Template.buffer(block.binding)
|
123
|
+
|
124
|
+
Builder.fragment(buffer) do |builder|
|
125
|
+
builder.tag('fieldset') do
|
126
|
+
builder.inline('legend') do
|
127
|
+
builder.text title_for(**options)
|
128
|
+
end
|
129
|
+
|
130
|
+
builder.tag('dl') do
|
131
|
+
yield(builder)
|
132
|
+
end
|
133
|
+
end
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
137
|
+
def element(klass, **options, &block)
|
121
138
|
options = @options.merge(**options)
|
122
139
|
buffer = Trenni::Template.buffer(block.binding)
|
123
140
|
|
@@ -127,7 +144,7 @@ module Trenni
|
|
127
144
|
end
|
128
145
|
|
129
146
|
builder.tag(:dd) do
|
130
|
-
klass.call(self,
|
147
|
+
klass.call(self, builder, **options, &block)
|
131
148
|
|
132
149
|
if details = details_for(**options)
|
133
150
|
builder.inline(:small, class: 'details') {builder.text details}
|
@@ -124,7 +124,7 @@ module Trenni
|
|
124
124
|
end
|
125
125
|
end
|
126
126
|
|
127
|
-
def element(klass, options
|
127
|
+
def element(klass, **options, &block)
|
128
128
|
options = @options.merge(**options)
|
129
129
|
buffer = Trenni::Template.buffer(block.binding)
|
130
130
|
|
@@ -138,7 +138,7 @@ module Trenni
|
|
138
138
|
end
|
139
139
|
end
|
140
140
|
|
141
|
-
klass.call(self,
|
141
|
+
klass.call(self, builder, **options, &block)
|
142
142
|
end
|
143
143
|
end
|
144
144
|
end
|
@@ -27,20 +27,20 @@ module Trenni
|
|
27
27
|
module HTML
|
28
28
|
# Standard drop-down select box:
|
29
29
|
class OptionSelect
|
30
|
-
def self.call(formatter,
|
31
|
-
instance = self.new(formatter,
|
30
|
+
def self.call(formatter, builder, **options, &block)
|
31
|
+
instance = self.new(formatter, builder, **options)
|
32
32
|
|
33
33
|
instance.call(options, &block)
|
34
34
|
end
|
35
35
|
|
36
|
-
def initialize(formatter,
|
36
|
+
def initialize(formatter, builder, **options)
|
37
37
|
@formatter = formatter
|
38
38
|
@object = formatter.object
|
39
|
-
@field = options[:field]
|
40
|
-
|
41
|
-
@options = options
|
42
39
|
|
43
40
|
@builder = builder
|
41
|
+
|
42
|
+
@options = options
|
43
|
+
@field = options[:field]
|
44
44
|
end
|
45
45
|
|
46
46
|
def name_for(**options)
|
@@ -123,6 +123,7 @@ module Trenni
|
|
123
123
|
:class => options[:class],
|
124
124
|
:multiple => options[:multiple],
|
125
125
|
:data => options[:data],
|
126
|
+
:required => options[:required],
|
126
127
|
}
|
127
128
|
end
|
128
129
|
|
@@ -27,20 +27,20 @@ module Trenni
|
|
27
27
|
module HTML
|
28
28
|
# Table based select boxes using per-row checkboxes.
|
29
29
|
class RadioSelect
|
30
|
-
def self.call(formatter,
|
31
|
-
instance = self.new(formatter,
|
30
|
+
def self.call(formatter, builder, **options, &block)
|
31
|
+
instance = self.new(formatter, builder, **options)
|
32
32
|
|
33
33
|
instance.call(options, &block)
|
34
34
|
end
|
35
35
|
|
36
|
-
def initialize(formatter,
|
36
|
+
def initialize(formatter, builder, **options)
|
37
37
|
@formatter = formatter
|
38
38
|
@object = formatter.object
|
39
39
|
|
40
|
+
@builder = builder
|
41
|
+
|
40
42
|
@options = options
|
41
43
|
@field = options[:field]
|
42
|
-
|
43
|
-
@builder = builder
|
44
44
|
end
|
45
45
|
|
46
46
|
def name_for(**options)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: trenni-formatters
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.11.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-06-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mapping
|