trenni-formatters 2.10.0 → 2.11.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 73f7c57bec0e5a3a6a532780308ca6e15569b3f26772876cdd2442c4d9e88a9b
4
- data.tar.gz: 7e56a4f516c1306d708ad88716000eff4778023e3976ad9b44bced6fa5dacbf3
3
+ metadata.gz: 6d6feaaa592cf7b7ee7470871eb4a169485b1141978ca45fc0bae655e76494fc
4
+ data.tar.gz: 78e3dec788ea4b9439d64a281f13b1dd8a4b4845d65340d595e4e8489437d93c
5
5
  SHA512:
6
- metadata.gz: f0a149e19f9a21e00335da046d7721c102ee30c6a0bec7382e855058fa5ae28ff51318a917c28d8eee09c4192499fa9a5908d6e7b365843176d18e7392869d91
7
- data.tar.gz: ce08752246ea4f8529a9bd1adbbd008912a0b34ac1d8927a7cb43453dc45eee612a076ad01f5c39e0dc9696180562417d6338dd634a99c45ddbe5e2fb18d803c
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 element(klass, options = {}, &block)
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, options, builder, &block)
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 = {}, &block)
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, options, builder, &block)
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, options, builder, &block)
31
- instance = self.new(formatter, options, builder)
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, options, builder)
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, options, builder, &block)
31
- instance = self.new(formatter, options, builder)
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, options, builder)
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)
@@ -22,6 +22,6 @@
22
22
 
23
23
  module Trenni
24
24
  module Formatters
25
- VERSION = "2.10.0"
25
+ VERSION = "2.11.0"
26
26
  end
27
27
  end
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.10.0
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-05-31 00:00:00.000000000 Z
11
+ date: 2020-06-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mapping