glib-web 4.3.0 → 4.4.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/glib/glib_direct_uploads_controller.rb +1 -1
  3. data/app/controllers/glib/home_controller.rb +5 -0
  4. data/app/helpers/glib/enum_helper.rb +5 -6
  5. data/app/helpers/glib/json_ui/abstract_builder.rb +1 -1
  6. data/app/helpers/glib/json_ui/action_builder/browsers.rb +12 -0
  7. data/app/helpers/glib/json_ui/action_builder/fields.rb +6 -0
  8. data/app/helpers/glib/json_ui/action_builder/files.rb +8 -0
  9. data/app/helpers/glib/json_ui/action_builder/logics.rb +9 -0
  10. data/app/helpers/glib/json_ui/action_builder/storage_items.rb +23 -0
  11. data/app/helpers/glib/json_ui/action_builder.rb +0 -18
  12. data/app/helpers/glib/json_ui/list_builders.rb +16 -1
  13. data/app/helpers/glib/json_ui/menu_builder.rb +1 -1
  14. data/app/helpers/glib/json_ui/page_helper.rb +3 -2
  15. data/app/helpers/glib/json_ui/view_builder/charts.rb +3 -2
  16. data/app/helpers/glib/json_ui/view_builder/fields.rb +37 -29
  17. data/app/helpers/glib/json_ui/view_builder/panels.rb +40 -11
  18. data/app/helpers/glib/json_ui/view_builder.rb +20 -8
  19. data/app/models/glib/dummy_job_application.rb +3 -2
  20. data/app/views/json_ui/garage/_nav_menu.json.jbuilder +1 -1
  21. data/app/views/json_ui/garage/forms/_alert_post_all_data.json.jbuilder +4 -0
  22. data/app/views/json_ui/garage/forms/file_upload.json.jbuilder +2 -2
  23. data/app/views/json_ui/garage/forms/generic_post_all.json.jbuilder +3 -0
  24. data/app/views/json_ui/garage/forms/selects.json.jbuilder +0 -1
  25. data/app/views/json_ui/garage/forms/show_hide.json.jbuilder +41 -7
  26. data/app/views/json_ui/garage/forms/submit_on_change.json.jbuilder +1 -1
  27. data/app/views/json_ui/garage/forms/text_validation.json.jbuilder +13 -8
  28. data/app/views/json_ui/garage/panels/index.json.jbuilder +4 -0
  29. data/app/views/json_ui/garage/panels/tree.json.jbuilder +77 -0
  30. data/app/views/json_ui/garage/test_page/_header.json.jbuilder +14 -0
  31. data/app/views/json_ui/garage/test_page/auto_validate.json.jbuilder +77 -0
  32. data/app/views/json_ui/garage/test_page/dialog.json.jbuilder +38 -0
  33. data/app/views/json_ui/garage/test_page/dialog_open.json.jbuilder +14 -0
  34. data/app/views/json_ui/garage/test_page/form.json.jbuilder +111 -0
  35. data/app/views/json_ui/garage/test_page/form_dynamic.json.jbuilder +63 -0
  36. data/app/views/json_ui/garage/test_page/multiupload.json.jbuilder +65 -0
  37. data/lib/glib/mailer_tester.rb +1 -1
  38. metadata +14 -2
  39. data/app/views/json_ui/garage/test_page/index.json.jbuilder +0 -120
