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.
Files changed (105) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/concerns/glib/json/new_dynamic_text.rb +0 -0
  3. data/app/helpers/glib/app_feature_support_helper.rb +0 -0
  4. data/app/helpers/glib/dynamic_texts_helper.rb +0 -0
  5. data/app/helpers/glib/json_ui/abstract_builder.rb +0 -8
  6. data/app/helpers/glib/json_ui/action_builder/components.rb +0 -5
  7. data/app/helpers/glib/json_ui/action_builder/dialogs.rb +0 -23
  8. data/app/helpers/glib/json_ui/action_builder/logics.rb +11 -0
  9. data/app/helpers/glib/json_ui/action_builder/popovers.rb +0 -9
  10. data/app/helpers/glib/json_ui/action_builder/sheets.rb +0 -0
  11. data/app/helpers/glib/json_ui/action_builder/windows.rb +1 -5
  12. data/app/helpers/glib/json_ui/action_builder.rb +0 -24
  13. data/app/helpers/glib/json_ui/analytics_helper.rb +0 -0
  14. data/app/helpers/glib/json_ui/builder/mouse_events.rb +0 -7
  15. data/app/helpers/glib/json_ui/default.rb +4 -4
  16. data/app/helpers/glib/json_ui/generic_builders.rb +0 -0
  17. data/app/helpers/glib/json_ui/list_builders.rb +0 -3
  18. data/app/helpers/glib/json_ui/page_helper.rb +7 -1
  19. data/app/helpers/glib/json_ui/view_builder/fields.rb +7 -38
  20. data/app/helpers/glib/json_ui/view_builder/panels.rb +1 -0
  21. data/app/helpers/glib/json_ui/view_builder.rb +3 -14
  22. data/app/models/glib/active_storage/attachment.rb +0 -0
  23. data/app/models/glib/active_storage/blob.rb +0 -0
  24. data/app/models/glib/dynamic_text_record.rb +0 -0
  25. data/app/models/glib/text.rb +0 -0
  26. data/app/policies/glib/application_policy.rb +0 -6
  27. data/app/validators/email_typo_validator.rb +0 -0
  28. data/app/validators/email_validator.rb +0 -0
  29. data/app/validators/url_validator.rb +0 -0
  30. data/app/views/json_ui/garage/actions/_components.json.jbuilder +2 -6
  31. data/app/views/json_ui/garage/actions/_dialogs.json.jbuilder +0 -14
  32. data/app/views/json_ui/garage/actions/_reload.json.jbuilder +1 -1
  33. data/app/views/json_ui/garage/actions/dialogs_oauth_post.json.jbuilder +0 -0
  34. data/app/views/json_ui/garage/actions/partial_update.json.jbuilder +1 -1
  35. data/app/views/json_ui/garage/forms/_alert_post_data.json.jbuilder +1 -3
  36. data/app/views/json_ui/garage/forms/_partial_update_execute.json.jbuilder +1 -1
  37. data/app/views/json_ui/garage/forms/_read_more_text.json.jbuilder +27 -20
  38. data/app/views/json_ui/garage/forms/conditional_value.json.jbuilder +49 -68
  39. data/app/views/json_ui/garage/forms/dirty_prompt.json.jbuilder +0 -28
  40. data/app/views/json_ui/garage/forms/dynamic_select_data.json.jbuilder +0 -0
  41. data/app/views/json_ui/garage/forms/file_upload.json.jbuilder +1 -3
  42. data/app/views/json_ui/garage/forms/generic_post.json.jbuilder +0 -0
  43. data/app/views/json_ui/garage/forms/otp_field.json.jbuilder +11 -9
  44. data/app/views/json_ui/garage/forms/rich_text_preview.json.jbuilder +0 -1
  45. data/app/views/json_ui/garage/forms/selects.json.jbuilder +17 -24
  46. data/app/views/json_ui/garage/forms/show_hide.json.jbuilder +317 -271
  47. data/app/views/json_ui/garage/forms/submission_flow.json.jbuilder +0 -0
  48. data/app/views/json_ui/garage/forms/submission_flow_post.json.jbuilder +0 -0
  49. data/app/views/json_ui/garage/forms/submission_indicator.json.jbuilder +0 -0
  50. data/app/views/json_ui/garage/forms/submission_indicator_post.json.jbuilder +0 -0
  51. data/app/views/json_ui/garage/forms/timers.json.jbuilder +0 -90
  52. data/app/views/json_ui/garage/home/blank.json.jbuilder +0 -0
  53. data/app/views/json_ui/garage/home/slow.json.jbuilder +0 -0
  54. data/app/views/json_ui/garage/lists/autoload_all.json.jbuilder +0 -0
  55. data/app/views/json_ui/garage/lists/autoload_as_needed.json.jbuilder +0 -0
  56. data/app/views/json_ui/garage/lists/chat_ui.json.jbuilder +0 -0
  57. data/app/views/json_ui/garage/lists/fab.json.jbuilder +0 -0
  58. data/app/views/json_ui/garage/notifications/action_cable.json.jbuilder +3 -3
  59. data/app/views/json_ui/garage/notifications/web_socket.json.jbuilder +0 -0
  60. data/app/views/json_ui/garage/pages/custom_style_class.json.jbuilder +0 -0
  61. data/app/views/json_ui/garage/pages/full_width.json.jbuilder +0 -0
  62. data/app/views/json_ui/garage/pages/full_width_height.json.jbuilder +0 -0
  63. data/app/views/json_ui/garage/pages/layout.json.jbuilder +0 -0
  64. data/app/views/json_ui/garage/pages/lifecycle_hooks.json.jbuilder +4 -0
  65. data/app/views/json_ui/garage/pages/loading_indicator.json.jbuilder +0 -0
  66. data/app/views/json_ui/garage/pages/nested_scroll.json.jbuilder +0 -0
  67. data/app/views/json_ui/garage/pages/redirect_onload.json.jbuilder +0 -0
  68. data/app/views/json_ui/garage/panels/_styled.json.jbuilder +0 -0
  69. data/app/views/json_ui/garage/panels/card.json.jbuilder +0 -0
  70. data/app/views/json_ui/garage/panels/custom.json.jbuilder +0 -0
  71. data/app/views/json_ui/garage/panels/outlined.json.jbuilder +0 -0
  72. data/app/views/json_ui/garage/services/dynamic_text.json.jbuilder +0 -0
  73. data/app/views/json_ui/garage/services/image.json.jbuilder +0 -0
  74. data/app/views/json_ui/garage/services/index.json.jbuilder +0 -0
  75. data/app/views/json_ui/garage/tables/_autoload_section.json.jbuilder +0 -0
  76. data/app/views/json_ui/garage/tables/autoload_all.json.jbuilder +0 -0
  77. data/app/views/json_ui/garage/tables/autoload_as_needed.json.jbuilder +0 -0
  78. data/app/views/json_ui/garage/tables/export_import.json.jbuilder +0 -0
  79. data/app/views/json_ui/garage/tables/index.json.jbuilder +0 -0
  80. data/app/views/json_ui/garage/views/calendar_data.json.jbuilder +0 -0
  81. data/app/views/json_ui/garage/views/{components_update.json.jbuilder → components_replace.json.jbuilder} +6 -6
  82. data/app/views/json_ui/garage/views/controls.json.jbuilder +0 -32
  83. data/app/views/json_ui/garage/views/links.json.jbuilder +0 -0
  84. data/app/views/json_ui/garage/views/map_data.json.jbuilder +0 -0
  85. data/app/views/json_ui/garage/views/multimedia.json.jbuilder +0 -0
  86. data/app/views/layouts/json_ui/no_custom.html.erb +0 -0
  87. data/lib/generators/glib/install_generator.rb +0 -0
  88. data/lib/generators/templates/20191017062519_create_texts.rb +0 -0
  89. data/lib/generators/templates/20191024063257_add_scope_to_texts.rb +0 -0
  90. data/lib/generators/templates/20191112095018_add_lang_to_texts.rb +0 -0
  91. data/lib/generators/templates/20191126071051_create_active_storage_tables.active_storage.rb +0 -0
  92. data/lib/generators/templates/database.yml +0 -0
  93. data/lib/generators/templates/dynamic_text.rb +0 -0
  94. data/lib/glib/dynamic_text/config.rb +0 -0
  95. data/lib/glib/dynamic_text.rb +0 -0
  96. data/lib/glib/json_crawler/action_crawler.rb +0 -0
  97. data/lib/glib/json_crawler/action_crawlers/action_http.rb +0 -0
  98. data/lib/glib/json_crawler/action_crawlers/dialogs_alert.rb +0 -0
  99. data/lib/glib/json_crawler/action_crawlers/menu.rb +0 -0
  100. data/lib/glib/json_crawler/action_crawlers/run_multiple.rb +0 -0
  101. data/lib/glib/json_crawler/action_crawlers/windows_open.rb +0 -0
  102. data/lib/glib/json_crawler/coverage.rb +0 -0
  103. data/lib/glib/value.rb +0 -0
  104. data/lib/glib/version.rb +0 -0
  105. 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 url: json_ui_garage_url(path: 'forms/generic_post'), method: 'post', padding: glib_json_padding_body, childViews: ->(form) do
