glib-web 4.44.3 → 5.0.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.
Files changed (28) hide show
  1. checksums.yaml +4 -4
  2. data/app/helpers/glib/json_ui/abstract_builder.rb +1 -1
  3. data/app/helpers/glib/json_ui/action_builder/browsers.rb +1 -3
  4. data/app/helpers/glib/json_ui/list_builders.rb +1 -1
  5. data/app/helpers/glib/json_ui/view_builder/fields.rb +0 -53
  6. data/app/views/json_ui/garage/forms/file_upload.json.jbuilder +0 -65
  7. data/app/views/json_ui/garage/test_page/_header.json.jbuilder +9 -2
  8. data/app/views/json_ui/garage/test_page/auth.json.jbuilder +37 -0
  9. data/app/views/json_ui/garage/test_page/browsers.json.jbuilder +1 -0
  10. data/app/views/json_ui/garage/test_page/dialog.json.jbuilder +123 -26
  11. data/app/views/json_ui/garage/test_page/dirty_state.json.jbuilder +0 -5
  12. data/app/views/json_ui/garage/test_page/fields_creditCard.json.jbuilder +118 -0
  13. data/app/views/json_ui/garage/test_page/fields_date_time.json.jbuilder +213 -0
  14. data/app/views/json_ui/garage/test_page/fields_location.json.jbuilder +151 -0
  15. data/app/views/json_ui/garage/test_page/fields_otp.json.jbuilder +168 -0
  16. data/app/views/json_ui/garage/test_page/fields_phone.json.jbuilder +176 -0
  17. data/app/views/json_ui/garage/test_page/fields_rating.json.jbuilder +191 -0
  18. data/app/views/json_ui/garage/test_page/fields_richText.json.jbuilder +213 -0
  19. data/app/views/json_ui/garage/test_page/fields_stripeExternalAccount.json.jbuilder +146 -0
  20. data/app/views/json_ui/garage/test_page/fields_stripeToken.json.jbuilder +118 -0
  21. data/app/views/json_ui/garage/test_page/fields_upload.json.jbuilder +15 -1
  22. data/app/views/json_ui/garage/test_page/window.json.jbuilder +23 -14
  23. data/app/views/json_ui/garage/test_page/windows.json.jbuilder +74 -16
  24. data/lib/glib/rubocop/cops/multiline_method_call_style.rb +0 -8
  25. data/lib/tasks/db.rake +0 -1
  26. metadata +15 -8
  27. data/app/views/json_ui/garage/test_page/multiupload.json.jbuilder +0 -65
  28. data/lib/glib/doc_generator.rb +0 -386
