bard-tag_field 0.1.0 → 0.2.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: 99c36b23ef302095ac7b0c3994ac82027cc28df8efb1426097d67a639f735003
4
- data.tar.gz: badb540eb22db036f7ee1d6930e440cffec862ca008c06e8b57aebb01b86cf50
3
+ metadata.gz: 2b02f3ddad60e5123de67a5eabce0f7055f78ca2acacc6420e6f8217619040b9
4
+ data.tar.gz: d5e46540cba56d49a543f4ce5493ad7049271546134c03e7cc5fac6ed145e00d
5
5
  SHA512:
6
- metadata.gz: a0bdc6d674b71f7097dd8c6fa6f556f8a95dacd31560bcba2aed2dbb64a7cd94a22c71063e432b4d9f2e2e07b1b38fe2760fcced79a90cd7d9fb1c2935a9d123
7
- data.tar.gz: 85891e20dbc60abf1292f2d091e93ef28cdc824d1110d18d54cec747ad7e54747a8ef52a9991f31c84d5f09b5ce3c42261edf42915d12a50905028d6b0e6f928
6
+ metadata.gz: f8b3e7375d573b1b388cdb834b521b1196bd0a037cf709c2ca3b953c46f9b174b2731d7eb6e6e0c2d1681343658fb554585a3a2e7e949630268f1973a3c5b7e9
7
+ data.tar.gz: cdbfa395648b8d5b593552bebe246607309ff62cbe11c514a70e5ba960c9717efa6bb41b19fd0eb0566e1b378d9f9412bdbc193d32b09bc929ce463ecbe2b82e
@@ -10,21 +10,15 @@ module Bard
10
10
  # Store choices for render_object_values method
11
11
  @choices = choices
12
12
 
13
- # Generate unique datalist ID if we have choices and no block
14
- datalist_id = nil
15
- if choices&.any? && !block
16
- datalist_id = "#{@options[:id]}_datalist"
17
- @options[:list] = datalist_id
18
- end
19
-
20
13
  result = @template_object.content_tag("input-tag", @options) do
21
- next block.call(@options) if block
22
- render_object_values
23
- end
14
+ content = block ? block.call(@options) : render_object_values
24
15
 
25
- # Add datalist after input-tag if we have choices and no block
26
- if choices&.any? && !block
27
- result += render_datalist(datalist_id, choices)
16
+ # Add nested anonymous datalist if we have choices, no block, and no external list specified
17
+ if choices&.any? && !block && !@options[:list]
18
+ content += render_datalist(nil, choices)
19
+ end
20
+
21
+ content
28
22
  end
29
23
 
30
24
  result
@@ -33,7 +27,10 @@ module Bard
33
27
  private
34
28
 
35
29
  def render_datalist(datalist_id, choices)
36
- @template_object.content_tag("datalist", id: datalist_id) do
30
+ # Use id attribute only if datalist_id is provided (for external datalist)
31
+ attributes = datalist_id ? { id: datalist_id } : {}
32
+
33
+ @template_object.content_tag("datalist", attributes) do
37
34
  choices.map do |choice|
38
35
  case choice
39
36
  when Array
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Bard
4
4
  module TagField
5
- VERSION = "0.1.0"
5
+ VERSION = "0.2.0"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bard-tag_field
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Micah Geisel