@@ -0,0 +1,65 @@
1
+ json.title 'Test Page (Form)'
2
+
3
+ page = json_ui_page json
4
+
5
+ page.body childViews: ->(body) do
6
+ render 'json_ui/garage/test_page/header', view: body
7
+
8
+ body.panels_responsive padding: glib_json_padding_body, childViews: ->(res) do
9
+ res.h2 text: 'MultiUpload'
10
+ res.spacer height: 8
11
+ res.panels_form \
12
+ url: json_ui_garage_url(path: 'forms/generic_post'),
13
+ method: 'post',
14
+ childViews: ->(form) do
15
+
16
+ form.spacer height: 16
17
+ form.label text: 'Simple file upload'
18
+ form.spacer height: 8
19
+ form.fields_multiUpload \
20
+ name: 'user[multi][]',
21
+ id: 'upload_1',
22
+ width: 360,
23
+ accepts: { fileType: 'image', maxFileSize: 10 },
24
+ directUploadUrl: glib_direct_uploads_url,
25
+ uploadTitle: 'Files uploaded:',
26
+ storagePrefix: 'glib',
27
+ metadata: {
28
+ foo: 'bar',
29
+ zoo: 'baz'
30
+ },
31
+ # tagging: 'key=value&key1=value1',
32
+ tags: { key: 'value', key1: 'value1' },
33
+ files: [
34
+ { name: 'File (Example)', signed_id: ActiveStorage::Attachment.first&.signed_id }
35
+ ]
36
+ form.button text: 'clear files', onClick: ->(action) do
37
+ action.components_set targetId: 'upload_1', data: { files: [], value: nil }
38
+ end
39
+
40
+ form.spacer height: 16
41
+ form.label text: 'File upload with onFinishUpload'
42
+ form.spacer height: 8
43
+ form.fields_multiUpload \
44
+ name: 'user[multi2][]',
45
+ id: 'upload_2',
46
+ width: 360,
47
+ accepts: { fileType: 'image', maxFileSize: 5000 },
48
+ directUploadUrl: glib_direct_uploads_url,
49
+ uploadTitle: 'Files uploaded:',
50
+ onFinishUpload: ->(action) { action.forms_submit }
51
+ form.button text: 'populate files', onClick: ->(action) do
52
+ action.components_set targetId: 'upload_2', data: {
53
+ files: [
54
+ { name: 'File (Example)', signed_id: ActiveStorage::Attachment.last&.signed_id }
55
+ ],
56
+ value: [1]
57
+ }
58
+ end
59
+
60
+ form.fields_submit text: 'submit'
61
+ end
62
+
63
+ res.spacer height: 16
64
+ end
65
+ end
@@ -61,7 +61,7 @@ module Glib
61
61
  end
62
62
 
63
63
  def mails
64
- @mails ||= ActionMailer::Base.deliveries
64
+ ActionMailer::Base.deliveries
65
65
  end
66
66
 
67
67
  def last_mail
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glib-web
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.3.0
4
+ version: 4.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - ''
@@ -111,10 +111,12 @@ files:
111
111
  - app/helpers/glib/json_ui/abstract_builder.rb
112
112
  - app/helpers/glib/json_ui/action_builder.rb
113
113
  - app/helpers/glib/json_ui/action_builder/bottom_banners.rb
114
+ - app/helpers/glib/json_ui/action_builder/browsers.rb
114
115
  - app/helpers/glib/json_ui/action_builder/commands.rb
115
116
  - app/helpers/glib/json_ui/action_builder/components.rb
116
117
  - app/helpers/glib/json_ui/action_builder/dialogs.rb
117
118
  - app/helpers/glib/json_ui/action_builder/fields.rb
119
+ - app/helpers/glib/json_ui/action_builder/files.rb
118
120
  - app/helpers/glib/json_ui/action_builder/global_states.rb
119
121
  - app/helpers/glib/json_ui/action_builder/http.rb
120
122
  - app/helpers/glib/json_ui/action_builder/iap.rb
@@ -123,6 +125,7 @@ files:
123
125
  - app/helpers/glib/json_ui/action_builder/popovers.rb
124
126
  - app/helpers/glib/json_ui/action_builder/sheets.rb
125
127
  - app/helpers/glib/json_ui/action_builder/snackbars.rb
128
+ - app/helpers/glib/json_ui/action_builder/storage_items.rb
126
129
  - app/helpers/glib/json_ui/action_builder/tours.rb
127
130
  - app/helpers/glib/json_ui/action_builder/windows.rb
128
131
  - app/helpers/glib/json_ui/analytics_helper.rb
@@ -176,6 +179,7 @@ files:
176
179
  - app/views/json_ui/garage/actions/index.json.jbuilder
177
180
  - app/views/json_ui/garage/actions/partial_update.json.jbuilder
178
181
  - app/views/json_ui/garage/empty.json.jbuilder
182
+ - app/views/json_ui/garage/forms/_alert_post_all_data.json.jbuilder
179
183
  - app/views/json_ui/garage/forms/_alert_post_data.json.jbuilder
180
184
  - app/views/json_ui/garage/forms/_conditional_banner.json.jbuilder
