glib-web 3.28.0 → 4.1.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 (38) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/concerns/glib/json/libs.rb +4 -4
  3. data/app/helpers/glib/json_ui/abstract_builder.rb +0 -8
  4. data/app/helpers/glib/json_ui/action_builder/components.rb +0 -5
  5. data/app/helpers/glib/json_ui/action_builder/dialogs.rb +0 -23
  6. data/app/helpers/glib/json_ui/action_builder/logics.rb +11 -0
  7. data/app/helpers/glib/json_ui/action_builder/popovers.rb +0 -9
  8. data/app/helpers/glib/json_ui/action_builder/windows.rb +1 -5
  9. data/app/helpers/glib/json_ui/action_builder.rb +0 -24
  10. data/app/helpers/glib/json_ui/builder/mouse_events.rb +0 -7
  11. data/app/helpers/glib/json_ui/default.rb +4 -4
  12. data/app/helpers/glib/json_ui/list_builders.rb +0 -3
  13. data/app/helpers/glib/json_ui/page_helper.rb +7 -1
  14. data/app/helpers/glib/json_ui/view_builder/fields.rb +7 -38
  15. data/app/helpers/glib/json_ui/view_builder/panels.rb +1 -0
  16. data/app/helpers/glib/json_ui/view_builder.rb +3 -14
  17. data/app/policies/glib/application_policy.rb +0 -6
  18. data/app/views/json_ui/garage/actions/_components.json.jbuilder +2 -6
  19. data/app/views/json_ui/garage/actions/_dialogs.json.jbuilder +0 -14
  20. data/app/views/json_ui/garage/actions/_reload.json.jbuilder +1 -1
  21. data/app/views/json_ui/garage/actions/partial_update.json.jbuilder +1 -1
  22. data/app/views/json_ui/garage/forms/_alert_post_data.json.jbuilder +1 -3
  23. data/app/views/json_ui/garage/forms/_partial_update_execute.json.jbuilder +1 -1
  24. data/app/views/json_ui/garage/forms/_read_more_text.json.jbuilder +27 -20
  25. data/app/views/json_ui/garage/forms/conditional_value.json.jbuilder +49 -68
  26. data/app/views/json_ui/garage/forms/dirty_prompt.json.jbuilder +0 -28
  27. data/app/views/json_ui/garage/forms/file_upload.json.jbuilder +1 -3
  28. data/app/views/json_ui/garage/forms/otp_field.json.jbuilder +11 -9
  29. data/app/views/json_ui/garage/forms/rich_text_preview.json.jbuilder +0 -1
  30. data/app/views/json_ui/garage/forms/selects.json.jbuilder +17 -24
  31. data/app/views/json_ui/garage/forms/show_hide.json.jbuilder +317 -271
  32. data/app/views/json_ui/garage/forms/timers.json.jbuilder +0 -90
  33. data/app/views/json_ui/garage/notifications/action_cable.json.jbuilder +3 -3
  34. data/app/views/json_ui/garage/pages/lifecycle_hooks.json.jbuilder +4 -0
  35. data/app/views/json_ui/garage/views/{components_update.json.jbuilder → components_replace.json.jbuilder} +6 -6
  36. data/app/views/json_ui/garage/views/controls.json.jbuilder +0 -32
  37. data/lib/glib/test_helpers.rb +2 -0
  38. metadata +3 -2