7
- form.h1 text: 'Text'
8
- form.fields_password name: 'user[text1]', width: 'matchParent', label: 'Type "show"', value: ''
9
- form.label text: 'Typed', showIf: {
10
- "==": [
11
- {
12
- "var": 'user[text1]'
13
- },
14
- 'show'
15
- ]
16
- }
17
- form.label text: 'Type something', showIf: {
18
- "==": [
19
- {
20
- "var": 'user[text1]'
21
- },
22
- ''
23
- ]
24
- }
25
-
26
- form.spacer height: 20
27
- form.h1 text: 'Textarea'
28
- form.fields_textarea name: 'user[textarea1]', width: 'matchParent', label: 'Type "show"'
29
- form.label text: 'Typed', showIf: {
30
- "==": [
31
- {
32
- "var": 'user[textarea1]'
33
- },
34
- 'show'
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
- form.spacer height: 20
39
- form.h1 text: 'Check'
40
- form.fields_check name: 'user[check1]', checkValue: 'on', uncheckValue: 'off', label: 'Show text', value: 'on'
41
- form.spacer height: 10
42
- form.label text: 'Checked', showIf: {
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
- form.spacer height: 6
52
- form.fields_check name: 'user[check2]', checkValue: 'on', label: 'Show text', uncheckValue: 'off'
53
- form.spacer height: 10
54
- form.label text: 'Both Checked', showIf: {
55
- "and": [
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
- form.spacer height: 20
76
- form.h1 text: 'Radio Group'
77
- form.fields_radioGroup name: 'user[radio1]', value: 'show', childViews: ->(group) do
78
- group.fields_radio value: 'show', label: 'Show'
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
- form.spacer height: 20
101
- form.h1 text: 'Select'
102
- # options = ['', 'show', 'hide']
103
- options = {
104
- '' => '<EMPTY>',
105
- 'show' => 'Show',
106
- 'hide' => 'Hide',
107
- nil => '<NULL>'
108
- }.map { |k, v| { value: k, text: v } }
109
- form.fields_select name: 'user[select1]', width: 'matchParent', label: 'Select "show"', options: options, value: ''
110
- form.label text: 'Selected', showIf: {
111
- "==": [
112
- {
113
- "var": 'user[select1]'
114
- },
115
- 'show'
116
- ]
117
- }
118
- form.label text: 'Unspecified', showIf: {
119
- "==": [
120
- {
121
- "var": 'user[select1]'
122
- },
123
- ''
124
- ]
125
- }
126
- form.label text: 'Null', showIf: {
127
- "==": [
128
- {
129
- "var": 'user[select1]'
130
- },
131
- nil
132
- ]
133
- }
134
- form.label text: 'Any', showIf: {
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
- form.spacer height: 20
144
- form.h1 text: 'Combined conditions'
145
- form.label text: 'Select the same option on both the radio and select fields above'
146
- form.spacer height: 10
147
- form.h3 text: 'Same!', showIf: {
148
- "==": [
149
- {
150
- "var": 'user[radio1]'
151
- },
152
- {
153
- "var": 'user[select1]'
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
- form.spacer height: 20
159
- form.h1 text: 'Show/hide another field'
160
- form.spacer height: 10
161
- form.fields_check name: 'user[check3]', checkValue: 'on', label: 'Show field'
162
- form.spacer height: 10
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
- form.spacer height: 20
173
- form.h1 text: 'Show more/less text'
174
- form.spacer height: 10
175
- render "#{@path_prefix}/forms/read_more_text",
176
- panel: form,
177
- min_chars: 300,
178
- max_lines: 2,
179
- 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."
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
- form.spacer height: 10
182
- render "#{@path_prefix}/forms/read_more_text",
183
- panel: form,
184
- min_chars: 300,
185
- max_lines: 2,
186
- 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."
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
- form.spacer height: 20
189
- form.h1 text: 'Show/hide conditional banner'
190
- form.spacer height: 10
191
- form.label text: 'The following banner does not appear because its menu is empty'
192
- form.spacer height: 8
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
- render "#{@path_prefix}/forms/conditional_banner", panel: form, message: 'Admin menu 1' do |menu, state|
195
- # This banner will not show because it does not have any content
196
- # state[:has_content] = false
197
- end
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
- form.spacer height: 10
200
- form.label text: 'The following banner appears because it has at least one menu item'
201
- form.spacer height: 8
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
- render "#{@path_prefix}/forms/conditional_banner", panel: form, message: 'Admin menu 2' do |menu, state|
204
- state[:has_content] = true
227
+ render "#{@path_prefix}/forms/conditional_banner", panel: form, message: 'Admin menu 2' do |menu, state|
228
+ state[:has_content] = true
205
229
 
206
- menu.button styleClass: 'link', text: 'Add', onClick: ->(action) do
207
- action.dialogs_alert message: 'Do something'
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
- form.spacer height: 20
212
- form.h1 text: 'Show/hide without send data'
213
- form.fields_check name: 'user[loadif1]', label: 'Show one field', checkValue: 'true', uncheckValue: 'false', value: 'true'
214
- form.spacer height: 4
215
- form.fields_text \
216
- name: 'user[loadif_target1]', value: 'This field should not be submitted when it is hidden',
217
- width: 'matchParent',
218
- loadIf: {
219
- "==": [
220
- {
221
- "var": 'user[loadif1]'
222
- },
223
- 'true'
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
- form.panels_responsive \
248
- width: 'matchParent',
249
- loadIf: {
250
- "==": [
251
- {
252
- "var": 'user[loadif2]'
253
- },
254
- 'false'
255
- ]
256
- },
257
- childViews: ->(res) do
258
- form.fields_richText name: 'user[loadIf_target4]', width: 'matchParent', value: 'Value 3'
259
- form.spacer height: 4
260
- form.fields_radioGroup name: 'user[loadIf_target5]', width: 'matchParent', value: 'choice_1', childViews: ->(group) do
261
- group.fields_radio label: 'Choice 1', value: 'choice_1'
262
- group.fields_radio label: 'Choice 2', value: 'choice_2'
263
- group.fields_radio label: 'Choice 3', value: 'choice_3'
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
- form.spacer height: 8
269
- form.fields_check name: 'user[loadif3]', label: 'Show target nested panels', checkValue: 'true', uncheckValue: 'false', value: 'false'
270
- form.panels_responsive \
271
- loadIf: { "==": [{ "var": 'user[loadif3]' }, 'true'] },
272
- styleClass: 'border-2',
273
- width: 'matchParent',
274
- padding: { top: 8, right: 8, bottom: 8, left: 8 },
275
- childViews: ->(res) do
276
- res.panels_responsive \
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
- form.spacer height: 8
327
+ # form.spacer height: 8
286
328
 
287
- if !Rails.env.test?
288
- form.button text: 'Reload component', onClick: ->(action) { action.windows_reload url: json_ui_garage_current_url({ key: SecureRandom.hex(3) }) }
289
- end
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
- if !params[:key]
292
- form.fields_check name: 'user[loadif4]', label: 'Show reload component 1', checkValue: 'true', uncheckValue: 'false', value: 'false'
293
- form.fields_text name: 'user[loadif_target7]', width: 'matchParent', value: 'Value 5', loadIf: { "==": [{ "var": 'user[loadif4]' }, 'true'] }
294
- else
295
- form.fields_check name: 'user[loadif5]', label: 'Show reload component 2', checkValue: 'true', uncheckValue: 'false', value: 'false'
296
- form.fields_text name: 'user[loadif_target8]', width: 'matchParent', value: params[:key], loadIf: { "==": [{ "var": 'user[loadif5]' }, 'true'] }
297
- end
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
- form.spacer height: 20
300
- form.fields_submit text: 'Submit'
345
+ form.spacer height: 20
346
+ form.fields_submit text: 'Submit'
301
347
 
302
- form.spacer height: 40
303
- end
348
+ form.spacer height: 40
349
+ end