chobble-forms 0.8.0 → 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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ab593ac41bb229464108cac7259b52c2651befb209718e10c64c623d6b80750f
|
|
4
|
+
data.tar.gz: 4036dcb72c51dd939694f4032f36080d38be629a6f98d28140e1cec1f202c1bf
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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
|
|
@@ -127,6 +128,7 @@ module ChobbleForms
|
|
|
127
128
|
rows
|
|
128
129
|
step
|
|
129
130
|
type
|
|
131
|
+
value
|
|
130
132
|
].freeze, T::Array[Symbol])
|
|
131
133
|
|
|
132
134
|
sig { params(local_assigns: T::Hash[Symbol, LocalAssignValue]).void }
|
|
@@ -2,17 +2,21 @@
|
|
|
2
2
|
# Get i18n_base from section (already validated there)
|
|
3
3
|
setup = form_field_setup(field, local_assigns)
|
|
4
4
|
|
|
5
|
-
#
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
# Use provided value parameter if present, otherwise get from model
|
|
6
|
+
if local_assigns.key?(:value)
|
|
7
|
+
display_value = value
|
|
8
|
+
else
|
|
9
|
+
model_object = setup[:form_object].object
|
|
10
|
+
display_value = model_object.send(field) if model_object.respond_to?(field)
|
|
11
|
+
end
|
|
8
12
|
|
|
9
13
|
# Format dates and times nicely
|
|
10
|
-
formatted_value = if
|
|
11
|
-
|
|
12
|
-
elsif
|
|
13
|
-
|
|
14
|
+
formatted_value = if display_value.is_a?(DateTime) || display_value.is_a?(Time)
|
|
15
|
+
display_value.strftime("%B %-d, %Y - %H:%M")
|
|
16
|
+
elsif display_value.is_a?(Date)
|
|
17
|
+
display_value.strftime("%B %-d, %Y")
|
|
14
18
|
else
|
|
15
|
-
|
|
19
|
+
display_value
|
|
16
20
|
end
|
|
17
21
|
%>
|
|
18
22
|
|
|
@@ -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
|
|
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.
|
|
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-
|
|
11
|
+
date: 2025-10-21 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rails
|