trenni-formatters 2.12.2 → 2.13.0
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 +4 -4
- data/lib/trenni/formatters/html/definition_list_form.rb +1 -2
- data/lib/trenni/formatters/html/label_form.rb +1 -1
- data/lib/trenni/formatters/html/option_select.rb +15 -11
- data/lib/trenni/formatters/html/radio_select.rb +4 -4
- data/lib/trenni/formatters/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a733cfc023aed3ce78ce8278b8d4ef57ee05215440d5bcf0304280115b002cc5
|
|
4
|
+
data.tar.gz: 374dade3208878129d786ef7917085ee5f05e5df50a62eb2d969ce970be944b3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a6663a34484d4fdc67cc9771df53959941e8c514bf03b752bb2c63680ac1e041ee7da4c95a6d8bb45430dd230093cc9b5911c1fef394dc6d179fafd4e9632121
|
|
7
|
+
data.tar.gz: a469d0252fdf4dd7fecd68048350e68a938bb28bbfe3347b47d2c04c39cc40fd7f5fd6dc3477c05d7eb360190f58c526d9fc900930183868ff3cadc2538486b6
|
|
@@ -119,9 +119,8 @@ module Trenni
|
|
|
119
119
|
|
|
120
120
|
def element(klass, **options, &block)
|
|
121
121
|
options = @options.merge(**options)
|
|
122
|
-
buffer = Trenni::Template.buffer(block.binding)
|
|
123
122
|
|
|
124
|
-
|
|
123
|
+
Builder.fragment(block&.binding) do |builder|
|
|
125
124
|
builder.inline(:dt) do
|
|
126
125
|
builder.text title_for(**options)
|
|
127
126
|
end
|
|
@@ -126,7 +126,7 @@ module Trenni
|
|
|
126
126
|
options = @options.merge(**options)
|
|
127
127
|
buffer = Trenni::Template.buffer(block.binding)
|
|
128
128
|
|
|
129
|
-
|
|
129
|
+
Builder.fragment(buffer) do |builder|
|
|
130
130
|
builder.inline(:label) do
|
|
131
131
|
builder.inline(:span) do
|
|
132
132
|
builder.text title_for(**options)
|
|
@@ -75,11 +75,17 @@ module Trenni
|
|
|
75
75
|
}
|
|
76
76
|
end
|
|
77
77
|
|
|
78
|
-
def item(
|
|
78
|
+
def item(**options, &block)
|
|
79
79
|
options[:field] ||= 'id'
|
|
80
80
|
|
|
81
|
-
Builder.fragment(builder) do |builder|
|
|
82
|
-
builder.inline(:option, option_attributes_for(**options))
|
|
81
|
+
Builder.fragment(block&.binding || @builder) do |builder|
|
|
82
|
+
builder.inline(:option, option_attributes_for(**options)) do
|
|
83
|
+
if block_given?
|
|
84
|
+
builder.capture(self, &block)
|
|
85
|
+
else
|
|
86
|
+
builder.text title_for(**options)
|
|
87
|
+
end
|
|
88
|
+
end
|
|
83
89
|
end
|
|
84
90
|
end
|
|
85
91
|
|
|
@@ -101,14 +107,12 @@ module Trenni
|
|
|
101
107
|
end
|
|
102
108
|
|
|
103
109
|
def group(**options, &block)
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
item(@builder, title: optional_title_for(**options), value: nil)
|
|
108
|
-
end
|
|
109
|
-
|
|
110
|
-
builder.capture(&block)
|
|
110
|
+
@builder.tag :optgroup, group_attributes_for(**options) do
|
|
111
|
+
if options[:optional]
|
|
112
|
+
item(title: optional_title_for(**options), value: nil)
|
|
111
113
|
end
|
|
114
|
+
|
|
115
|
+
@builder.capture(&block)
|
|
112
116
|
end
|
|
113
117
|
end
|
|
114
118
|
|
|
@@ -131,7 +135,7 @@ module Trenni
|
|
|
131
135
|
Builder.fragment(@builder) do |builder|
|
|
132
136
|
builder.tag :select, select_attributes_for(**@options) do
|
|
133
137
|
if self.optional?
|
|
134
|
-
item(
|
|
138
|
+
builder << item(title: optional_title_for(**@options), value: nil)
|
|
135
139
|
end
|
|
136
140
|
|
|
137
141
|
builder.capture(self, &block)
|
|
@@ -72,8 +72,8 @@ module Trenni
|
|
|
72
72
|
}
|
|
73
73
|
end
|
|
74
74
|
|
|
75
|
-
def item(
|
|
76
|
-
Builder.fragment
|
|
75
|
+
def item(**options, &block)
|
|
76
|
+
Builder.fragment do |builder|
|
|
77
77
|
builder.tag :tr do
|
|
78
78
|
builder.inline(:td, :class => :handle) do
|
|
79
79
|
builder.tag :input, radio_attributes_for(**options)
|
|
@@ -87,7 +87,7 @@ module Trenni
|
|
|
87
87
|
end
|
|
88
88
|
end
|
|
89
89
|
end
|
|
90
|
-
end
|
|
90
|
+
end
|
|
91
91
|
end
|
|
92
92
|
|
|
93
93
|
def optional_title_for(**options)
|
|
@@ -107,7 +107,7 @@ module Trenni
|
|
|
107
107
|
builder.tag :table do
|
|
108
108
|
builder.tag :tbody do
|
|
109
109
|
if self.optional?
|
|
110
|
-
item(
|
|
110
|
+
builder << item(title: optional_title_for(**@options), value: nil)
|
|
111
111
|
end
|
|
112
112
|
|
|
113
113
|
builder.capture(self, &block)
|
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.13.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-06-
|
|
11
|
+
date: 2020-06-07 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: mapping
|
|
@@ -30,14 +30,14 @@ dependencies:
|
|
|
30
30
|
requirements:
|
|
31
31
|
- - "~>"
|
|
32
32
|
- !ruby/object:Gem::Version
|
|
33
|
-
version: '3.
|
|
33
|
+
version: '3.12'
|
|
34
34
|
type: :runtime
|
|
35
35
|
prerelease: false
|
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
|
37
37
|
requirements:
|
|
38
38
|
- - "~>"
|
|
39
39
|
- !ruby/object:Gem::Version
|
|
40
|
-
version: '3.
|
|
40
|
+
version: '3.12'
|
|
41
41
|
- !ruby/object:Gem::Dependency
|
|
42
42
|
name: bake
|
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|