@@ -0,0 +1,176 @@
1
+ json.title 'Test Page (Fields Phone)'
2
+
3
+ page = json_ui_page json
4
+
5
+ page.body(
6
+ childViews: ->(body) do
7
+ render 'json_ui/garage/test_page/header', view: body
8
+
9
+ body.panels_responsive(
10
+ padding: glib_json_padding_body,
11
+ childViews: ->(res) do
12
+ res.h2 text: 'Fields Phone'
13
+ res.spacer height: 8
14
+ res.label text: 'International phone input with country selector and formatting.'
15
+ res.spacer height: 12
16
+
17
+ res.panels_form(
18
+ url: json_ui_garage_url(path: 'forms/generic_post'),
19
+ method: 'post',
20
+ childViews: ->(form) do
21
+ form.h2 text: 'Overview'
22
+ form.spacer height: 8
23
+ form.label text: 'Use fields_phone to collect international phone numbers with optional country defaults.'
24
+ form.spacer height: 12
25
+ form.hr width: 'matchParent'
26
+ form.spacer height: 12
27
+
28
+ form.h2 text: 'Basic example'
29
+ form.spacer height: 8
30
+ form.fields_phone(
31
+ id: 'phone_basic',
32
+ name: 'user[phone_basic]',
33
+ width: 'matchParent',
34
+ label: 'Phone number',
35
+ clearable: true,
36
+ onChange: ->(action) do
37
+ action.logics_set targetId: 'phone_status', data: { text: 'Status: number changed' }
38
+ end
39
+ )
40
+
41
+ form.spacer height: 12
42
+ form.hr width: 'matchParent'
43
+ form.spacer height: 12
44
+
45
+ form.h2 text: 'Variants/props'
46
+ form.spacer height: 8
47
+ form.label id: 'phone_variant_status', text: 'Variant: auto-detect (default)'
48
+ form.spacer height: 8
49
+ form.panels_flow(
50
+ innerPadding: { bottom: 0 },
51
+ width: 'matchParent',
52
+ childViews: ->(flow) do
53
+ flow.button(
54
+ text: 'Auto-detect (default)',
55
+ onClick: ->(action) do
56
+ action.runMultiple(
57
+ childActions: ->(multiple) do
58
+ multiple.components_set targetId: 'phone_basic', data: { disableAutoDetect: nil, defaultCountry: nil, label: 'Phone number' }
59
+ multiple.logics_set targetId: 'phone_variant_status', data: { text: 'Variant: auto-detect (default)' }
60
+ end
61
+ )
62
+ end
63
+ )
64
+ flow.spacer width: 8
65
+ flow.button(
66
+ text: 'Default country: US',
67
+ onClick: ->(action) do
68
+ action.runMultiple(
69
+ childActions: ->(multiple) do
70
+ multiple.components_set targetId: 'phone_basic', data: { disableAutoDetect: true, defaultCountry: 'US', label: 'Phone (US default)' }
71
+ multiple.logics_set targetId: 'phone_variant_status', data: { text: 'Variant: default country US' }
72
+ end
73
+ )
74
+ end
75
+ )
76
+ flow.spacer width: 8
77
+ flow.button(
78
+ text: 'Default country: AU',
79
+ onClick: ->(action) do
80
+ action.runMultiple(
81
+ childActions: ->(multiple) do
82
+ multiple.components_set targetId: 'phone_basic', data: { disableAutoDetect: true, defaultCountry: 'AU', label: 'Phone (AU default)' }
83
+ multiple.logics_set targetId: 'phone_variant_status', data: { text: 'Variant: default country AU' }
84
+ end
85
+ )
86
+ end
87
+ )
88
+ end
89
+ )
90
+
91
+ form.spacer height: 12
92
+ form.hr width: 'matchParent'
93
+ form.spacer height: 12
94
+
95
+ form.h2 text: 'Actions/events'
96
+ form.spacer height: 8
97
+ form.label id: 'phone_status', text: 'Status: idle'
98
+ form.spacer height: 8
99
+ form.panels_flow(
100
+ innerPadding: { bottom: 0 },
101
+ width: 'matchParent',
102
+ childViews: ->(flow) do
103
+ flow.button(
104
+ text: 'Set sample number',
105
+ onClick: ->(action) do
106
+ action.runMultiple(
107
+ childActions: ->(multiple) do
108
+ multiple.components_set targetId: 'phone_basic', data: { value: '+1 415 555 0123' }
109
+ multiple.logics_set targetId: 'phone_status', data: { text: 'Status: set sample number' }
110
+ end
111
+ )
112
+ end
113
+ )
114
+ flow.spacer width: 8
115
+ flow.button(
116
+ text: 'Clear value',
117
+ onClick: ->(action) do
118
+ action.runMultiple(
119
+ childActions: ->(multiple) do
120
+ multiple.components_set targetId: 'phone_basic', data: { value: '' }
121
+ multiple.logics_set targetId: 'phone_status', data: { text: 'Status: cleared' }
122
+ end
123
+ )
124
+ end
125
+ )
126
+ end
127
+ )
128
+
129
+ form.spacer height: 12
130
+ form.hr width: 'matchParent'
131
+ form.spacer height: 12
132
+
133
+ form.h2 text: 'Edge/advanced'
134
+ form.spacer height: 8
135
+ form.panels_flow(
136
+ innerPadding: { bottom: 0 },
137
+ width: 'matchParent',
138
+ childViews: ->(flow) do
139
+ flow.button(
140
+ text: 'Disable field',
141
+ onClick: ->(action) do
142
+ action.components_set targetId: 'phone_basic', data: { disabled: true }
143
+ end
144
+ )
145
+ flow.spacer width: 8
146
+ flow.button(
147
+ text: 'Enable field',
148
+ onClick: ->(action) do
149
+ action.components_set targetId: 'phone_basic', data: { disabled: nil }
150
+ end
151
+ )
152
+ flow.spacer width: 8
153
+ flow.button(
154
+ text: 'Read-only',
155
+ onClick: ->(action) do
156
+ action.components_set targetId: 'phone_basic', data: { readOnly: true }
157
+ end
158
+ )
159
+ flow.spacer width: 8
160
+ flow.button(
161
+ text: 'Editable',
162
+ onClick: ->(action) do
163
+ action.components_set targetId: 'phone_basic', data: { readOnly: nil }
164
+ end
165
+ )
166
+ end
167
+ )
168
+
169
+ form.spacer height: 12
170
+ form.fields_submit text: 'Submit'
171
+ end
172
+ )
173
+ end
174
+ )
175
+ end
176
+ )
@@ -0,0 +1,191 @@
1
+ json.title 'Test Page (Fields Rating)'
2
+
3
+ page = json_ui_page json
4
+
5
+ page.body(
6
+ childViews: ->(body) do
7
+ render 'json_ui/garage/test_page/header', view: body
8
+
9
+ body.panels_responsive(
10
+ padding: glib_json_padding_body,
11
+ childViews: ->(res) do
12
+ res.h2 text: 'Fields Rating'
13
+ res.spacer height: 8
14
+ res.label text: 'Interactive star rating input with optional half increments.'
15
+ res.spacer height: 12
16
+
17
+ res.panels_form(
18
+ url: json_ui_garage_url(path: 'forms/generic_post'),
19
+ method: 'post',
20
+ childViews: ->(form) do
21
+ form.h2 text: 'Overview'
22
+ form.spacer height: 8
23
+ form.label text: 'Use fields_rating to collect user satisfaction, reviews, or feedback scores.'
24
+ form.spacer height: 12
25
+ form.hr width: 'matchParent'
26
+ form.spacer height: 12
27
+
28
+ form.h2 text: 'Basic example'
29
+ form.spacer height: 8
30
+ form.fields_rating(
31
+ id: 'rating_main',
32
+ name: 'user[rating_main]',
33
+ width: 'matchParent',
34
+ label: 'Rating',
35
+ value: 3,
36
+ color: 'primary',
37
+ onChange: ->(action) do
38
+ action.logics_set targetId: 'rating_status', data: { text: 'Status: rating changed' }
39
+ end
40
+ )
41
+
42
+ form.spacer height: 12
43
+ form.hr width: 'matchParent'
44
+ form.spacer height: 12
45
+
46
+ form.h2 text: 'Variants/props'
47
+ form.spacer height: 8
48
+ form.label id: 'rating_variant_status', text: 'Variant: full increments (primary)'
49
+ form.spacer height: 8
50
+ form.panels_flow(
51
+ innerPadding: { bottom: 0 },
52
+ width: 'matchParent',
53
+ childViews: ->(flow) do
54
+ flow.button(
55
+ text: 'Full increments',
56
+ onClick: ->(action) do
57
+ action.runMultiple(
58
+ childActions: ->(multiple) do
59
+ multiple.components_set targetId: 'rating_main', data: { halfIncrements: nil, value: 4, color: 'primary', size: 24, readOnly: nil }
60
+ multiple.logics_set targetId: 'rating_variant_status', data: { text: 'Variant: full increments (primary)' }
61
+ end
62
+ )
63
+ end
64
+ )
65
+ flow.spacer width: 8
66
+ flow.button(
67
+ text: 'Half increments',
68
+ onClick: ->(action) do
69
+ action.runMultiple(
70
+ childActions: ->(multiple) do
71
+ multiple.components_set targetId: 'rating_main', data: { halfIncrements: true, value: 3.5, color: 'secondary', size: 24, readOnly: nil }
72
+ multiple.logics_set targetId: 'rating_variant_status', data: { text: 'Variant: half increments (secondary)' }
73
+ end
74
+ )
75
+ end
76
+ )
77
+ flow.spacer width: 8
78
+ flow.button(
79
+ text: 'Large size',
80
+ onClick: ->(action) do
81
+ action.runMultiple(
82
+ childActions: ->(multiple) do
83
+ multiple.components_set targetId: 'rating_main', data: { size: 40, value: 4.5, halfIncrements: true, color: 'ternary', readOnly: nil }
84
+ multiple.logics_set targetId: 'rating_variant_status', data: { text: 'Variant: large size (ternary)' }
85
+ end
86
+ )
87
+ end
88
+ )
89
+ flow.spacer width: 8
90
+ flow.button(
91
+ text: 'Read only',
92
+ onClick: ->(action) do
93
+ action.runMultiple(
94
+ childActions: ->(multiple) do
95
+ multiple.components_set targetId: 'rating_main', data: { readOnly: true, value: 5 }
96
+ multiple.logics_set targetId: 'rating_variant_status', data: { text: 'Variant: read-only' }
97
+ end
98
+ )
99
+ end
100
+ )
101
+ end
102
+ )
103
+
104
+ form.spacer height: 12
105
+ form.hr width: 'matchParent'
106
+ form.spacer height: 12
107
+
108
+ form.h2 text: 'Actions/events'
109
+ form.spacer height: 8
110
+ form.label id: 'rating_status', text: 'Status: idle'
111
+ form.spacer height: 8
112
+ form.panels_flow(
113
+ innerPadding: { bottom: 0 },
114
+ width: 'matchParent',
115
+ childViews: ->(flow) do
116
+ flow.button(
117
+ text: 'Set to 2',
118
+ onClick: ->(action) do
119
+ action.runMultiple(
120
+ childActions: ->(multiple) do
121
+ multiple.components_set targetId: 'rating_main', data: { value: 2, readOnly: nil }
122
+ multiple.logics_set targetId: 'rating_status', data: { text: 'Status: set to 2' }
123
+ end
124
+ )
125
+ end
126
+ )
127
+ flow.spacer width: 8
128
+ flow.button(
129
+ text: 'Set to 4.5',
130
+ onClick: ->(action) do
131
+ action.runMultiple(
132
+ childActions: ->(multiple) do
133
+ multiple.components_set targetId: 'rating_main', data: { value: 4.5, halfIncrements: true, readOnly: nil }
134
+ multiple.logics_set targetId: 'rating_status', data: { text: 'Status: set to 4.5' }
135
+ end
136
+ )
137
+ end
138
+ )
139
+ flow.spacer width: 8
140
+ flow.button(
141
+ text: 'Clear rating',
142
+ onClick: ->(action) do
143
+ action.runMultiple(
144
+ childActions: ->(multiple) do
145
+ multiple.components_set targetId: 'rating_main', data: { value: '', readOnly: '' }
146
+ multiple.logics_set targetId: 'rating_status', data: { text: 'Status: cleared' }
147
+ end
148
+ )
149
+ end
150
+ )
151
+ end
152
+ )
153
+
154
+ form.spacer height: 12
155
+ form.hr width: 'matchParent'
156
+ form.spacer height: 12
157
+
158
+ form.h2 text: 'Edge/advanced'
159
+ form.spacer height: 8
160
+ form.panels_flow(
161
+ innerPadding: { bottom: 0 },
162
+ width: 'matchParent',
163
+ childViews: ->(flow) do
164
+ flow.button(
165
+ text: 'Disable rating',
166
+ onClick: ->(action) do
167
+ action.components_set targetId: 'rating_main', data: { disabled: true }
168
+ end
169
+ )
170
+ flow.spacer width: 8
171
+ flow.button(
172
+ text: 'Enable rating',
173
+ onClick: ->(action) do
174
+ action.components_set targetId: 'rating_main', data: { disabled: nil }
175
+ end
176
+ )
177
+ flow.spacer width: 8
178
+ flow.button(
179
+ text: 'Small size',
180
+ onClick: ->(action) do
181
+ action.components_set targetId: 'rating_main', data: { size: 18 }
182
+ end
183
+ )
184
+ end
185
+ )
186
+ end
187
+ )
188
+ end
189
+ )
190
+ end
191
+ )
@@ -0,0 +1,213 @@
1
+ json.title 'Test Page (Fields RichText)'
2
+
3
+ page = json_ui_page json
4
+
5
+ page.body(
6
+ childViews: ->(body) do
7
+ render 'json_ui/garage/test_page/header', view: body
8
+
9
+ body.panels_responsive(
10
+ padding: glib_json_padding_body,
11
+ childViews: ->(res) do
12
+ res.h2 text: 'Fields RichText'
13
+ res.spacer height: 8
14
+ res.label text: 'WYSIWYG editor with markdown or HTML output, mentions, and image uploads.'
15
+ res.spacer height: 12
16
+
17
+ res.panels_form(
18
+ url: json_ui_garage_url(path: 'forms/basic_post'),
19
+ method: 'post',
20
+ childViews: ->(form) do
21
+ initial_message = <<-TEXT
22
+ This is a **message**.
23
+ ## Header
24
+ - Bullet one
25
+ - Bullet two
26
+
27
+ `Inline code`
28
+
29
+ Try @mentioning a teammate here.
30
+ TEXT
31
+
32
+ avatar = 'https://png.pngtree.com/png-vector/20190710/ourmid/pngtree-user-vector-avatar-png-image_1541962.jpg'
33
+ mention_list = [
34
+ { id: 'johndoe', value: 'johndoe', text: 'John Doe', avatar: avatar, group: 'Team' },
35
+ { id: 'budi', value: 'budi', text: 'Budi', avatar: avatar, group: 'Team' }
36
+ ]
37
+ image_uploader = {
38
+ name: 'user[images_attributes][]',
39
+ accepts: { fileType: ['image', 'csv', 'xlsx', 'pptx', 'docx'], maxFileSize: 5000 },
40
+ directUploadUrl: glib_direct_uploads_url,
41
+ blobUrlGenerator: glib_blob_url_generators_url
42
+ }
43
+
44
+ form.h2 text: 'Overview'
45
+ form.spacer height: 8
46
+ form.label text: 'Use fields_richText for formatted content, comments, or long-form entries.'
47
+ form.spacer height: 12
48
+ form.hr width: 'matchParent'
49
+ form.spacer height: 12
50
+
51
+ form.h2 text: 'Basic example'
52
+ form.spacer height: 8
53
+ form.fields_richText(
54
+ id: 'rich_text_main',
55
+ width: 'matchParent',
56
+ produce: :markdown,
57
+ accept: :markdown,
58
+ label: 'Content',
59
+ name: 'user[rich_text]',
60
+ value: initial_message,
61
+ mentionList: mention_list,
62
+ imageUploader: image_uploader,
63
+ debug: true,
64
+ onChange: ->(action) do
65
+ action.logics_set targetId: 'rich_text_status', data: { text: 'Status: content changed' }
66
+ end
67
+ )
68
+
69
+ form.spacer height: 12
70
+ form.hr width: 'matchParent'
71
+ form.spacer height: 12
72
+
73
+ form.h2 text: 'Variants/props'
74
+ form.spacer height: 8
75
+ form.label id: 'rich_text_variant_status', text: 'Variant: markdown output'
76
+ form.spacer height: 8
77
+ form.panels_flow(
78
+ innerPadding: { bottom: 0 },
79
+ width: 'matchParent',
80
+ childViews: ->(flow) do
81
+ flow.button(
82
+ text: 'Markdown output',
83
+ onClick: ->(action) do
84
+ action.runMultiple(
85
+ childActions: ->(multiple) do
86
+ multiple.components_set targetId: 'rich_text_main', data: { produce: 'markdown', accept: 'markdown' }
87
+ multiple.logics_set targetId: 'rich_text_variant_status', data: { text: 'Variant: markdown output' }
88
+ end
89
+ )
90
+ end
91
+ )
92
+ flow.spacer width: 8
93
+ flow.button(
94
+ text: 'HTML output',
95
+ onClick: ->(action) do
96
+ action.runMultiple(
97
+ childActions: ->(multiple) do
98
+ multiple.components_set targetId: 'rich_text_main', data: { produce: 'html', accept: 'html' }
99
+ multiple.logics_set targetId: 'rich_text_variant_status', data: { text: 'Variant: HTML output' }
100
+ end
101
+ )
102
+ end
103
+ )
104
+ flow.spacer width: 8
105
+ flow.button(
106
+ text: 'No uploader',
107
+ onClick: ->(action) do
108
+ action.runMultiple(
109
+ childActions: ->(multiple) do
110
+ multiple.components_set targetId: 'rich_text_main', data: { imageUploader: nil }
111
+ multiple.logics_set targetId: 'rich_text_variant_status', data: { text: 'Variant: uploader removed' }
112
+ end
113
+ )
114
+ end
115
+ )
116
+ flow.spacer width: 8
117
+ flow.button(
118
+ text: 'Restore uploader',
119
+ onClick: ->(action) do
120
+ action.runMultiple(
121
+ childActions: ->(multiple) do
122
+ multiple.components_set targetId: 'rich_text_main', data: { imageUploader: image_uploader }
123
+ multiple.logics_set targetId: 'rich_text_variant_status', data: { text: 'Variant: uploader restored' }
124
+ end
125
+ )
126
+ end
127
+ )
128
+ end
129
+ )
130
+
131
+ form.spacer height: 12
132
+ form.hr width: 'matchParent'
133
+ form.spacer height: 12
134
+
135
+ form.h2 text: 'Actions/events'
136
+ form.spacer height: 8
137
+ form.label id: 'rich_text_status', text: 'Status: idle'
138
+ # form.spacer height: 8
139
+ # form.panels_flow(
140
+ # innerPadding: { bottom: 0 },
141
+ # width: 'matchParent',
142
+ # childViews: ->(flow) do
143
+ # flow.button(
144
+ # text: 'Insert template',
145
+ # onClick: ->(action) do
146
+ # action.runMultiple(
147
+ # childActions: ->(multiple) do
148
+ # multiple.components_set targetId: 'rich_text_main', data: { value: "# Quick update\n\n- Item one\n- Item two\n\nThanks!" }
149
+ # multiple.logics_set targetId: 'rich_text_status', data: { text: 'Status: template inserted' }
150
+ # end
151
+ # )
152
+ # end
153
+ # )
154
+ # # flow.spacer width: 8
155
+ # # flow.button(
156
+ # # text: 'Clear content',
157
+ # # onClick: ->(action) do
158
+ # # action.runMultiple(
159
+ # # childActions: ->(multiple) do
160
+ # # multiple.components_set targetId: 'rich_text_main', data: { value: '' }
161
+ # # multiple.logics_set targetId: 'rich_text_status', data: { text: 'Status: cleared' }
162
+ # # end
163
+ # # )
164
+ # # end
165
+ # # )
166
+ # end
167
+ # )
168
+
169
+ form.spacer height: 12
170
+ form.hr width: 'matchParent'
171
+ form.spacer height: 12
172
+
173
+ form.h2 text: 'Edge/advanced'
174
+ form.spacer height: 8
175
+ form.panels_flow(
176
+ innerPadding: { bottom: 0 },
177
+ width: 'matchParent',
178
+ childViews: ->(flow) do
179
+ flow.button(
180
+ text: 'Disable editor',
181
+ onClick: ->(action) do
182
+ action.components_set targetId: 'rich_text_main', data: { disabled: true }
183
+ end
184
+ )
185
+ flow.spacer width: 8
186
+ flow.button(
187
+ text: 'Enable editor',
188
+ onClick: ->(action) do
189
+ action.components_set targetId: 'rich_text_main', data: { disabled: nil }
190
+ end
191
+ )
192
+ flow.spacer width: 8
193
+ flow.button(
194
+ text: 'Toggle debug',
195
+ onClick: ->(action) do
196
+ action.components_set targetId: 'rich_text_main', data: { debug: false }
197
+ end
198
+ )
199
+ flow.spacer width: 8
200
+ flow.button(
201
+ text: 'Enable debug',
202
+ onClick: ->(action) do
203
+ action.components_set targetId: 'rich_text_main', data: { debug: true }
204
+ end
205
+ )
206
+ end
207
+ )
208
+ end
209
+ )
210
+ end
211
+ )
212
+ end
213
+ )