@@ -3,75 +3,56 @@ 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.spacer height: 20
8
- form.h2 text: 'Date'
9
- form.label text: 'End date will be adjusted automatically when start date changes'
10
- form.spacer height: 6
11
- form.fields_date name: 'user[date_start]', width: 'matchParent', label: 'Start Date', min: '2010-01-01', max: '2012-01-01', value: '2010-02-01'
12
- form.fields_date name: 'user[date_end]', width: 'matchParent', label: 'End Date', min: '2010-01-01', max: '2012-01-01', valueIf: {
13
- "+": [
14
- {
15
- "var": 'user[date_start]'
16
- },
17
- 24 * 3600
18
- ]
19
- }
6
+ page.form \
7
+ url: json_ui_garage_url(path: 'forms/generic_post'),
8
+ method: 'post',
9
+ padding: glib_json_padding_body,
10
+ childViews: ->(form) do
11
+ form.spacer height: 20
12
+ form.h2 text: 'Date'
13
+ form.label text: 'End date will be adjusted automatically when start date changes'
14
+ form.spacer height: 6
15
+ form.fields_date name: 'user[date_start]', width: 'matchParent', label: 'Start Date', min: '2010-01-01', max: '2012-01-01', value: '2010-02-01', onChangeAndLoad: ->(action) do
16
+ action.logics_set targetId: 'date1', conditionalData: { value: { "+": [{ "var": 'user[date_start]' }, 24 * 3600] } }
17
+ end
18
+ form.fields_date id: 'date1', name: 'user[date_end]', width: 'matchParent', label: 'End Date', min: '2010-01-01', max: '2012-01-01'
20
19
 
21
- form.spacer height: 20
22
- form.h2 text: 'Date/Time'
23
- form.label text: 'End date/time will be adjusted automatically when start date/time changes'
24
- form.spacer height: 6
25
- form.fields_datetime name: 'user[datetime_start]', width: 'matchParent', label: 'Start Date', min: '2010-01-01', max: '2012-01-01', value: '2010-02-01T01:00'
26
- form.fields_datetime name: 'user[datetime_end]', width: 'matchParent', label: 'End Date', min: '2010-01-01', max: '2012-01-01', valueIf: {
27
- "+": [
28
- {
29
- "var": 'user[datetime_start]'
30
- },
31
- 3600
32
- ]
33
- }
20
+ form.spacer height: 20
21
+ form.h2 text: 'Date/Time'
22
+ form.label text: 'End date/time will be adjusted automatically when start date/time changes'
23
+ form.spacer height: 6
24
+ form.fields_datetime name: 'user[datetime_start]', width: 'matchParent', label: 'Start Date', min: '2010-01-01', max: '2012-01-01', value: '2010-02-01T01:00', onChangeAndLoad: ->(action) do
25
+ action.logics_set targetId: 'date2', conditionalData: { value: { "+": [{ "var": 'user[datetime_start]' }, 3600] } }
26
+ end
27
+ form.fields_datetime id: 'date2', name: 'user[datetime_end]', width: 'matchParent', label: 'End Date', min: '2010-01-01', max: '2012-01-01'
34
28
 
35
- form.spacer height: 20
36
- form.h2 text: 'Check/uncheck All'
37
- form.spacer height: 6
38
- form.fields_check name: 'user[check_all]', label: 'All', checkValue: true
39
- form.fields_check name: 'user[check1]', label: 'Check 1', checkValue: true, valueIf: {
40
- "==": [
41
- {
42
- "var": 'user[check_all]'
43
- },
44
- true
45
- ]
46
- }
47
- form.fields_check name: 'user[check2]', label: 'Check 2', checkValue: true, valueIf: {
48
- "==": [
49
- {
50
- "var": 'user[check_all]'
51
- },
52
- true
53
- ]
54
- }
55
- form.fields_check name: 'user[check3]', label: 'Check 3', checkValue: true, valueIf: {
56
- "==": [
57
- {
58
- "var": 'user[check_all]'
59
- },
60
- true
61
- ]
62
- }
29
+ form.spacer height: 20
30
+ form.h2 text: 'Check/uncheck All'
31
+ form.spacer height: 6
32
+ form.fields_check name: 'user[check_all]', label: 'All', checkValue: true, onChangeAndLoad: ->(action) do
33
+ action.runMultiple childActions: ->(saction) do
34
+ saction.logics_set targetId: 'check1', conditionalData: { value: { "==": [{ "var": 'user[check_all]' }, true] } }
35
+ saction.logics_set targetId: 'check2', conditionalData: { value: { "==": [{ "var": 'user[check_all]' }, true] } }
36
+ saction.logics_set targetId: 'check3', conditionalData: { value: { "==": [{ "var": 'user[check_all]' }, true] } }
37
+ end
38
+ end
39
+ form.fields_check id: 'check1', name: 'user[check1]', label: 'Check 1', checkValue: true
40
+ form.fields_check id: 'check2', name: 'user[check2]', label: 'Check 2', checkValue: true
41
+ form.fields_check id: 'check3', name: 'user[check3]', label: 'Check 3', checkValue: true
63
42
 
