chobble-forms 0.5.4 → 0.5.6
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/form_grids.css +103 -90
- data/app/javascript/comment_toggles.js +76 -0
- data/app/javascript/na_number_toggles.js +64 -0
- data/app/javascript/na_toggles.js +76 -0
- data/lib/chobble_forms/engine.rb +1 -0
- data/lib/chobble_forms/helpers.rb +1 -0
- data/lib/chobble_forms/version.rb +1 -1
- data/views/chobble_forms/_field_turbo_response.html.erb +22 -0
- data/views/chobble_forms/_form_context.html.erb +2 -1
- data/views/chobble_forms/_integer_comment.html.erb +24 -5
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 38897550927a4c901cada28fbe5f63e8447bf108e6eb3bedf5d045807e45c245
|
4
|
+
data.tar.gz: ede19464d42338a4834967dda6a1df1048d2bef39599ddd89e079256c796ec15
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c24eca1ed04bf5d7cbbe7d483451368ef3b636d3d0d42018e967a5f22ddbee88e4c7c8d2c5a7f6f104828af570610d395342bb05fad838c5366f4b84edd186db
|
7
|
+
data.tar.gz: b486d795a2b856e0895b4736901f52fede072e35319acb7511aaef5b007919e8af5ea644365c34ef30839f0f36301a247fe0b791a5a12c98318ebdd078c11649
|
@@ -3,206 +3,219 @@
|
|
3
3
|
*/
|
4
4
|
|
5
5
|
.form-grid {
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
6
|
+
display: grid;
|
7
|
+
gap: 1rem;
|
8
|
+
align-items: end;
|
9
|
+
padding-top: 1rem;
|
10
10
|
}
|
11
11
|
|
12
12
|
legend + .form-grid {
|
13
|
-
|
13
|
+
border-top: none;
|
14
14
|
}
|
15
15
|
|
16
16
|
/* Radio + Comment grid layout */
|
17
17
|
.radio-comment {
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
18
|
+
grid-template-areas:
|
19
|
+
"label label"
|
20
|
+
"pass-fail comment-label"
|
21
|
+
"comment comment";
|
22
|
+
grid-template-columns: auto 1fr;
|
23
|
+
align-items: center;
|
24
24
|
}
|
25
25
|
|
26
26
|
@media (min-width: 768px) {
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
27
|
+
.radio-comment {
|
28
|
+
grid-template-areas:
|
29
|
+
"label pass-fail comment-space comment-label"
|
30
|
+
"comment comment comment comment";
|
31
|
+
grid-template-columns: max-content auto 1fr auto;
|
32
|
+
}
|
33
33
|
}
|
34
34
|
|
35
35
|
.radio-comment > .label {
|
36
|
-
|
36
|
+
grid-area: label;
|
37
37
|
}
|
38
38
|
|
39
39
|
.radio-comment > .label label {
|
40
|
-
|
40
|
+
flex-direction: column;
|
41
41
|
}
|
42
42
|
|
43
43
|
.radio-comment > .pass-fail {
|
44
|
-
|
44
|
+
grid-area: pass-fail;
|
45
45
|
}
|
46
46
|
|
47
47
|
.radio-comment > .comment-checkbox {
|
48
|
-
|
48
|
+
grid-area: comment-label;
|
49
49
|
}
|
50
50
|
|
51
51
|
.radio-comment > textarea {
|
52
|
-
|
52
|
+
grid-area: comment;
|
53
53
|
}
|
54
54
|
|
55
55
|
/* Number + Pass/Fail + Comment grid layout */
|
56
56
|
.number-radio-comment {
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
57
|
+
grid-template-areas:
|
58
|
+
"label label"
|
59
|
+
"number pass-fail"
|
60
|
+
"comment-label comment-space"
|
61
|
+
"comment comment";
|
62
|
+
grid-template-columns: auto 1fr;
|
63
63
|
}
|
64
64
|
|
65
65
|
@media (min-width: 768px) {
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
66
|
+
.number-radio-comment {
|
67
|
+
grid-template-areas:
|
68
|
+
"label label label label"
|
69
|
+
"number pass-fail comment-space comment-label"
|
70
|
+
"comment comment comment comment";
|
71
|
+
grid-template-columns: auto auto 1fr auto;
|
72
|
+
}
|
73
73
|
}
|
74
74
|
|
75
75
|
.number-radio-comment > .label {
|
76
|
-
|
76
|
+
grid-area: label;
|
77
77
|
}
|
78
78
|
|
79
79
|
.number-radio-comment > .label label {
|
80
|
-
|
80
|
+
flex-direction: column;
|
81
81
|
}
|
82
82
|
|
83
83
|
.number-radio-comment > .number {
|
84
|
-
|
84
|
+
grid-area: number;
|
85
85
|
}
|
86
86
|
|
87
87
|
.number-radio-comment > .pass-fail {
|
88
|
-
|
88
|
+
grid-area: pass-fail;
|
89
89
|
}
|
90
90
|
|
91
91
|
.number-radio-comment > .comment-checkbox {
|
92
|
-
|
92
|
+
grid-area: comment-label;
|
93
93
|
}
|
94
94
|
|
95
95
|
.number-radio-comment > textarea {
|
96
|
-
|
96
|
+
grid-area: comment;
|
97
97
|
}
|
98
98
|
|
99
99
|
/* Number + Comment grid layout */
|
100
100
|
.number-comment {
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
101
|
+
grid-template-areas:
|
102
|
+
"label label"
|
103
|
+
"number comment-label"
|
104
|
+
"comment comment";
|
105
|
+
grid-template-columns: min-content auto;
|
106
|
+
align-items: center;
|
107
107
|
}
|
108
108
|
|
109
109
|
@media (min-width: 768px) {
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
110
|
+
.number-comment {
|
111
|
+
grid-template-areas:
|
112
|
+
"label number comment-space comment-label"
|
113
|
+
"comment comment comment comment";
|
114
|
+
grid-template-columns: max-content 6rem 1fr auto;
|
115
|
+
}
|
116
116
|
}
|
117
117
|
|
118
118
|
.number-comment > .label {
|
119
|
-
|
120
|
-
|
119
|
+
grid-area: label;
|
120
|
+
width: 14rem;
|
121
121
|
}
|
122
122
|
|
123
123
|
.number-comment > .number {
|
124
|
-
|
124
|
+
grid-area: number;
|
125
125
|
}
|
126
126
|
|
127
127
|
.number-comment > .comment-checkbox {
|
128
|
-
|
128
|
+
grid-area: comment-label;
|
129
129
|
}
|
130
130
|
|
131
131
|
.number-comment > textarea {
|
132
|
-
|
132
|
+
grid-area: comment;
|
133
133
|
}
|
134
134
|
|
135
135
|
/* Checkbox + Comment grid layout */
|
136
136
|
.checkbox-comment {
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
137
|
+
display: grid;
|
138
|
+
gap: 0.5rem;
|
139
|
+
align-items: center;
|
140
|
+
margin-bottom: 1rem;
|
141
|
+
grid-template-areas:
|
142
|
+
"label label label label"
|
143
|
+
"check1 label2 comment-space comment-label";
|
144
|
+
grid-template-columns: auto auto 1fr auto;
|
145
145
|
}
|
146
146
|
|
147
147
|
@media (min-width: 768px) {
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
148
|
+
.checkbox-comment {
|
149
|
+
grid-template-areas: "label check1 label2 comment-label";
|
150
|
+
grid-template-columns: max-content auto auto auto;
|
151
|
+
}
|
152
152
|
}
|
153
153
|
|
154
154
|
.checkbox-comment > .label {
|
155
|
-
|
155
|
+
grid-area: label;
|
156
156
|
}
|
157
157
|
|
158
158
|
.checkbox-comment > .checkbox {
|
159
|
-
|
159
|
+
grid-area: check1;
|
160
160
|
}
|
161
161
|
|
162
162
|
.checkbox-comment > .checkbox-label {
|
163
|
-
|
163
|
+
grid-area: label2;
|
164
164
|
}
|
165
165
|
|
166
166
|
.checkbox-comment > .comment-checkbox {
|
167
|
-
|
167
|
+
grid-area: comment-label;
|
168
168
|
}
|
169
169
|
|
170
170
|
.checkbox-comment > textarea {
|
171
|
-
|
172
|
-
|
171
|
+
grid-column: 1 / -1;
|
172
|
+
margin-top: 0.5rem;
|
173
173
|
}
|
174
174
|
|
175
175
|
/* Simple number layout */
|
176
176
|
.number {
|
177
|
-
|
178
|
-
|
179
|
-
|
177
|
+
grid-template-area: "label number";
|
178
|
+
grid-template-columns: auto min-content;
|
179
|
+
align-items: center;
|
180
180
|
}
|
181
181
|
|
182
182
|
.number-comment > .label {
|
183
|
-
|
183
|
+
grid-area: label;
|
184
184
|
}
|
185
185
|
|
186
186
|
.number-comment > .number {
|
187
|
-
|
188
|
-
|
187
|
+
grid-area: number;
|
188
|
+
width: 14rem;
|
189
189
|
}
|
190
190
|
|
191
191
|
/* User capacity flexbox layout */
|
192
192
|
fieldset#user_capacity {
|
193
|
-
|
194
|
-
|
195
|
-
|
193
|
+
display: flex;
|
194
|
+
flex-wrap: wrap;
|
195
|
+
gap: 1rem;
|
196
196
|
}
|
197
197
|
|
198
198
|
/* Mobile: 2 columns (2 rows of 2) */
|
199
199
|
fieldset#user_capacity > * {
|
200
|
-
|
200
|
+
flex: 1 1 calc(50% - 0.5rem);
|
201
201
|
}
|
202
202
|
|
203
203
|
/* Desktop: 4 columns (1 row of 4) */
|
204
204
|
@media (min-width: 768px) {
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
}
|
205
|
+
fieldset#user_capacity > * {
|
206
|
+
flex: 1 1 calc(25% - 0.75rem);
|
207
|
+
}
|
208
|
+
}
|
209
|
+
|
210
|
+
.simple div {
|
211
|
+
display: flex;
|
212
|
+
flex-direction: row;
|
213
|
+
flex-wrap: wrap;
|
214
|
+
gap: 1rem;
|
215
|
+
justify-content: start;
|
216
|
+
align-items: center;
|
217
|
+
}
|
218
|
+
|
219
|
+
.simple input.number {
|
220
|
+
width: 6rem;
|
221
|
+
}
|
@@ -0,0 +1,76 @@
|
|
1
|
+
// CommentToggles - handles comment field visibility toggling
|
2
|
+
class CommentToggles {
|
3
|
+
constructor() {
|
4
|
+
this.processedToggles = new WeakSet();
|
5
|
+
}
|
6
|
+
|
7
|
+
init() {
|
8
|
+
this.attachListeners();
|
9
|
+
}
|
10
|
+
|
11
|
+
attachListeners() {
|
12
|
+
// Find all comment toggle checkboxes
|
13
|
+
const toggles = document.querySelectorAll("[data-comment-toggle]");
|
14
|
+
toggles.forEach((toggle) => this.setupToggle(toggle));
|
15
|
+
}
|
16
|
+
|
17
|
+
setupToggle(toggle) {
|
18
|
+
// Skip if already processed
|
19
|
+
if (this.processedToggles.has(toggle)) return;
|
20
|
+
this.processedToggles.add(toggle);
|
21
|
+
|
22
|
+
// Set initial state
|
23
|
+
this.updateVisibility(toggle);
|
24
|
+
|
25
|
+
// Handle changes
|
26
|
+
toggle.addEventListener("change", () => this.handleToggle(toggle));
|
27
|
+
}
|
28
|
+
|
29
|
+
handleToggle(toggle) {
|
30
|
+
this.updateVisibility(toggle);
|
31
|
+
|
32
|
+
const textareaId = toggle.getAttribute("data-comment-toggle");
|
33
|
+
const textarea = document.getElementById(textareaId);
|
34
|
+
|
35
|
+
if (!textarea) return;
|
36
|
+
|
37
|
+
if (toggle.checked) {
|
38
|
+
// Focus the textarea when showing
|
39
|
+
textarea.focus();
|
40
|
+
} else {
|
41
|
+
// Clear the textarea when hiding
|
42
|
+
textarea.value = "";
|
43
|
+
}
|
44
|
+
}
|
45
|
+
|
46
|
+
updateVisibility(toggle) {
|
47
|
+
const containerId = toggle.getAttribute("data-comment-container");
|
48
|
+
const container = document.getElementById(containerId);
|
49
|
+
|
50
|
+
if (!container) return;
|
51
|
+
|
52
|
+
container.style.display = toggle.checked ? "block" : "none";
|
53
|
+
}
|
54
|
+
|
55
|
+
cleanup() {
|
56
|
+
// Re-process any new toggles that appeared
|
57
|
+
this.attachListeners();
|
58
|
+
}
|
59
|
+
}
|
60
|
+
|
61
|
+
// Create singleton instance
|
62
|
+
const commentToggles = new CommentToggles();
|
63
|
+
|
64
|
+
// Initialize on first load
|
65
|
+
document.addEventListener("DOMContentLoaded", () => commentToggles.init());
|
66
|
+
|
67
|
+
// Reinitialize after Turbo navigation
|
68
|
+
document.addEventListener("turbo:load", () => {
|
69
|
+
commentToggles.cleanup();
|
70
|
+
commentToggles.init();
|
71
|
+
});
|
72
|
+
|
73
|
+
// Handle dynamically loaded content
|
74
|
+
document.addEventListener("turbo:frame-load", () => {
|
75
|
+
commentToggles.attachListeners();
|
76
|
+
});
|
@@ -0,0 +1,64 @@
|
|
1
|
+
class NaNumberToggles {
|
2
|
+
constructor() {
|
3
|
+
this.processedCheckboxes = new WeakSet();
|
4
|
+
}
|
5
|
+
|
6
|
+
init() {
|
7
|
+
this.attachListeners();
|
8
|
+
}
|
9
|
+
|
10
|
+
attachListeners() {
|
11
|
+
const naCheckboxes = document.querySelectorAll('.na-label input[type="checkbox"]');
|
12
|
+
naCheckboxes.forEach((checkbox) => this.setupCheckbox(checkbox));
|
13
|
+
}
|
14
|
+
|
15
|
+
setupCheckbox(checkbox) {
|
16
|
+
if (this.processedCheckboxes.has(checkbox)) return;
|
17
|
+
this.processedCheckboxes.add(checkbox);
|
18
|
+
|
19
|
+
this.updateNumberFieldState(checkbox);
|
20
|
+
|
21
|
+
checkbox.addEventListener("change", () => this.updateNumberFieldState(checkbox));
|
22
|
+
}
|
23
|
+
|
24
|
+
updateNumberFieldState(checkbox) {
|
25
|
+
const label = checkbox.parentElement;
|
26
|
+
const numberInput = label.previousElementSibling;
|
27
|
+
|
28
|
+
if (!numberInput || !numberInput.classList.contains('number')) {
|
29
|
+
console.warn('Could not find number input for N/A checkbox', checkbox);
|
30
|
+
return;
|
31
|
+
}
|
32
|
+
|
33
|
+
if (checkbox.checked) {
|
34
|
+
if (numberInput.value !== '0' && numberInput.value !== '') {
|
35
|
+
checkbox.dataset.previousValue = numberInput.value;
|
36
|
+
}
|
37
|
+
numberInput.disabled = true;
|
38
|
+
numberInput.value = '0';
|
39
|
+
} else {
|
40
|
+
numberInput.disabled = false;
|
41
|
+
if (checkbox.dataset.previousValue) {
|
42
|
+
numberInput.value = checkbox.dataset.previousValue;
|
43
|
+
delete checkbox.dataset.previousValue;
|
44
|
+
}
|
45
|
+
}
|
46
|
+
}
|
47
|
+
|
48
|
+
cleanup() {
|
49
|
+
this.attachListeners();
|
50
|
+
}
|
51
|
+
}
|
52
|
+
|
53
|
+
const naNumberToggles = new NaNumberToggles();
|
54
|
+
|
55
|
+
document.addEventListener("DOMContentLoaded", () => naNumberToggles.init());
|
56
|
+
|
57
|
+
document.addEventListener("turbo:load", () => {
|
58
|
+
naNumberToggles.cleanup();
|
59
|
+
naNumberToggles.init();
|
60
|
+
});
|
61
|
+
|
62
|
+
document.addEventListener("turbo:frame-load", () => {
|
63
|
+
naNumberToggles.attachListeners();
|
64
|
+
});
|
@@ -0,0 +1,76 @@
|
|
1
|
+
// NaToggles - handles N/A radio button functionality for pass/fail fields
|
2
|
+
class NaToggles {
|
3
|
+
constructor() {
|
4
|
+
this.processedRadios = new WeakSet();
|
5
|
+
}
|
6
|
+
|
7
|
+
init() {
|
8
|
+
this.attachListeners();
|
9
|
+
}
|
10
|
+
|
11
|
+
attachListeners() {
|
12
|
+
// Find all enum radio buttons (pass/fail/na)
|
13
|
+
const enumRadios = document.querySelectorAll(
|
14
|
+
'input[type="radio"][value="pass"], input[type="radio"][value="fail"], input[type="radio"][value="na"]',
|
15
|
+
);
|
16
|
+
enumRadios.forEach((radio) => this.setupRadio(radio));
|
17
|
+
}
|
18
|
+
|
19
|
+
setupRadio(radio) {
|
20
|
+
// Skip if already processed
|
21
|
+
if (this.processedRadios.has(radio)) return;
|
22
|
+
this.processedRadios.add(radio);
|
23
|
+
|
24
|
+
// Set initial state
|
25
|
+
this.updatePassFailState(radio);
|
26
|
+
|
27
|
+
// Handle changes
|
28
|
+
radio.addEventListener("change", () => this.updatePassFailState(radio));
|
29
|
+
}
|
30
|
+
|
31
|
+
updatePassFailState(changedRadio) {
|
32
|
+
// Find all radio buttons with the same name (same field)
|
33
|
+
const fieldName = changedRadio.name;
|
34
|
+
const allRadios = document.querySelectorAll(
|
35
|
+
`input[type="radio"][name="${fieldName}"]`,
|
36
|
+
);
|
37
|
+
|
38
|
+
// Check if N/A is selected
|
39
|
+
const naRadio = Array.from(allRadios).find((radio) => radio.value === "na");
|
40
|
+
const isNaSelected = naRadio && naRadio.checked;
|
41
|
+
|
42
|
+
allRadios.forEach((radio) => {
|
43
|
+
const label = radio.parentElement;
|
44
|
+
|
45
|
+
if (isNaSelected && radio.value !== "na") {
|
46
|
+
// N/A is selected - mute pass/fail options
|
47
|
+
label.classList.add("muted");
|
48
|
+
} else {
|
49
|
+
// N/A is not selected - remove muted class
|
50
|
+
label.classList.remove("muted");
|
51
|
+
}
|
52
|
+
});
|
53
|
+
}
|
54
|
+
|
55
|
+
cleanup() {
|
56
|
+
// Re-process any new radios that appeared
|
57
|
+
this.attachListeners();
|
58
|
+
}
|
59
|
+
}
|
60
|
+
|
61
|
+
// Create singleton instance
|
62
|
+
const naToggles = new NaToggles();
|
63
|
+
|
64
|
+
// Initialize on first load
|
65
|
+
document.addEventListener("DOMContentLoaded", () => naToggles.init());
|
66
|
+
|
67
|
+
// Reinitialize after Turbo navigation
|
68
|
+
document.addEventListener("turbo:load", () => {
|
69
|
+
naToggles.cleanup();
|
70
|
+
naToggles.init();
|
71
|
+
});
|
72
|
+
|
73
|
+
// Handle dynamically loaded content
|
74
|
+
document.addEventListener("turbo:frame-load", () => {
|
75
|
+
naToggles.attachListeners();
|
76
|
+
});
|
data/lib/chobble_forms/engine.rb
CHANGED
@@ -28,6 +28,7 @@ module ChobbleForms
|
|
28
28
|
initializer "chobble_forms.assets" do |app|
|
29
29
|
if app.config.respond_to?(:assets) && app.config.assets
|
30
30
|
app.config.assets.paths << root.join("app/assets/stylesheets")
|
31
|
+
app.config.assets.paths << root.join("app/javascript")
|
31
32
|
app.config.assets.precompile += %w[chobble_forms.css]
|
32
33
|
end
|
33
34
|
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
<%
|
2
|
+
# Generic Turbo response partial for any form field
|
3
|
+
# Required parameters:
|
4
|
+
# model: The model object
|
5
|
+
# field: The field name
|
6
|
+
# partial: The field partial to render (e.g., 'number', 'text_field', etc.)
|
7
|
+
# i18n_base: The i18n base path
|
8
|
+
# Optional parameters:
|
9
|
+
# attributes: Hash of additional attributes to pass to the field partial
|
10
|
+
|
11
|
+
model = local_assigns[:model]
|
12
|
+
field = local_assigns[:field]
|
13
|
+
partial = local_assigns[:partial]
|
14
|
+
i18n_base = local_assigns[:i18n_base]
|
15
|
+
attributes = local_assigns[:attributes] || {}
|
16
|
+
%>
|
17
|
+
|
18
|
+
<%= fields model: model, skip_default_ids: false do |form| %>
|
19
|
+
<% @_current_form = form %>
|
20
|
+
<% @_current_i18n_base = i18n_base %>
|
21
|
+
<%= render "chobble_forms/#{partial}", field: field, **attributes %>
|
22
|
+
<% end %>
|
@@ -7,13 +7,16 @@
|
|
7
7
|
# max: Maximum value
|
8
8
|
# required: Whether the integer field is required (defaults to true)
|
9
9
|
# placeholder: Placeholder text
|
10
|
+
# add_not_applicable: Whether to show a "Not Applicable" checkbox (defaults to false)
|
10
11
|
#
|
11
12
|
# This will render:
|
12
13
|
# - Integer field: field (e.g., 'trough_depth')
|
14
|
+
# - Not Applicable checkbox: (if add_not_applicable is true)
|
13
15
|
# - Comment field: field + '_comment' (e.g., 'trough_depth_comment')
|
14
16
|
|
15
17
|
integer_field = field
|
16
18
|
comment_field = "#{field}_comment".to_sym
|
19
|
+
show_na_checkbox = local_assigns.fetch(:add_not_applicable, false)
|
17
20
|
|
18
21
|
form = @_current_form
|
19
22
|
model = form.object
|
@@ -36,6 +39,14 @@
|
|
36
39
|
integer_options[:data][:min] = local_assigns[:min] if local_assigns[:min]
|
37
40
|
integer_options[:data][:max] = local_assigns[:max] if local_assigns[:max]
|
38
41
|
|
42
|
+
# Check if value is 0 to determine N/A state (not nil)
|
43
|
+
is_na = field_data[:value].present? && field_data[:value].to_i == 0
|
44
|
+
|
45
|
+
# Disable input if N/A
|
46
|
+
if is_na && show_na_checkbox
|
47
|
+
integer_options[:disabled] = true
|
48
|
+
end
|
49
|
+
|
39
50
|
comment_info = comment_field_options(
|
40
51
|
form,
|
41
52
|
comment_field,
|
@@ -43,16 +54,24 @@
|
|
43
54
|
)
|
44
55
|
%>
|
45
56
|
|
46
|
-
<div
|
57
|
+
<div
|
58
|
+
class="form-grid simple"
|
59
|
+
id="<%= integer_field %>">
|
47
60
|
<%= form.label integer_field, field_data[:field_label], class: "label" %>
|
48
|
-
|
49
|
-
|
50
|
-
|
61
|
+
<div>
|
62
|
+
<%= form.text_field integer_field, integer_options %>
|
63
|
+
<% if show_na_checkbox %>
|
64
|
+
<label class="na-label">
|
65
|
+
<input type="checkbox"<%= is_na ? " checked" : "" %>>
|
66
|
+
<%= t("shared.not_applicable") %>
|
67
|
+
</label>
|
68
|
+
<% end %>
|
69
|
+
<%= render 'chobble_forms/comment_checkbox',
|
51
70
|
comment_field: comment_field,
|
52
71
|
checkbox_id: comment_info[:checkbox_id],
|
53
72
|
textarea_id: comment_info[:options][:id],
|
54
73
|
has_comment: comment_info[:has_comment],
|
55
74
|
prefilled: comment_info[:prefilled] %>
|
56
|
-
|
75
|
+
</div>
|
57
76
|
<%= form.text_area comment_field, comment_info[:options] %>
|
58
77
|
</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.6
|
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-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -165,6 +165,9 @@ files:
|
|
165
165
|
- app/assets/stylesheets/chobble_forms/form_fields.css
|
166
166
|
- app/assets/stylesheets/chobble_forms/form_grids.css
|
167
167
|
- app/assets/stylesheets/chobble_forms/radio_buttons.css
|
168
|
+
- app/javascript/comment_toggles.js
|
169
|
+
- app/javascript/na_number_toggles.js
|
170
|
+
- app/javascript/na_toggles.js
|
168
171
|
- lib/chobble-forms.rb
|
169
172
|
- lib/chobble_forms/engine.rb
|
170
173
|
- lib/chobble_forms/field_utils.rb
|
@@ -179,6 +182,7 @@ files:
|
|
179
182
|
- views/chobble_forms/_decimal_comment.html.erb
|
180
183
|
- views/chobble_forms/_display_field.html.erb
|
181
184
|
- views/chobble_forms/_errors.html.erb
|
185
|
+
- views/chobble_forms/_field_turbo_response.html.erb
|
182
186
|
- views/chobble_forms/_field_with_link.html.erb
|
183
187
|
- views/chobble_forms/_fields.html.erb
|
184
188
|
- views/chobble_forms/_fieldset.html.erb
|