glib-web 3.28.0 → 4.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/concerns/glib/json/new_dynamic_text.rb +0 -0
- data/app/helpers/glib/app_feature_support_helper.rb +0 -0
- data/app/helpers/glib/dynamic_texts_helper.rb +0 -0
- data/app/helpers/glib/json_ui/abstract_builder.rb +0 -8
- data/app/helpers/glib/json_ui/action_builder/components.rb +0 -5
- data/app/helpers/glib/json_ui/action_builder/dialogs.rb +0 -23
- data/app/helpers/glib/json_ui/action_builder/logics.rb +11 -0
- data/app/helpers/glib/json_ui/action_builder/popovers.rb +0 -9
- data/app/helpers/glib/json_ui/action_builder/sheets.rb +0 -0
- data/app/helpers/glib/json_ui/action_builder/windows.rb +1 -5
- data/app/helpers/glib/json_ui/action_builder.rb +0 -24
- data/app/helpers/glib/json_ui/analytics_helper.rb +0 -0
- data/app/helpers/glib/json_ui/builder/mouse_events.rb +0 -7
- data/app/helpers/glib/json_ui/default.rb +4 -4
- data/app/helpers/glib/json_ui/generic_builders.rb +0 -0
- data/app/helpers/glib/json_ui/list_builders.rb +0 -3
- data/app/helpers/glib/json_ui/page_helper.rb +7 -1
- data/app/helpers/glib/json_ui/view_builder/fields.rb +7 -38
- data/app/helpers/glib/json_ui/view_builder/panels.rb +1 -0
- data/app/helpers/glib/json_ui/view_builder.rb +3 -14
- data/app/models/glib/active_storage/attachment.rb +0 -0
- data/app/models/glib/active_storage/blob.rb +0 -0
- data/app/models/glib/dynamic_text_record.rb +0 -0
- data/app/models/glib/text.rb +0 -0
- data/app/policies/glib/application_policy.rb +0 -6
- data/app/validators/email_typo_validator.rb +0 -0
- data/app/validators/email_validator.rb +0 -0
- data/app/validators/url_validator.rb +0 -0
- data/app/views/json_ui/garage/actions/_components.json.jbuilder +2 -6
- data/app/views/json_ui/garage/actions/_dialogs.json.jbuilder +0 -14
- data/app/views/json_ui/garage/actions/_reload.json.jbuilder +1 -1
- data/app/views/json_ui/garage/actions/dialogs_oauth_post.json.jbuilder +0 -0
- data/app/views/json_ui/garage/actions/partial_update.json.jbuilder +1 -1
- data/app/views/json_ui/garage/forms/_alert_post_data.json.jbuilder +1 -3
- data/app/views/json_ui/garage/forms/_partial_update_execute.json.jbuilder +1 -1
- data/app/views/json_ui/garage/forms/_read_more_text.json.jbuilder +27 -20
- data/app/views/json_ui/garage/forms/conditional_value.json.jbuilder +49 -68
- data/app/views/json_ui/garage/forms/dirty_prompt.json.jbuilder +0 -28
- data/app/views/json_ui/garage/forms/dynamic_select_data.json.jbuilder +0 -0
- data/app/views/json_ui/garage/forms/file_upload.json.jbuilder +1 -3
- data/app/views/json_ui/garage/forms/generic_post.json.jbuilder +0 -0
- data/app/views/json_ui/garage/forms/otp_field.json.jbuilder +11 -9
- data/app/views/json_ui/garage/forms/rich_text_preview.json.jbuilder +0 -1
- data/app/views/json_ui/garage/forms/selects.json.jbuilder +17 -24
- data/app/views/json_ui/garage/forms/show_hide.json.jbuilder +317 -271
- data/app/views/json_ui/garage/forms/submission_flow.json.jbuilder +0 -0
- data/app/views/json_ui/garage/forms/submission_flow_post.json.jbuilder +0 -0
- data/app/views/json_ui/garage/forms/submission_indicator.json.jbuilder +0 -0
- data/app/views/json_ui/garage/forms/submission_indicator_post.json.jbuilder +0 -0
- data/app/views/json_ui/garage/forms/timers.json.jbuilder +0 -90
- data/app/views/json_ui/garage/home/blank.json.jbuilder +0 -0
- data/app/views/json_ui/garage/home/slow.json.jbuilder +0 -0
- data/app/views/json_ui/garage/lists/autoload_all.json.jbuilder +0 -0
- data/app/views/json_ui/garage/lists/autoload_as_needed.json.jbuilder +0 -0
- data/app/views/json_ui/garage/lists/chat_ui.json.jbuilder +0 -0
- data/app/views/json_ui/garage/lists/fab.json.jbuilder +0 -0
- data/app/views/json_ui/garage/notifications/action_cable.json.jbuilder +3 -3
- data/app/views/json_ui/garage/notifications/web_socket.json.jbuilder +0 -0
- data/app/views/json_ui/garage/pages/custom_style_class.json.jbuilder +0 -0
- data/app/views/json_ui/garage/pages/full_width.json.jbuilder +0 -0
- data/app/views/json_ui/garage/pages/full_width_height.json.jbuilder +0 -0
- data/app/views/json_ui/garage/pages/layout.json.jbuilder +0 -0
- data/app/views/json_ui/garage/pages/lifecycle_hooks.json.jbuilder +4 -0
- data/app/views/json_ui/garage/pages/loading_indicator.json.jbuilder +0 -0
- data/app/views/json_ui/garage/pages/nested_scroll.json.jbuilder +0 -0
- data/app/views/json_ui/garage/pages/redirect_onload.json.jbuilder +0 -0
- data/app/views/json_ui/garage/panels/_styled.json.jbuilder +0 -0
- data/app/views/json_ui/garage/panels/card.json.jbuilder +0 -0
- data/app/views/json_ui/garage/panels/custom.json.jbuilder +0 -0
- data/app/views/json_ui/garage/panels/outlined.json.jbuilder +0 -0
- data/app/views/json_ui/garage/services/dynamic_text.json.jbuilder +0 -0
- data/app/views/json_ui/garage/services/image.json.jbuilder +0 -0
- data/app/views/json_ui/garage/services/index.json.jbuilder +0 -0
- data/app/views/json_ui/garage/tables/_autoload_section.json.jbuilder +0 -0
- data/app/views/json_ui/garage/tables/autoload_all.json.jbuilder +0 -0
- data/app/views/json_ui/garage/tables/autoload_as_needed.json.jbuilder +0 -0
- data/app/views/json_ui/garage/tables/export_import.json.jbuilder +0 -0
- data/app/views/json_ui/garage/tables/index.json.jbuilder +0 -0
- data/app/views/json_ui/garage/views/calendar_data.json.jbuilder +0 -0
- data/app/views/json_ui/garage/views/{components_update.json.jbuilder → components_replace.json.jbuilder} +6 -6
- data/app/views/json_ui/garage/views/controls.json.jbuilder +0 -32
- data/app/views/json_ui/garage/views/links.json.jbuilder +0 -0
- data/app/views/json_ui/garage/views/map_data.json.jbuilder +0 -0
- data/app/views/json_ui/garage/views/multimedia.json.jbuilder +0 -0
- data/app/views/layouts/json_ui/no_custom.html.erb +0 -0
- data/lib/generators/glib/install_generator.rb +0 -0
- data/lib/generators/templates/20191017062519_create_texts.rb +0 -0
- data/lib/generators/templates/20191024063257_add_scope_to_texts.rb +0 -0
- data/lib/generators/templates/20191112095018_add_lang_to_texts.rb +0 -0
- data/lib/generators/templates/20191126071051_create_active_storage_tables.active_storage.rb +0 -0
- data/lib/generators/templates/database.yml +0 -0
- data/lib/generators/templates/dynamic_text.rb +0 -0
- data/lib/glib/dynamic_text/config.rb +0 -0
- data/lib/glib/dynamic_text.rb +0 -0
- data/lib/glib/json_crawler/action_crawler.rb +0 -0
- data/lib/glib/json_crawler/action_crawlers/action_http.rb +0 -0
- data/lib/glib/json_crawler/action_crawlers/dialogs_alert.rb +0 -0
- data/lib/glib/json_crawler/action_crawlers/menu.rb +0 -0
- data/lib/glib/json_crawler/action_crawlers/run_multiple.rb +0 -0
- data/lib/glib/json_crawler/action_crawlers/windows_open.rb +0 -0
- data/lib/glib/json_crawler/coverage.rb +0 -0
- data/lib/glib/value.rb +0 -0
- data/lib/glib/version.rb +0 -0
- metadata +4 -4
@@ -3,301 +3,347 @@ json.title 'Forms'
|
|
3
3
|
page = json_ui_page json
|
4
4
|
render "#{@path_prefix}/nav_menu", json: json, page: page
|
5
5
|
|
6
|
-
page.form
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
}
|
34
|
-
'
|
35
|
-
|
36
|
-
|
6
|
+
page.form \
|
7
|
+
url: json_ui_garage_url(path: 'forms/generic_post'),
|
8
|
+
method: 'post',
|
9
|
+
padding: glib_json_padding_body,
|
10
|
+
onChangeAndLoad: ->(action) do
|
11
|
+
action.runMultiple childActions: ->(saction) do
|
12
|
+
saction.logics_set targetId: 'label5', conditionalData: {
|
13
|
+
displayed: {
|
14
|
+
"and": [
|
15
|
+
{
|
16
|
+
"==": [
|
17
|
+
{
|
18
|
+
"var": 'user[check1]'
|
19
|
+
},
|
20
|
+
'on'
|
21
|
+
],
|
22
|
+
},
|
23
|
+
{
|
24
|
+
"==": [
|
25
|
+
{
|
26
|
+
"var": 'user[check2]'
|
27
|
+
},
|
28
|
+
'on'
|
29
|
+
]
|
30
|
+
}
|
31
|
+
]
|
32
|
+
}
|
33
|
+
}
|
34
|
+
saction.logics_set targetId: 'label12', conditionalData: {
|
35
|
+
displayed: {
|
36
|
+
"==": [
|
37
|
+
{
|
38
|
+
"var": 'user[radio1]'
|
39
|
+
},
|
40
|
+
{
|
41
|
+
"var": 'user[select1]'
|
42
|
+
}
|
43
|
+
]
|
44
|
+
}
|
45
|
+
}
|
46
|
+
end
|
47
|
+
end,
|
48
|
+
childViews: ->(form) do
|
49
|
+
form.h1 text: 'Text'
|
50
|
+
form.fields_password name: 'user[text1]', width: 'matchParent', label: 'Type "show"', value: '', onChangeAndLoad: ->(action) do
|
51
|
+
action.runMultiple childActions: ->(saction) do
|
52
|
+
saction.logics_set targetId: 'label1', conditionalData: { displayed: { "==": [{ "var": 'user[text1]' }, 'show'] } }
|
53
|
+
saction.logics_set targetId: 'label2', conditionalData: { displayed: { "==": [{ "var": 'user[text1]' }, ''] } }
|
54
|
+
end
|
55
|
+
end
|
56
|
+
form.label id: 'label1', text: 'Typed'
|
57
|
+
form.label id: 'label2', text: 'Type something'
|
37
58
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
{
|
45
|
-
"var": 'user[check1]'
|
46
|
-
},
|
47
|
-
'on'
|
48
|
-
]
|
49
|
-
}
|
59
|
+
form.spacer height: 20
|
60
|
+
form.h1 text: 'Textarea'
|
61
|
+
form.fields_textarea name: 'user[textarea1]', width: 'matchParent', label: 'Type "show"', onChangeAndLoad: ->(action) do
|
62
|
+
action.logics_set targetId: 'label3', conditionalData: { displayed: { "==": [{ "var": 'user[textarea1]' }, 'show'] } }
|
63
|
+
end
|
64
|
+
form.label id: 'label3', text: 'Typed'
|
50
65
|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
{
|
59
|
-
"var": 'user[check1]'
|
60
|
-
},
|
61
|
-
'on'
|
62
|
-
],
|
63
|
-
},
|
64
|
-
{
|
65
|
-
"==": [
|
66
|
-
{
|
67
|
-
"var": 'user[check2]'
|
68
|
-
},
|
69
|
-
'on'
|
70
|
-
]
|
71
|
-
}
|
72
|
-
]
|
73
|
-
}
|
66
|
+
form.spacer height: 20
|
67
|
+
form.h1 text: 'Check'
|
68
|
+
form.fields_check name: 'user[check1]', checkValue: 'on', uncheckValue: 'off', label: 'Show text', value: 'on', onChangeAndLoad: ->(action) do
|
69
|
+
action.logics_set targetId: 'label4', conditionalData: { displayed: { "==": [{ "var": 'user[check1]' }, 'on'] } }
|
70
|
+
end
|
71
|
+
form.spacer height: 10
|
72
|
+
form.label id: 'label4', text: 'Checked'
|
74
73
|
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
group.fields_radio value: 'hide', label: 'Hide'
|
80
|
-
group.fields_radio value: '', label: 'Empty'
|
81
|
-
end
|
82
|
-
form.spacer height: 10
|
83
|
-
form.label text: 'Chosen', showIf: {
|
84
|
-
"==": [
|
85
|
-
{
|
86
|
-
"var": 'user[radio1]'
|
87
|
-
},
|
88
|
-
'show'
|
89
|
-
]
|
90
|
-
}
|
91
|
-
form.label text: 'Unspecified', showIf: {
|
92
|
-
"==": [
|
93
|
-
{
|
94
|
-
"var": 'user[radio1]'
|
95
|
-
},
|
96
|
-
''
|
97
|
-
]
|
98
|
-
}
|
74
|
+
form.spacer height: 6
|
75
|
+
form.fields_check name: 'user[check2]', checkValue: 'on', label: 'Show text', uncheckValue: 'off'
|
76
|
+
form.spacer height: 10
|
77
|
+
form.label id: 'label5', text: 'Both Checked'
|
99
78
|
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
"var": 'user[select1]'
|
138
|
-
},
|
139
|
-
nil
|
140
|
-
]
|
141
|
-
}
|
79
|
+
form.spacer height: 20
|
80
|
+
form.h1 text: 'Radio Group'
|
81
|
+
form.fields_radioGroup \
|
82
|
+
name: 'user[radio1]',
|
83
|
+
value: 'show',
|
84
|
+
onChangeAndLoad: ->(action) do
|
85
|
+
action.runMultiple childActions: ->(saction) do
|
86
|
+
saction.logics_set targetId: 'label6', conditionalData: {
|
87
|
+
displayed: {
|
88
|
+
"==": [
|
89
|
+
{
|
90
|
+
"var": 'user[radio1]'
|
91
|
+
},
|
92
|
+
'show'
|
93
|
+
]
|
94
|
+
}
|
95
|
+
}
|
96
|
+
saction.logics_set targetId: 'label7', conditionalData: {
|
97
|
+
displayed: {
|
98
|
+
"==": [
|
99
|
+
{
|
100
|
+
"var": 'user[radio1]'
|
101
|
+
},
|
102
|
+
''
|
103
|
+
]
|
104
|
+
}
|
105
|
+
}
|
106
|
+
end
|
107
|
+
end,
|
108
|
+
childViews: ->(group) do
|
109
|
+
group.fields_radio value: 'show', label: 'Show'
|
110
|
+
group.fields_radio value: 'hide', label: 'Hide'
|
111
|
+
group.fields_radio value: '', label: 'Empty'
|
112
|
+
end
|
113
|
+
form.spacer height: 10
|
114
|
+
form.label id: 'label6', text: 'Chosen'
|
115
|
+
form.label id: 'label7', text: 'Unspecified'
|
142
116
|
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
117
|
+
form.spacer height: 20
|
118
|
+
form.h1 text: 'Select'
|
119
|
+
# options = ['', 'show', 'hide']
|
120
|
+
options = {
|
121
|
+
'' => '<EMPTY>',
|
122
|
+
'show' => 'Show',
|
123
|
+
'hide' => 'Hide',
|
124
|
+
nil => '<NULL>'
|
125
|
+
}.map { |k, v| { value: k, text: v } }
|
126
|
+
form.fields_select name: 'user[select1]', width: 'matchParent', label: 'Select "show"', options: options, value: '', onChangeAndLoad: ->(action) do
|
127
|
+
action.runMultiple childActions: ->(saction) do
|
128
|
+
saction.logics_set targetId: 'label8', conditionalData: {
|
129
|
+
displayed: {
|
130
|
+
"==": [
|
131
|
+
{
|
132
|
+
"var": 'user[select1]'
|
133
|
+
},
|
134
|
+
'show'
|
135
|
+
]
|
136
|
+
}
|
137
|
+
}
|
138
|
+
saction.logics_set targetId: 'label9', conditionalData: {
|
139
|
+
displayed: {
|
140
|
+
"==": [
|
141
|
+
{
|
142
|
+
"var": 'user[select1]'
|
143
|
+
},
|
144
|
+
''
|
145
|
+
]
|
146
|
+
}
|
147
|
+
}
|
148
|
+
saction.logics_set targetId: 'label10', conditionalData: {
|
149
|
+
displayed: {
|
150
|
+
"==": [
|
151
|
+
{
|
152
|
+
"var": 'user[select1]'
|
153
|
+
},
|
154
|
+
nil
|
155
|
+
]
|
156
|
+
}
|
157
|
+
}
|
158
|
+
saction.logics_set targetId: 'label11', conditionalData: {
|
159
|
+
displayed: {
|
160
|
+
"!=": [
|
161
|
+
{
|
162
|
+
"var": 'user[select1]'
|
163
|
+
},
|
164
|
+
nil
|
165
|
+
]
|
166
|
+
}
|
167
|
+
}
|
168
|
+
end
|
169
|
+
end
|
170
|
+
form.label id: 'label8', text: 'Selected'
|
171
|
+
form.label id: 'label9', text: 'Unspecified'
|
172
|
+
form.label id: 'label10', text: 'Null'
|
173
|
+
form.label id: 'label11', text: 'Any'
|
157
174
|
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
form.fields_text width: 'matchParent', label: 'Comment (optional)', name: 'user[comment]', value: 'This field should be submitted even when it is hidden', showIf: {
|
164
|
-
"==": [
|
165
|
-
{
|
166
|
-
"var": 'user[check3]'
|
167
|
-
},
|
168
|
-
'on'
|
169
|
-
]
|
170
|
-
}
|
175
|
+
form.spacer height: 20
|
176
|
+
form.h1 text: 'Combined conditions'
|
177
|
+
form.label text: 'Select the same option on both the radio and select fields above'
|
178
|
+
form.spacer height: 10
|
179
|
+
form.h3 id: 'label12', text: 'Same!'
|
171
180
|
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
181
|
+
form.spacer height: 20
|
182
|
+
form.h1 text: 'Show/hide another field'
|
183
|
+
form.spacer height: 10
|
184
|
+
form.fields_check name: 'user[check3]', checkValue: 'on', label: 'Show field', onChangeAndLoad: ->(action) do
|
185
|
+
action.logics_set \
|
186
|
+
targetId: 'field1',
|
187
|
+
conditionalData: {
|
188
|
+
displayed: {
|
189
|
+
"==": [
|
190
|
+
{
|
191
|
+
"var": 'user[check3]'
|
192
|
+
},
|
193
|
+
'on'
|
194
|
+
]
|
195
|
+
}
|
196
|
+
},
|
197
|
+
data: { submitWhenNotDisplayed: true }
|
198
|
+
end
|
199
|
+
form.spacer height: 10
|
200
|
+
form.fields_text id: 'field1', width: 'matchParent', label: 'Comment (optional)', name: 'user[comment]', value: 'This field should be submitted even when it is hidden'
|
180
201
|
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
202
|
+
form.spacer height: 20
|
203
|
+
form.h1 text: 'Show more/less text'
|
204
|
+
form.spacer height: 10
|
205
|
+
render "#{@path_prefix}/forms/read_more_text",
|
206
|
+
id: 'readmore1',
|
207
|
+
panel: form,
|
208
|
+
min_chars: 300,
|
209
|
+
max_lines: 2,
|
210
|
+
text: "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum."
|
187
211
|
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
212
|
+
form.spacer height: 20
|
213
|
+
form.h1 text: 'Show/hide conditional banner'
|
214
|
+
form.spacer height: 10
|
215
|
+
form.label text: 'The following banner does not appear because its menu is empty'
|
216
|
+
form.spacer height: 8
|
193
217
|
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
218
|
+
render "#{@path_prefix}/forms/conditional_banner", panel: form, message: 'Admin menu 1' do |menu, state|
|
219
|
+
# This banner will not show because it does not have any content
|
220
|
+
state[:has_content] = false
|
221
|
+
end
|
198
222
|
|
199
|
-
|
200
|
-
|
201
|
-
|
223
|
+
form.spacer height: 10
|
224
|
+
form.label text: 'The following banner appears because it has at least one menu item'
|
225
|
+
form.spacer height: 8
|
202
226
|
|
203
|
-
|
204
|
-
|
227
|
+
render "#{@path_prefix}/forms/conditional_banner", panel: form, message: 'Admin menu 2' do |menu, state|
|
228
|
+
state[:has_content] = true
|
205
229
|
|
206
|
-
|
207
|
-
|
230
|
+
menu.button styleClass: 'link', text: 'Add', onClick: ->(action) do
|
231
|
+
action.dialogs_alert message: 'Do something'
|
232
|
+
end
|
208
233
|
end
|
209
|
-
end
|
210
234
|
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
form.spacer height: 8
|
228
|
-
form.fields_check name: 'user[loadif2]', label: 'Show & hide many field', checkValue: 'true', uncheckValue: 'false', value: 'false'
|
229
|
-
form.spacer height: 4
|
230
|
-
form.panels_responsive \
|
231
|
-
width: 'matchParent',
|
232
|
-
loadIf: {
|
233
|
-
"==": [
|
234
|
-
{
|
235
|
-
"var": 'user[loadif2]'
|
236
|
-
},
|
237
|
-
'true'
|
238
|
-
]
|
239
|
-
},
|
240
|
-
childViews: ->(res) do
|
241
|
-
form.fields_text name: 'user[loadif_target2]', width: 'matchParent', value: 'Value 1'
|
242
|
-
form.spacer height: 4
|
243
|
-
form.fields_textarea name: 'user[loadif_target3]', width: 'matchParent', value: 'Value 2'
|
244
|
-
form.spacer height: 4
|
235
|
+
form.spacer height: 20
|
236
|
+
form.h1 text: 'Show/hide without send data'
|
237
|
+
form.fields_check name: 'user[loadif1]', label: 'Show one field', checkValue: 'true', uncheckValue: 'false', value: 'true', onChangeAndLoad: ->(action) do
|
238
|
+
action.logics_set \
|
239
|
+
targetId: 'field2',
|
240
|
+
conditionalData: {
|
241
|
+
displayed: {
|
242
|
+
"==": [
|
243
|
+
{
|
244
|
+
"var": 'user[loadif1]'
|
245
|
+
},
|
246
|
+
'true'
|
247
|
+
]
|
248
|
+
}
|
249
|
+
}
|
245
250
|
end
|
251
|
+
form.spacer height: 4
|
252
|
+
form.fields_text \
|
253
|
+
id: 'field2',
|
254
|
+
name: 'user[loadif_target1]',
|
255
|
+
value: 'This field should not be submitted when it is hidden',
|
256
|
+
width: 'matchParent'
|
246
257
|
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
{
|
252
|
-
"
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
258
|
+
form.spacer height: 8
|
259
|
+
form.fields_check name: 'user[loadif2]', label: 'Show & hide many field', checkValue: 'true', uncheckValue: 'false', value: 'false', onChangeAndLoad: ->(action) do
|
260
|
+
action.runMultiple childActions: ->(saction) do
|
261
|
+
saction.logics_set targetId: 'panel1', conditionalData: {
|
262
|
+
displayed: {
|
263
|
+
"==": [
|
264
|
+
{
|
265
|
+
"var": 'user[loadif2]'
|
266
|
+
},
|
267
|
+
'true'
|
268
|
+
]
|
269
|
+
}
|
270
|
+
}
|
271
|
+
saction.logics_set targetId: 'panel2', conditionalData: {
|
272
|
+
displayed: {
|
273
|
+
"==": [
|
274
|
+
{
|
275
|
+
"var": 'user[loadif2]'
|
276
|
+
},
|
277
|
+
'false'
|
278
|
+
]
|
279
|
+
}
|
280
|
+
}
|
264
281
|
end
|
265
282
|
end
|
283
|
+
form.spacer height: 4
|
284
|
+
form.panels_responsive \
|
285
|
+
id: 'panel1',
|
286
|
+
width: 'matchParent',
|
287
|
+
childViews: ->(res) do
|
288
|
+
form.fields_text name: 'user[loadif_target2]', width: 'matchParent', value: 'Value 1'
|
289
|
+
form.spacer height: 4
|
290
|
+
form.fields_textarea name: 'user[loadif_target3]', width: 'matchParent', value: 'Value 2'
|
291
|
+
form.spacer height: 4
|
292
|
+
end
|
266
293
|
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
styleClass: 'border-2',
|
278
|
-
width: 'matchParent',
|
279
|
-
padding: { top: 8, right: 8, bottom: 8, left: 8 },
|
280
|
-
childViews: ->(sres) do
|
281
|
-
sres.fields_text name: 'user[loadif_target6]', width: 'matchParent', value: 'Value 4'
|
294
|
+
form.panels_responsive \
|
295
|
+
id: 'panel2',
|
296
|
+
width: 'matchParent',
|
297
|
+
childViews: ->(res) do
|
298
|
+
form.fields_richText name: 'user[loadIf_target4]', width: 'matchParent', value: 'Value 3'
|
299
|
+
form.spacer height: 4
|
300
|
+
form.fields_radioGroup name: 'user[loadIf_target5]', width: 'matchParent', value: 'choice_1', childViews: ->(group) do
|
301
|
+
group.fields_radio label: 'Choice 1', value: 'choice_1'
|
302
|
+
group.fields_radio label: 'Choice 2', value: 'choice_2'
|
303
|
+
group.fields_radio label: 'Choice 3', value: 'choice_3'
|
282
304
|
end
|
305
|
+
end
|
306
|
+
|
307
|
+
|
308
|
+
form.spacer height: 8
|
309
|
+
form.fields_check name: 'user[loadif3]', label: 'Show target nested panels', checkValue: 'true', uncheckValue: 'false', value: 'false', onChangeAndLoad: ->(action) do
|
310
|
+
action.logics_set targetId: 'panel3', conditionalData: { displayed: { "==": [{ "var": 'user[loadif3]' }, 'true'] } }
|
283
311
|
end
|
312
|
+
form.panels_responsive \
|
313
|
+
id: 'panel3',
|
314
|
+
styleClass: 'border-2',
|
315
|
+
width: 'matchParent',
|
316
|
+
padding: { top: 8, right: 8, bottom: 8, left: 8 },
|
317
|
+
childViews: ->(res) do
|
318
|
+
res.panels_responsive \
|
319
|
+
styleClass: 'border-2',
|
320
|
+
width: 'matchParent',
|
321
|
+
padding: { top: 8, right: 8, bottom: 8, left: 8 },
|
322
|
+
childViews: ->(sres) do
|
323
|
+
sres.fields_text name: 'user[loadif_target6]', width: 'matchParent', value: 'Value 4'
|
324
|
+
end
|
325
|
+
end
|
284
326
|
|
285
|
-
|
327
|
+
# form.spacer height: 8
|
286
328
|
|
287
|
-
|
288
|
-
|
289
|
-
|
329
|
+
if !Rails.env.test?
|
330
|
+
form.button text: 'Reload component', onClick: ->(action) { action.windows_reload url: json_ui_garage_current_url({ key: SecureRandom.hex(3) }) }
|
331
|
+
end
|
290
332
|
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
333
|
+
if !params[:key]
|
334
|
+
form.fields_check name: 'user[loadif4]', label: 'Show reload component 1', checkValue: 'true', uncheckValue: 'false', value: 'false', onChangeAndLoad: ->(action) do
|
335
|
+
action.logics_set targetId: 'field3', conditionalData: { displayed: { "==": [{ "var": 'user[loadif4]' }, 'true'] } }
|
336
|
+
end
|
337
|
+
form.fields_text id: 'field3', name: 'user[loadif_target7]', width: 'matchParent', value: 'Value 5'
|
338
|
+
else
|
339
|
+
form.fields_check name: 'user[loadif5]', label: 'Show reload component 2', checkValue: 'true', uncheckValue: 'false', value: 'false', onChangeAndLoad: ->(action) do
|
340
|
+
action.logics_set targetId: 'field4', conditionalData: { displayed: { "==": [{ "var": 'user[loadif5]' }, 'true'] } }
|
341
|
+
end
|
342
|
+
form.fields_text id: 'field4', name: 'user[loadif_target8]', width: 'matchParent', value: params[:key]
|
343
|
+
end
|
298
344
|
|
299
|
-
|
300
|
-
|
345
|
+
form.spacer height: 20
|
346
|
+
form.fields_submit text: 'Submit'
|
301
347
|
|
302
|
-
|
303
|
-
end
|
348
|
+
form.spacer height: 40
|
349
|
+
end
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|