64
- form.spacer height: 20
65
- form.h2 text: 'Divided by 3 (with precision set)'
66
- form.spacer height: 6
67
- form.fields_number name: 'user[number1]', width: 'matchParent', value: 10
68
- form.fields_number \
69
- name: 'user[number2]',
70
- width: 'matchParent',
71
- precision: 1,
72
- valueIf: { "/": [{ "var": 'user[number1]' }, 3] }
43
+ form.spacer height: 20
44
+ form.h2 text: 'Divided by 3 (with precision set)'
45
+ form.spacer height: 6
46
+ form.fields_number name: 'user[number1]', width: 'matchParent', value: 10, onChangeAndLoad: ->(action) do
47
+ action.logics_set targetId: 'number1', conditionalData: { value: { "/": [{ "var": 'user[number1]' }, 3] } }
48
+ end
49
+ form.fields_number \
50
+ name: 'user[number2]',
51
+ width: 'matchParent',
52
+ id: 'number1',
53
+ precision: 1
73
54
 
74
- form.spacer height: 20
75
- form.fields_submit text: 'Submit'
76
- form.spacer height: 40
77
- end
55
+ form.spacer height: 20
56
+ form.fields_submit text: 'Submit'
57
+ form.spacer height: 40
58
+ end
@@ -38,34 +38,6 @@ page.form \
38
38
  form.fields_chipGroup name: 'user[dirty_chipgroup]', width: 'matchParent', label: 'Chipgroup', value: ['option_2'], options: options
39
39
  form.spacer height: 14
40
40
 
41
- form.h3 text: 'valueIf'
42
- form.fields_check name: 'user[check_all]', label: 'All', checkValue: true
43
-
44
- form.fields_check name: 'user[check1]', label: 'Check 1', checkValue: true, valueIf: {
45
- "==": [
46
- {
47
- "var": 'user[check_all]'
48
- },
49
- true
50
- ]
51
- }
52
- form.fields_check name: 'user[check2]', label: 'Check 2', checkValue: true, valueIf: {
53
- "==": [
54
- {
55
- "var": 'user[check_all]'
56
- },
57
- true
58
- ]
59
- }
60
- form.fields_check name: 'user[check3]', label: 'Check 3', checkValue: true, valueIf: {
61
- "==": [
62
- {
63
- "var": 'user[check_all]'
64
- },
65
- true
66
- ]
67
- }
68
-
69
41
  form.h3 text: 'Radio'
70
42
  form.spacer height: 14
71
43
  form.fields_radioGroup name: 'user[gender]', value: 'F', childViews: ->(group) do
@@ -42,10 +42,9 @@ page.form options.merge(childViews: ->(form) do
42
42
  form.fields_multiUpload \
43
43
  name: 'user[multi][]',
44
44
  width: 360,
45
- accepts: { fileType: 'image', maxFileSize: 5000 },
45
+ accepts: { fileType: 'image', maxFileSize: 10 },
46
46
  directUploadUrl: rails_direct_uploads_url,
47
47
  uploadTitle: 'Files uploaded:',
48
- uploadFailedText: '(UPLOAD FAILED)',
49
48
  storagePrefix: 'glib',
50
49
  metadata: {
51
50
  foo: 'bar',
@@ -63,7 +62,6 @@ page.form options.merge(childViews: ->(form) do
63
62
  accepts: { fileType: 'image', maxFileSize: 5000 },
64
63
  directUploadUrl: rails_direct_uploads_url,
65
64
  uploadTitle: 'Files uploaded:',
66
- uploadFailedText: '(UPLOAD FAILED)',
67
65
  onFinishUpload: ->(action) { action.forms_submit }
68
66
  form.spacer height: 16
69
67
  form.label text: 'Sign'
@@ -35,15 +35,17 @@ page.form \
35
35
 
36
36
  form.spacer height: 20
37
37
  form.h2 text: 'OTP with Value If'
38
- form.fields_otp name: 'user[otp_summary4]', width: 'matchParent', value: 60000, length: 5
39
- form.fields_otp name: 'user[otp_summary5]', width: 'matchParent', length: 5, valueIf: {
40
- "*": [
41
- {
42
- "var": 'user[otp_summary4]'
43
- },
44
- (20/100.to_f)
45
- ]
46
- }
38
+ form.fields_otp name: 'user[otp_summary4]', width: 'matchParent', value: 60000, length: 5, onChange: ->(action) do
39
+ action.logics_set targetId: 'otp1', conditionalData: { value: {
40
+ "*": [
41
+ {
42
+ "var": 'user[otp_summary4]'
43
+ },
44
+ (20/100.to_f)
45
+ ]
46
+ } }
47
+ end
48
+ form.fields_otp id: 'otp1', name: 'user[otp_summary5]', width: 'matchParent', length: 5
47
49
 
48
50
  form.spacer height: 20
49
51
  form.fields_submit text: 'Submit'
@@ -1,7 +1,6 @@
1
1
  data = params[:user] || {}
2
2
 
3
3
  json_ui_response_with_view json do |action|
4
- # Experimental. Continue to use `components_update` instead.
5
4
  action.components_replace targetId: 'preview', newView: ->(update) do
6
5
  update.panels_vertical childViews: ->(vertical) do
7
6
  vertical.label text: "Hello #{data[:name]},"
@@ -31,26 +31,26 @@ page.form url: json_ui_garage_url(path: 'forms/generic_post'), method: 'post', p
31
31
  form.spacer height: 6
32
32
 
33
33
  languages = {
34
- "East Asia" => {
35
- "zh" => "Chinese",
36
- "ja" => "Japanese",
37
- "ko" => "Korean",
34
+ 'East Asia' => {
35
+ 'zh' => 'Chinese',
36
+ 'ja' => 'Japanese',
37
+ 'ko' => 'Korean',
38
38
  },
39
- "Middle East" => {
40
- "ar" => 'Arabic',
41
- "hi" => "Hindi",
39
+ 'Middle East' => {
40
+ 'ar' => 'Arabic',
41
+ 'hi' => 'Hindi',
42
42
  },
43
- "Europe" => {
44
- "nl" => "Dutch",
45
- "en" => "English",
46
- "fr" => "French",
47
- "de" => "German",
48
- "it" => "Italian",
49
- "pt" => "Portuguese",
50
- "es" => "Spanish",
43
+ 'Europe' => {
44
+ 'nl' => 'Dutch',
45
+ 'en' => 'English',
46
+ 'fr' => 'French',
47
+ 'de' => 'German',
48
+ 'it' => 'Italian',
49
+ 'pt' => 'Portuguese',
50
+ 'es' => 'Spanish',
51
51
  },
52
- "Eastern Europe" => {
53
- "ru" => "Russian",
52
+ 'Eastern Europe' => {
53
+ 'ru' => 'Russian',
54
54
  }
55
55
  }
56
56
  options = []
@@ -116,13 +116,6 @@ page.form url: json_ui_garage_url(path: 'forms/generic_post'), method: 'post', p
116
116
  form.spacer height: 6
117
117
  form.fields_timeZone name: 'user[time_zone]', width: 'matchParent', label: 'Time Zone'
118
118
 
119
- # TODO: Remove
120
- form.spacer height: 20
121
- form.h2 text: 'Autocomplete (select with manual entry) -- DEPRECATED: Confusing UX, promote bad backend design'
122
- form.spacer height: 6
123
- skills = ['Singing', 'Dancing', 'Fighting']
124
- form.fields_autocomplete name: 'user[skill]', width: 'matchParent', label: 'Skill', options: skills, value: 'Singing'
125
- form.fields_autocomplete name: 'user[skills][]', width: 'matchParent', label: 'Skills', options: skills, value: ['Dancing', 'Fencing'], multiple: true
126
119
 
127
120
  form.button text: 'Submit', onClick: ->(action) { action.forms_submit }
128
121