181
185
  - app/views/json_ui/garage/forms/_partial_update_execute.json.jbuilder
@@ -201,6 +205,7 @@ files:
201
205
  - app/views/json_ui/garage/forms/full_page_form.json.jbuilder
202
206
  - app/views/json_ui/garage/forms/full_page_form_dialog.json.jbuilder
203
207
  - app/views/json_ui/garage/forms/generic_post.json.jbuilder
208
+ - app/views/json_ui/garage/forms/generic_post_all.json.jbuilder
204
209
  - app/views/json_ui/garage/forms/index.json.jbuilder
205
210
  - app/views/json_ui/garage/forms/local_request.json.jbuilder
206
211
  - app/views/json_ui/garage/forms/new_rich_text.json.jbuilder
@@ -273,6 +278,7 @@ files:
273
278
  - app/views/json_ui/garage/panels/responsive.json.jbuilder
274
279
  - app/views/json_ui/garage/panels/split.json.jbuilder
275
280
  - app/views/json_ui/garage/panels/timeline.json.jbuilder
281
+ - app/views/json_ui/garage/panels/tree.json.jbuilder
276
282
  - app/views/json_ui/garage/panels/ul.json.jbuilder
277
283
  - app/views/json_ui/garage/panels/vertical.json.jbuilder
278
284
  - app/views/json_ui/garage/panels/web.json.jbuilder
@@ -287,7 +293,13 @@ files:
287
293
  - app/views/json_ui/garage/tables/index.json.jbuilder
288
294
  - app/views/json_ui/garage/tables/layout.json.jbuilder
289
295
  - app/views/json_ui/garage/tables/panel_content.json.jbuilder
290
- - app/views/json_ui/garage/test_page/index.json.jbuilder
296
+ - app/views/json_ui/garage/test_page/_header.json.jbuilder
297
+ - app/views/json_ui/garage/test_page/auto_validate.json.jbuilder
298
+ - app/views/json_ui/garage/test_page/dialog.json.jbuilder
299
+ - app/views/json_ui/garage/test_page/dialog_open.json.jbuilder
300
+ - app/views/json_ui/garage/test_page/form.json.jbuilder
301
+ - app/views/json_ui/garage/test_page/form_dynamic.json.jbuilder
302
+ - app/views/json_ui/garage/test_page/multiupload.json.jbuilder
291
303
  - app/views/json_ui/garage/views/_chart_data.json.jbuilder
292
304
  - app/views/json_ui/garage/views/banners.json.jbuilder
293
305
  - app/views/json_ui/garage/views/calendar_data.json.jbuilder
