chobble-forms 0.8.1 → 0.9.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: 83a50ed32d5816d85358c3cbfc349ce165e242ff5772abe2c2b9279159d73f89
4
- data.tar.gz: 5274f3e96b1b5b2486b2bad34fcd0c424e6316d0ca4c46928873f740a5ea5716
3
+ metadata.gz: ab593ac41bb229464108cac7259b52c2651befb209718e10c64c623d6b80750f
4
+ data.tar.gz: 4036dcb72c51dd939694f4032f36080d38be629a6f98d28140e1cec1f202c1bf
5
5
  SHA512:
6
- metadata.gz: d3020e7fc68aabef0de03c4fb5394e29035456979f42978fd96238f53b0ef4433ad91d4d42b8e47d2d384e8122a0842971fd606cd089bfbaf55d66799f8e7fa3
7
- data.tar.gz: 3de3e197ffd7e22b3c932e3cdd0eb30e79935e2509efca17002af168d8160172687797582909eb71f105bfe8ae3ab6f2283441faddf08cc9bb62da50f39ea460
6
+ metadata.gz: 15d8ee8a1dd9c086cd17da51d951af54967f260e1be46d33d469d1a1b2cd2c3091cfaea48199c0ae3e297d7100b9784d921da3bd3a16392ecef1f908ee5212be
7
+ data.tar.gz: 2955ec5e0fb1881cdbac8ca0957b452ea8a8b5924c4f7c54706f93949c6879e7494d6542172414bf945018a0bf0a65ac5a0ca94f8bd79bf5f4913aebe89bd9c1
@@ -117,6 +117,7 @@ module ChobbleForms
117
117
  ALLOWED_LOCAL_ASSIGNS = T.let(%i[
118
118
  accept
119
119
  add_not_applicable
120
+ combobox
120
121
  field
121
122
  max
122
123
  min
@@ -2,5 +2,5 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module ChobbleForms
5
- VERSION = "0.8.1"
5
+ VERSION = "0.9.0"
6
6
  end
@@ -4,6 +4,7 @@
4
4
 
5
5
  # Form field options
6
6
  required ||= false
7
+ combobox = local_assigns[:combobox] || false
7
8
 
8
9
  # Options should be:
9
10
  # - For select: options_for_select array or collection_select params
@@ -21,10 +22,20 @@
21
22
 
22
23
  # Add any additional HTML attributes
23
24
  field_options[:onchange] = local_assigns[:onchange] if local_assigns[:onchange]
25
+ field_options[:list] = "#{field}_datalist_#{setup[:form_object].object.object_id}" if combobox
24
26
  %>
25
27
 
26
28
  <%= setup[:form_object].label field, setup[:field_label] %>
27
- <% if collection_select_params %>
29
+ <% if combobox %>
30
+ <%= setup[:form_object].text_field field, field_options %>
31
+ <datalist id="<%= field_options[:list] %>">
32
+ <% options.each do |option| %>
33
+ <% value = option.is_a?(Array) ? option.last : option %>
34
+ <% text = option.is_a?(Array) ? option.first : option %>
35
+ <option value="<%= value %>"><%= text %></option>
36
+ <% end %>
37
+ </datalist>
38
+ <% elsif collection_select_params %>
28
39
  <%= setup[:form_object].collection_select(
29
40
  field,
30
41
  collection_select_params[:collection],
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chobble-forms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.1
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chobble.com
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-10-13 00:00:00.000000000 Z
11
+ date: 2025-10-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails