chobble-forms 0.5.2 → 0.5.4
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 +4 -4
- data/app/assets/stylesheets/chobble_forms/radio_buttons.css +2 -2
- data/lib/chobble_forms/version.rb +1 -1
- data/views/chobble_forms/_auto_submit_select.html.erb +9 -9
- data/views/chobble_forms/_comment.html.erb +3 -6
- data/views/chobble_forms/_comment_checkbox.html.erb +1 -2
- data/views/chobble_forms/_errors.html.erb +6 -6
- data/views/chobble_forms/_field_with_link.html.erb +4 -4
- data/views/chobble_forms/_fields.html.erb +1 -1
- data/views/chobble_forms/_fieldset.html.erb +1 -1
- data/views/chobble_forms/_file_field_turbo_response.html.erb +2 -2
- data/views/chobble_forms/_form_context.html.erb +8 -11
- data/views/chobble_forms/_header.html.erb +1 -1
- data/views/chobble_forms/_integer_comment.html.erb +1 -1
- data/views/chobble_forms/_number.html.erb +1 -2
- data/views/chobble_forms/_number_pass_fail_comment.html.erb +3 -6
- data/views/chobble_forms/_number_pass_fail_na_comment.html.erb +5 -10
- data/views/chobble_forms/_pass_fail.html.erb +1 -2
- data/views/chobble_forms/_pass_fail_comment.html.erb +2 -4
- data/views/chobble_forms/_pass_fail_na_comment.html.erb +3 -5
- data/views/chobble_forms/_radio_comment.html.erb +2 -4
- data/views/chobble_forms/_radio_pass_fail.html.erb +5 -8
- data/views/chobble_forms/_search_field.html.erb +1 -1
- data/views/chobble_forms/_submit_button.html.erb +5 -1
- data/views/chobble_forms/_yes_no_radio.html.erb +1 -2
- data/views/chobble_forms/_yes_no_radio_comment.html.erb +3 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fcb65898826074bdefd196616c2f495504a85ce9a047173f2b40deec6358d3ca
|
4
|
+
data.tar.gz: b5c465a3e2b51a8c10bb8136481042e4ebfa4877588453298f503111723ac41e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 21f5dbc63567a01e771ab246832c192ed228d786767ab599fb7f7a1709ed6161fcd69318071f0369004aac99cd2d11e9c6d7179b9a948bc7ddf8311e94777521
|
7
|
+
data.tar.gz: '09cbefeca3fa67b31a43cda50e40ef37d327a40040933a1ef53765c1d5c40688cffc26295a8ad807545f19716292eb60da27a877408752d74468a4df762b7112'
|
@@ -48,8 +48,8 @@ input[type="radio"]:checked::before {
|
|
48
48
|
}
|
49
49
|
|
50
50
|
input[type="radio"]:focus {
|
51
|
-
outline:
|
52
|
-
outline-offset:
|
51
|
+
outline: 2px solid currentColor;
|
52
|
+
outline-offset: 2px;
|
53
53
|
}
|
54
54
|
|
55
55
|
input[type="radio"]:disabled {
|
@@ -2,7 +2,7 @@
|
|
2
2
|
# Auto-submit select field options
|
3
3
|
field = local_assigns[:field] or raise ArgumentError, "field is required for auto submit select"
|
4
4
|
options = local_assigns[:options] or raise ArgumentError, "options is required for auto submit select"
|
5
|
-
|
5
|
+
|
6
6
|
# Check if we're in a form context with form object or need standalone
|
7
7
|
if local_assigns[:form]
|
8
8
|
form_object = local_assigns[:form]
|
@@ -12,7 +12,7 @@
|
|
12
12
|
url = local_assigns[:url] or raise ArgumentError, "url is required for standalone auto submit select"
|
13
13
|
selected_value = params[field]
|
14
14
|
end
|
15
|
-
|
15
|
+
|
16
16
|
# Optional parameters
|
17
17
|
label = local_assigns[:label]
|
18
18
|
include_blank = local_assigns[:include_blank]
|
@@ -25,31 +25,31 @@
|
|
25
25
|
<% if label %>
|
26
26
|
<%= form_object.label field, label %>
|
27
27
|
<% end %>
|
28
|
-
|
28
|
+
|
29
29
|
<%= form_object.select field,
|
30
30
|
options_for_select(options, selected_value),
|
31
31
|
include_blank ? { include_blank: blank_text } : {},
|
32
32
|
{ onchange: "this.form.submit();" } %>
|
33
|
-
|
33
|
+
|
34
34
|
<% else %>
|
35
35
|
<!-- Standalone auto-submit select form -->
|
36
36
|
<%= form_with url: url, method: :get, data: (turbo_disabled ? { turbo: false } : {}) do |form| %>
|
37
|
-
|
37
|
+
|
38
38
|
<!-- Preserve other parameters -->
|
39
39
|
<% preserve_params.each do |param| %>
|
40
40
|
<% if params[param].present? %>
|
41
41
|
<%= form.hidden_field param, value: params[param] %>
|
42
42
|
<% end %>
|
43
43
|
<% end %>
|
44
|
-
|
44
|
+
|
45
45
|
<% if label %>
|
46
46
|
<%= form.label field, label %>
|
47
47
|
<% end %>
|
48
|
-
|
48
|
+
|
49
49
|
<%= form.select field,
|
50
50
|
options_for_select(options, selected_value),
|
51
51
|
include_blank ? { include_blank: blank_text } : {},
|
52
52
|
{ onchange: "this.form.submit();" } %>
|
53
|
-
|
53
|
+
|
54
54
|
<% end %>
|
55
|
-
<% end %>
|
55
|
+
<% end %>
|
@@ -22,19 +22,16 @@
|
|
22
22
|
<input type="checkbox" id="<%= checkbox_id %>"
|
23
23
|
<%= 'checked' if has_content %>
|
24
24
|
data-comment-toggle="<%= textarea_id %>"
|
25
|
-
data-comment-container="<%= textarea_id %>_container"
|
26
|
-
>
|
25
|
+
data-comment-container="<%= textarea_id %>_container">
|
27
26
|
<%= t("shared.comment") %>
|
28
27
|
</label>
|
29
28
|
|
30
29
|
<div id="<%= textarea_id %>_container"
|
31
|
-
style="display: <%= has_content ? 'block' : 'none' %>"
|
32
|
-
>
|
30
|
+
style="display: <%= has_content ? 'block' : 'none' %>">
|
33
31
|
<%= form.text_field field,
|
34
32
|
maxlength: maxlength,
|
35
33
|
placeholder: placeholder,
|
36
34
|
id: textarea_id,
|
37
|
-
title: "Max #{maxlength} characters"
|
38
|
-
%>
|
35
|
+
title: "Max #{maxlength} characters" %>
|
39
36
|
</div>
|
40
37
|
</div>
|
@@ -2,15 +2,15 @@
|
|
2
2
|
# Form errors component - displays validation errors for any model object
|
3
3
|
model_object = local_assigns[:model] || local_assigns[:object]
|
4
4
|
raise ArgumentError, "model object is required for form errors" if model_object.nil?
|
5
|
-
|
5
|
+
|
6
6
|
# Use inherited i18n_base from form context
|
7
7
|
i18n_base = @_current_i18n_base
|
8
8
|
raise ArgumentError, "i18n_base is required for form errors" if i18n_base.nil?
|
9
|
-
|
9
|
+
|
10
10
|
# Custom header text or use i18n lookup - no fallbacks
|
11
|
-
header_text = local_assigns[:header] ||
|
12
|
-
t("#{i18n_base}.errors.header",
|
13
|
-
count: model_object.errors.count,
|
11
|
+
header_text = local_assigns[:header] ||
|
12
|
+
t("#{i18n_base}.errors.header",
|
13
|
+
count: model_object.errors.count,
|
14
14
|
raise: true)
|
15
15
|
%>
|
16
16
|
|
@@ -23,4 +23,4 @@
|
|
23
23
|
<% end %>
|
24
24
|
</ul>
|
25
25
|
</aside>
|
26
|
-
<% end %>
|
26
|
+
<% end %>
|
@@ -8,14 +8,14 @@
|
|
8
8
|
# - link_url: URL for the link
|
9
9
|
# - link_text: Text for the link
|
10
10
|
# - options: options for autocomplete_field
|
11
|
-
|
11
|
+
|
12
12
|
field_type = local_assigns[:field_type] || :text_field
|
13
13
|
field = local_assigns[:field]
|
14
14
|
required = local_assigns[:required] || false
|
15
15
|
link_url = local_assigns[:link_url]
|
16
16
|
link_text = local_assigns[:link_text]
|
17
17
|
options = local_assigns[:options] || []
|
18
|
-
|
18
|
+
|
19
19
|
has_link = link_url.present? && link_text.present?
|
20
20
|
css_classes = has_link ? "field field-with-link" : "field"
|
21
21
|
%>
|
@@ -26,8 +26,8 @@
|
|
26
26
|
<% else %>
|
27
27
|
<%= render 'chobble_forms/text_field', field: field, required: required %>
|
28
28
|
<% end %>
|
29
|
-
|
29
|
+
|
30
30
|
<% if has_link %>
|
31
31
|
<%= link_to link_text, link_url %>
|
32
32
|
<% end %>
|
33
|
-
</div>
|
33
|
+
</div>
|
@@ -5,7 +5,7 @@
|
|
5
5
|
raise ArgumentError, "i18n_base is required for form fieldsets" if i18n_base.nil?
|
6
6
|
raise ArgumentError, "legend_key is required for form fieldsets" if local_assigns[:legend_key].nil?
|
7
7
|
@_current_i18n_base = i18n_base
|
8
|
-
|
8
|
+
|
9
9
|
sections_base = i18n_base.sub(/\.fields$/, '')
|
10
10
|
legend_i18n_key = "#{sections_base}.sections.#{local_assigns[:legend_key]}"
|
11
11
|
legend_text = t(legend_i18n_key)
|
@@ -7,7 +7,7 @@
|
|
7
7
|
# i18n_base: The i18n base path
|
8
8
|
# Optional parameters:
|
9
9
|
# accept: File accept types (defaults to "image/*")
|
10
|
-
|
10
|
+
|
11
11
|
model = local_assigns[:model]
|
12
12
|
field = local_assigns[:field]
|
13
13
|
turbo_frame_id = local_assigns[:turbo_frame_id]
|
@@ -21,4 +21,4 @@
|
|
21
21
|
<% @_current_i18n_base = i18n_base %>
|
22
22
|
<%= render 'chobble_forms/file_field', field: field, accept: accept %>
|
23
23
|
<% end %>
|
24
|
-
<% end %>
|
24
|
+
<% end %>
|
@@ -16,7 +16,7 @@
|
|
16
16
|
# Non-model forms need explicit URL and default to POST
|
17
17
|
method ||= :post
|
18
18
|
end
|
19
|
-
|
19
|
+
|
20
20
|
# Check if local form submission is requested
|
21
21
|
use_local = local_assigns[:local] || false
|
22
22
|
%>
|
@@ -25,7 +25,7 @@
|
|
25
25
|
url: url,
|
26
26
|
method: method,
|
27
27
|
local: use_local,
|
28
|
-
html: {
|
28
|
+
html: {
|
29
29
|
multipart: true
|
30
30
|
}
|
31
31
|
} %>
|
@@ -46,8 +46,7 @@ end %>
|
|
46
46
|
|
47
47
|
<%= form_with(**form_options) do |form| %>
|
48
48
|
<%= render "chobble_forms/header",
|
49
|
-
title: I18n.t("#{i18n_base}.header")
|
50
|
-
%>
|
49
|
+
title: I18n.t("#{i18n_base}.header") %>
|
51
50
|
|
52
51
|
<% @_current_form = form %>
|
53
52
|
<% @_current_i18n_base = i18n_base %>
|
@@ -59,14 +58,12 @@ end %>
|
|
59
58
|
<% end %>
|
60
59
|
|
61
60
|
<fieldset>
|
62
|
-
|
63
|
-
|
64
|
-
|
61
|
+
<div class="form-actions">
|
62
|
+
<%= render 'chobble_forms/submit_button', submit_key: local_assigns[:submit_key] %>
|
63
|
+
<% if local_assigns[:secondary_link_url].present? && local_assigns[:secondary_link_text].present? %>
|
65
64
|
<%= link_to secondary_link_text, secondary_link_url, role: "button", class: "secondary" %>
|
66
|
-
|
67
|
-
|
68
|
-
<%= render 'chobble_forms/submit_button' %>
|
69
|
-
<% end %>
|
65
|
+
<% end %>
|
66
|
+
</div>
|
70
67
|
</fieldset>
|
71
68
|
|
72
69
|
<%# Save message display for Turbo Streams %>
|
@@ -51,14 +51,12 @@
|
|
51
51
|
required: number_options[:required],
|
52
52
|
placeholder: field_data[:field_placeholder],
|
53
53
|
value: number_options[:value],
|
54
|
-
class: "number"
|
55
|
-
%>
|
54
|
+
class: "number" %>
|
56
55
|
|
57
56
|
<%= render 'chobble_forms/radio_pass_fail',
|
58
57
|
field: pass_fail_field,
|
59
58
|
prefilled: pass_fail_prefilled,
|
60
|
-
checked_value: pass_fail_checked
|
61
|
-
%>
|
59
|
+
checked_value: pass_fail_checked %>
|
62
60
|
|
63
61
|
<%= render 'chobble_forms/comment_checkbox',
|
64
62
|
comment_field: comment_field,
|
@@ -68,6 +66,5 @@
|
|
68
66
|
prefilled: comment_info[:prefilled] %>
|
69
67
|
|
70
68
|
<%= form.text_area comment_field,
|
71
|
-
comment_info[:options]
|
72
|
-
%>
|
69
|
+
comment_info[:options] %>
|
73
70
|
</div>
|
@@ -30,7 +30,7 @@
|
|
30
30
|
form,
|
31
31
|
pass_fail_field
|
32
32
|
)
|
33
|
-
|
33
|
+
|
34
34
|
# Debug: Check if the model value is being read correctly
|
35
35
|
model_value = model.send(pass_fail_field) if model.respond_to?(pass_fail_field)
|
36
36
|
actual_value = pass_fail_prefilled ? pass_fail_value : model_value
|
@@ -42,7 +42,6 @@
|
|
42
42
|
comment_field,
|
43
43
|
field_data[:field_label]
|
44
44
|
)
|
45
|
-
|
46
45
|
%>
|
47
46
|
|
48
47
|
<div class="form-grid number-radio-comment" id="<%= number_field %>">
|
@@ -58,15 +57,12 @@
|
|
58
57
|
required: number_options[:required],
|
59
58
|
placeholder: field_data[:field_placeholder],
|
60
59
|
value: number_options[:value],
|
61
|
-
class: "number"
|
62
|
-
%>
|
60
|
+
class: "number" %>
|
63
61
|
|
64
62
|
<%= render 'chobble_forms/radio_pass_fail',
|
65
63
|
field: pass_fail_field,
|
66
64
|
prefilled: pass_fail_prefilled && !na_checked,
|
67
|
-
checked_value: pass_fail_checked
|
68
|
-
%>
|
69
|
-
|
65
|
+
checked_value: pass_fail_checked %>
|
70
66
|
|
71
67
|
<%= render 'chobble_forms/comment_checkbox',
|
72
68
|
comment_field: comment_field,
|
@@ -76,6 +72,5 @@
|
|
76
72
|
prefilled: comment_info[:prefilled] %>
|
77
73
|
|
78
74
|
<%= form.text_area comment_field,
|
79
|
-
comment_info[:options]
|
80
|
-
|
81
|
-
</div>
|
75
|
+
comment_info[:options] %>
|
76
|
+
</div>
|
@@ -32,16 +32,14 @@
|
|
32
32
|
<%= render 'chobble_forms/radio_pass_fail',
|
33
33
|
field: field,
|
34
34
|
prefilled: field_data[:prefilled],
|
35
|
-
checked_value: checked_value
|
36
|
-
%>
|
35
|
+
checked_value: checked_value %>
|
37
36
|
|
38
37
|
<%= render 'chobble_forms/comment_checkbox',
|
39
38
|
comment_field: comment_field,
|
40
39
|
checkbox_id: comment_info[:checkbox_id],
|
41
40
|
textarea_id: comment_info[:options][:id],
|
42
41
|
has_comment: comment_info[:has_comment],
|
43
|
-
prefilled: comment_info[:prefilled]
|
44
|
-
%>
|
42
|
+
prefilled: comment_info[:prefilled] %>
|
45
43
|
|
46
44
|
<%= form.text_area comment_field, comment_info[:options] %>
|
47
45
|
</div>
|
@@ -33,16 +33,14 @@
|
|
33
33
|
<%= render 'chobble_forms/radio_pass_fail',
|
34
34
|
field: field,
|
35
35
|
prefilled: field_data[:prefilled],
|
36
|
-
checked_value: checked_value
|
37
|
-
%>
|
36
|
+
checked_value: checked_value %>
|
38
37
|
|
39
38
|
<%= render 'chobble_forms/comment_checkbox',
|
40
39
|
comment_field: comment_field,
|
41
40
|
checkbox_id: comment_info[:checkbox_id],
|
42
41
|
textarea_id: comment_info[:options][:id],
|
43
42
|
has_comment: comment_info[:has_comment],
|
44
|
-
prefilled: comment_info[:prefilled]
|
45
|
-
%>
|
43
|
+
prefilled: comment_info[:prefilled] %>
|
46
44
|
|
47
45
|
<%= form.text_area comment_field, comment_info[:options] %>
|
48
|
-
</div>
|
46
|
+
</div>
|
@@ -32,16 +32,14 @@
|
|
32
32
|
<%= render 'chobble_forms/radio_pass_fail',
|
33
33
|
field: radio_field,
|
34
34
|
prefilled: field_data[:prefilled],
|
35
|
-
checked_value: checked_value
|
36
|
-
%>
|
35
|
+
checked_value: checked_value %>
|
37
36
|
|
38
37
|
<%= render 'chobble_forms/comment_checkbox',
|
39
38
|
comment_field: comment_field,
|
40
39
|
checkbox_id: comment_info[:checkbox_id],
|
41
40
|
textarea_id: comment_info[:options][:id],
|
42
41
|
has_comment: comment_info[:has_comment],
|
43
|
-
prefilled: comment_info[:prefilled]
|
44
|
-
%>
|
42
|
+
prefilled: comment_info[:prefilled] %>
|
45
43
|
|
46
44
|
<%= form.text_area comment_field, comment_info[:options] %>
|
47
45
|
</div>
|
@@ -1,11 +1,11 @@
|
|
1
1
|
<%
|
2
2
|
form = @_current_form
|
3
3
|
yes_no ||= false
|
4
|
-
|
4
|
+
|
5
5
|
# Check if this field is an enum by looking at the model
|
6
6
|
model = form.object
|
7
7
|
is_enum = model.class.respond_to?(:defined_enums) && model.class.defined_enums.key?(field.to_s)
|
8
|
-
|
8
|
+
|
9
9
|
if is_enum
|
10
10
|
pass_value = "pass"
|
11
11
|
fail_value = "fail"
|
@@ -21,22 +21,19 @@
|
|
21
21
|
<%= t("shared.#{yes_no ? "yes" : "pass"}") %>
|
22
22
|
<%= form.radio_button field,
|
23
23
|
pass_value,
|
24
|
-
radio_button_options(prefilled, checked_value, pass_value)
|
25
|
-
%>
|
24
|
+
radio_button_options(prefilled, checked_value, pass_value) %>
|
26
25
|
</label>
|
27
26
|
<label>
|
28
27
|
<%= form.radio_button field,
|
29
28
|
fail_value,
|
30
|
-
radio_button_options(prefilled, checked_value, fail_value)
|
31
|
-
%>
|
29
|
+
radio_button_options(prefilled, checked_value, fail_value) %>
|
32
30
|
<%= t("shared.#{yes_no ? "no" : "fail"}") %>
|
33
31
|
</label>
|
34
32
|
<% if is_enum %>
|
35
33
|
<label>
|
36
34
|
<%= form.radio_button field,
|
37
35
|
na_value,
|
38
|
-
radio_button_options(prefilled, checked_value, na_value)
|
39
|
-
%>
|
36
|
+
radio_button_options(prefilled, checked_value, na_value) %>
|
40
37
|
<%= t("shared.not_applicable") %>
|
41
38
|
</label>
|
42
39
|
<% end %>
|
@@ -33,16 +33,14 @@
|
|
33
33
|
field: radio_field,
|
34
34
|
prefilled: field_data[:prefilled],
|
35
35
|
checked_value: checked_value,
|
36
|
-
yes_no: true
|
37
|
-
%>
|
36
|
+
yes_no: true %>
|
38
37
|
|
39
38
|
<%= render 'chobble_forms/comment_checkbox',
|
40
39
|
comment_field: comment_field,
|
41
40
|
checkbox_id: comment_info[:checkbox_id],
|
42
41
|
textarea_id: comment_info[:options][:id],
|
43
42
|
has_comment: comment_info[:has_comment],
|
44
|
-
prefilled: comment_info[:prefilled]
|
45
|
-
%>
|
43
|
+
prefilled: comment_info[:prefilled] %>
|
46
44
|
|
47
45
|
<%= form.text_area comment_field, comment_info[:options] %>
|
48
|
-
</div>
|
46
|
+
</div>
|
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.5.
|
4
|
+
version: 0.5.4
|
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-08-
|
11
|
+
date: 2025-08-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|