phlexi-display 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
  SHA256:
3
- metadata.gz: b0c24a5fa14dc380439a665f86ab750dce0dfc4533960518e2ebd62c4a4a3a38
4
- data.tar.gz: c3a8f5f8c11819831b77a43b30b6ddebce4cdc349b0a1087407b1cb3ca9e8860
3
+ metadata.gz: 6f519ac0a922ec274d4a45f66208e470d807f7d2fc34f9154ca6758c0de77b8c
4
+ data.tar.gz: d0a493ad4678d4d41ae0b0e06cdd53b510d72208e45c0fe59d1c351c5392dd62
5
5
  SHA512:
6
- metadata.gz: 35e8e3cb43b9949317ed4ea0df9ff5fa98e408a3fd78f8ce16315343a91aed8748f6a987f068927f73c1c682e4f3c560d28f9876176de841987ef932f5afe0ec
7
- data.tar.gz: 6a0016904df13b9c35e5463a0f5f5e72963c2766be0513e76b21d4bfd1c94258ced23e1a0d23487d6feb6ec1ed555556df8f01de5d73692d84d3e5a30e7f3181
6
+ metadata.gz: e1ac7dfb74665e852aa8e39f14b2dc85583ba8201da09cb22f6821147e7538b9503035285c285ad7dd530ade7b0e5ab9df6f02c4f0b7d5ef3594295235592b5e
7
+ data.tar.gz: e4a83a95a323eecbdfca20af2601b9291311b9292eae6de6888b3279ba52889bdf0d09b8988d0972377660215a8a10fad5d6eeda4daa0dbbbdbc630dc385a803
@@ -8,7 +8,30 @@ module Phlexi
8
8
  def view_template
9
9
  return render(field.placeholder_tag(**@placeholder_attributes)) unless field.has_value?
10
10
 
11
- values = (field.multiple? && field.value.respond_to?(:each)) ? field.value : [field.value]
11
+ if field.multiple? && field.value.respond_to?(:each)
12
+ wrapped {
13
+ field.value.each { |value|
14
+ value = normalize_value(value)
15
+ render_value(value)
16
+ }
17
+ }
18
+ else
19
+ wrapped {
20
+ value = normalize_value(field.value)
21
+ render_value(value)
22
+ }
23
+ end
24
+ end
25
+
26
+ def wrapped(&)
27
+ div(
28
+ id: attributes.delete(:id),
29
+ class: tokens(component_name, "value_wrapper", themed(:value_wrapper), themed(:"#{component_name}_value_wrapper")),
30
+ &
31
+ )
32
+ end
33
+
34
+ def render_values(values)
12
35
  values.each do |value|
13
36
  render_value(normalize_value(value))
14
37
  end
@@ -30,6 +53,13 @@ module Phlexi
30
53
  attributes[:id] = field.dom.id if attributes[:id] == "#{field.dom.id}_#{component_name}"
31
54
  end
32
55
 
56
+ def build_component_class
57
+ return if attributes[:class] == false
58
+
59
+ super
60
+ attributes[:class] = tokens(component_name, "value", attributes[:class].sub(component_name, ""))
61
+ end
62
+
33
63
  def normalize_value(value)
34
64
  value.to_s
35
65
  end
@@ -7,6 +7,7 @@ module Phlexi
7
7
  label: nil,
8
8
  description: nil,
9
9
  placeholder: nil,
10
+ value_wrapper: nil,
10
11
  string: nil,
11
12
  text: :string,
12
13
  phone: :string,
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Phlexi
4
4
  module Display
5
- VERSION = "0.0.4"
5
+ VERSION = "0.0.5"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: phlexi-display
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stefan Froelich
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-09-15 00:00:00.000000000 Z
11
+ date: 2024-09-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: phlex