@@ -1,120 +0,0 @@
1
- json.title 'Test Page'
2
-
3
- page = json_ui_page json
4
-
5
- page.body childViews: ->(body) do
6
- body.panels_responsive padding: glib_json_padding_body, childViews: ->(res) do
7
- res.panels_column lg: { cols: 6 }, childViews: ->(col) do
8
- res.h2 text: 'Reactivity & validation'
9
- res.spacer height: 8
10
- res.panels_form \
11
- url: json_ui_garage_url(path: 'forms/generic_post'),
12
- method: 'post',
13
- childViews: ->(form) do
14
- form.panels_flow innerPadding: { bottom: 0 }, width: 'matchParent', childViews: ->(hori) do
15
- hori.button text: 'components/set', onClick: ->(action) do
16
- action.runMultiple childActions: ->(saction) do
17
- saction.components_set targetId: 'text', data: { value: 'Doe John' }
18
- saction.components_set targetId: 'textarea', data: { value: 'The quick brown fox jumps over the lazy dog' }
19
- new_options = [{ text: 'Option99', value: 'option99' }]
20
- ['select', 'chip_group'].each do |id|
21
- saction.components_set targetId: id, data: { options: new_options, value: ['option99'] }
22
- end
23
- end
24
- end
25
- hori.spacer width: 4
26
- hori.button text: 'logics/set', onClick: ->(action) do
27
- action.logics_set targetId: 'date', conditionalData: { value: { "+": [{ "var": ['user[date]'] }, 60 * 60 * 24 * 3] } }
28
- end
29
- hori.spacer width: 4
30
- hori.button text: 'components/replace', onClick: ->(action) do
31
- action.runMultiple childActions: ->(saction) do
32
- saction.components_replace targetId: 'radio_group', newView: ->(view) do
33
- view.fields_radioGroup value: '', childViews: ->(sview) do
34
- sview.fields_radio label: 'Option99', value: 'option99'
35
- end
36
- end
37
-
38
- saction.components_replace targetId: 'check_group', newView: ->(view) do
39
- view.fields_checkGroup value: '', childViews: ->(sview) do
40
- sview.fields_check label: 'Option99', value: nil, checkValue: 'option99'
41
- end
42
- end
43
- end
44
- end
45
- hori.spacer width: 4
46
- hori.button text: 'hide select', onClick: ->(action) do
47
- action.components_set targetId: 'select', data: { displayed: false }
48
- end
49
- end
50
-
51
- form.spacer height: 8
52
- form.hr width: 'matchParent'
53
- form.spacer height: 8
54
-
55
- validation = { required: { message: 'Required' } }
56
- options = ['option1', 'option2', 'option3', 'option4'].map { |option| { 'text'=> option.humanize, 'value' => option } }
57
-
58
- form.fields_date width: 'matchParent', name: 'user[date]', id: 'date', value: Date.new(2024, 7, 24), validation: validation
59
- form.hr width: 'matchParent'
60
- form.fields_select multiple: true, width: 'matchParent', name: 'user[select][]', id: 'select', options: options, value: ['option1', 'option2'], validation: validation
61
- form.hr width: 'matchParent'
62
- form.fields_chipGroup width: 'matchParent', name: 'user[chip_group]', id: 'chip_group', options: options, value: ['option2'], validation: validation
63
- form.hr width: 'matchParent'
64
- form.fields_radioGroup width: 'matchParent', name: 'user[radio_group]', id: 'radio_group', value: 'option3', validation: validation, childViews: ->(radio) do
65
- options.each do |option|
66
- radio.fields_radio label: option['text'], value: option['value']
67
- end
68
- end
69
- form.hr width: 'matchParent'
70
- check_group_value = ['option3', 'option1']
71
- form.fields_checkGroup width: 'matchParent', name: 'user[check_group]', id: 'check_group', value: check_group_value, validation: validation, childViews: ->(radio) do
72
- options.each do |option|
73
- radio.fields_check label: option['text'], checkValue: option['value']
74
- end
75
- end
76
- form.hr width: 'matchParent'
77
- form.fields_text width: 'matchParent', name: 'user[text]', id: 'text', value: 'John Doe', validation: validation
78
-
79
- form.hr width: 'matchParent'
80
-
81
- form.fields_textarea width: 'matchParent', name: 'user[textarea]', id: 'textarea', value: 'Lorem ipsum et dumet bla bla bla...'
82
-
83
- form.hr width: 'matchParent'
84
- form.fields_submit text: 'submit'
85
- form.spacer height: 2
86
- form.fields_submit text: 'submit (if form valid)', disableIfFormInvalid: true
87
- end
88
-
89
-
90
- res.spacer height: 16
91
-
92
- end
93
-
94
-
95
- res.panels_column lg: { cols: 6 }, childViews: ->(col) do
96
- res.h2 text: 'Dialog'
97
- res.spacer height: 8
98
- res.button text: 'Dialog updateExisting', onClick: ->(action) do
99
- action.runMultiple childActions: ->(saction) do
100
- saction.dialogs_show updateExisting: true, content: ->(dialog) do
101
- dialog.body padding: glib_json_padding_body, childViews: ->(sbody) do
102
- sbody.h1 text: 'Hello world'
103
- sbody.button text: 'change dialog content', onClick: ->(ssaction) do
104
- ssaction.dialogs_show updateExisting: true, disableCloseButton: true, content: ->(sdialog) do
105
- sdialog.body padding: glib_json_padding_body, childViews: ->(ssbody) do
106
- ssbody.h1 text: 'Hello world (updated)'
107
- ssbody.spacer height: 8
108
- ssbody.button text: 'close', onClick: ->(xaction) do
109
- xaction.dialogs_close
110
- end
111
- end
112
- end
113
- end
114
- end
115
- end
116
- end
117
- end
118
- end
119
- end
120
- end