glib-web 4.20.0 → 4.22.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (80) 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/action_builder/fields.rb +7 -1
  6. data/app/helpers/glib/json_ui/analytics_helper.rb +0 -0
  7. data/app/helpers/glib/json_ui/generic_builders.rb +0 -0
  8. data/app/models/glib/active_storage/attachment.rb +0 -0
  9. data/app/models/glib/active_storage/blob.rb +0 -0
  10. data/app/models/glib/dynamic_text_record.rb +0 -0
  11. data/app/models/glib/text.rb +0 -0
  12. data/app/validators/email_typo_validator.rb +0 -0
  13. data/app/validators/email_validator.rb +0 -0
  14. data/app/validators/url_validator.rb +0 -0
  15. data/app/views/json_ui/garage/actions/dialogs_oauth_post.json.jbuilder +0 -0
  16. data/app/views/json_ui/garage/forms/bulk_edit_post.json.jbuilder +0 -0
  17. data/app/views/json_ui/garage/forms/checkboxes.json.jbuilder +30 -10
  18. data/app/views/json_ui/garage/forms/conditional_value.json.jbuilder +1 -1
  19. data/app/views/json_ui/garage/forms/dynamic_group.json.jbuilder +50 -18
  20. data/app/views/json_ui/garage/forms/generic_post.json.jbuilder +0 -0
  21. data/app/views/json_ui/garage/forms/show_hide.json.jbuilder +3 -9
  22. data/app/views/json_ui/garage/forms/submission_flow.json.jbuilder +0 -0
  23. data/app/views/json_ui/garage/forms/submission_flow_post.json.jbuilder +0 -0
  24. data/app/views/json_ui/garage/forms/submission_indicator.json.jbuilder +0 -0
  25. data/app/views/json_ui/garage/forms/submission_indicator_post.json.jbuilder +0 -0
  26. data/app/views/json_ui/garage/home/blank.json.jbuilder +0 -0
  27. data/app/views/json_ui/garage/home/slow.json.jbuilder +0 -0
  28. data/app/views/json_ui/garage/lists/autoload_all.json.jbuilder +0 -0
  29. data/app/views/json_ui/garage/lists/autoload_as_needed.json.jbuilder +0 -0
  30. data/app/views/json_ui/garage/lists/chat_ui.json.jbuilder +0 -0
  31. data/app/views/json_ui/garage/lists/fab.json.jbuilder +0 -0
  32. data/app/views/json_ui/garage/notifications/web_socket.json.jbuilder +0 -0
  33. data/app/views/json_ui/garage/pages/custom_style_class.json.jbuilder +0 -0
  34. data/app/views/json_ui/garage/pages/full_width.json.jbuilder +0 -0
  35. data/app/views/json_ui/garage/pages/full_width_height.json.jbuilder +0 -0
  36. data/app/views/json_ui/garage/pages/layout.json.jbuilder +0 -0
  37. data/app/views/json_ui/garage/pages/loading_indicator.json.jbuilder +0 -0
  38. data/app/views/json_ui/garage/pages/nested_scroll.json.jbuilder +0 -0
  39. data/app/views/json_ui/garage/pages/redirect_onload.json.jbuilder +0 -0
  40. data/app/views/json_ui/garage/panels/_styled.json.jbuilder +0 -0
  41. data/app/views/json_ui/garage/panels/card.json.jbuilder +0 -0
  42. data/app/views/json_ui/garage/panels/custom.json.jbuilder +0 -0
  43. data/app/views/json_ui/garage/panels/outlined.json.jbuilder +0 -0
  44. data/app/views/json_ui/garage/services/dynamic_text.json.jbuilder +0 -0
  45. data/app/views/json_ui/garage/services/image.json.jbuilder +0 -0
  46. data/app/views/json_ui/garage/services/index.json.jbuilder +0 -0
  47. data/app/views/json_ui/garage/tables/_autoload_section.json.jbuilder +0 -0
  48. data/app/views/json_ui/garage/tables/autoload_all.json.jbuilder +0 -0
  49. data/app/views/json_ui/garage/tables/autoload_as_needed.json.jbuilder +0 -0
  50. data/app/views/json_ui/garage/tables/export_import.json.jbuilder +0 -0
  51. data/app/views/json_ui/garage/tables/pagination.json.jbuilder +3 -3
  52. data/app/views/json_ui/garage/test_page/_header.json.jbuilder +1 -1
  53. data/app/views/json_ui/garage/test_page/form.json.jbuilder +16 -0
  54. data/app/views/json_ui/garage/test_page/form_dynamic.json.jbuilder +26 -21
  55. data/app/views/json_ui/garage/test_page/selectable.json.jbuilder +84 -0
  56. data/app/views/json_ui/garage/views/calendar_data.json.jbuilder +0 -0
  57. data/app/views/json_ui/garage/views/controls.json.jbuilder +13 -3
  58. data/app/views/json_ui/garage/views/map_data.json.jbuilder +0 -0
  59. data/app/views/json_ui/garage/views/multimedia.json.jbuilder +0 -0
  60. data/app/views/layouts/json_ui/no_custom.html.erb +0 -0
  61. data/lib/generators/glib/install_generator.rb +0 -0
  62. data/lib/generators/templates/20191017062519_create_texts.rb +0 -0
  63. data/lib/generators/templates/20191024063257_add_scope_to_texts.rb +0 -0
  64. data/lib/generators/templates/20191112095018_add_lang_to_texts.rb +0 -0
  65. data/lib/generators/templates/20191126071051_create_active_storage_tables.active_storage.rb +0 -0
  66. data/lib/generators/templates/database.yml +0 -0
  67. data/lib/generators/templates/dynamic_text.rb +0 -0
  68. data/lib/glib/dynamic_text/config.rb +0 -0
  69. data/lib/glib/dynamic_text.rb +0 -0
  70. data/lib/glib/json_crawler/action_crawler.rb +0 -0
  71. data/lib/glib/json_crawler/action_crawlers/action_http.rb +0 -0
  72. data/lib/glib/json_crawler/action_crawlers/dialogs_alert.rb +0 -0
  73. data/lib/glib/json_crawler/action_crawlers/menu.rb +0 -0
  74. data/lib/glib/json_crawler/action_crawlers/run_multiple.rb +0 -0
  75. data/lib/glib/json_crawler/action_crawlers/windows_open.rb +0 -0
  76. data/lib/glib/json_crawler/coverage.rb +0 -0
  77. data/lib/glib/value.rb +0 -0
  78. data/lib/glib/version.rb +0 -0
  79. data/lib/tasks/db.rake +2 -0
  80. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 68c288de9bf1bf340b92dfd31c6559da13ee0cb6030b907cbd6a86828c989313
4
- data.tar.gz: 835b1a957ff4c0c72bff64bf9129219c1b806e2a1427bd043c36d1393c1c3c12
3
+ metadata.gz: 973660b5005d3ea4990845eeb17cbb853bc2e9545aef54659654e0c4955776a3
4
+ data.tar.gz: 8b5f8c01195733b5eadca70ff45b1b5d992ed2f6bf2c8f87818ac34a51e760bb
5
5
  SHA512:
6
- metadata.gz: ff195da76449fe7a87dfa795e5a7434da1b32692f4d7535e979558bd4b2869648ca27b522af95809a2a72950a77d735f0ec4bcdaf34bebdbd574e2ecc0497827
7
- data.tar.gz: d5a35ec75ffe680c2f34483fab42c60ef2c2eaf02f8ce83b07080b24f9dd0a204c83565a293a971e79f18aa660b70b485b4d04d0a453efe425ca968b2c282fec
6
+ metadata.gz: 7980032e83ea3569932729997e50f57be9d4e6204590f81455f7d774911aafa68ce6302a91caa7913671b55d7645492aab7e4b58e278ec9bc10f39430359bff7
7
+ data.tar.gz: 8487bce20e4614df9099e751a210431340eb62cbea2b71a5bdd6c226b459a30172a20f46f0e645ee08225cb9b3cd6b5c1c33438b84b3f8a5c41a85b251585444
File without changes
File without changes
@@ -9,15 +9,21 @@ class Glib::JsonUi::ActionBuilder
9
9
  action :onBlur
10
10
  end
11
11
 
12
+ # deprecated, change to Clear at next major version release
12
13
  class Reset < Action
13
14
  string :targetId
14
15
  action :onReset
15
16
  end
16
17
 
17
-
18
+ # deprecated, delete at next major version release
18
19
  class GetDynamicGroupEntryValues < Action
19
20
  array :names
20
21
  action :onGet
21
22
  end
23
+
24
+ class GetValues < Action
25
+ hash :fieldNames
26
+ action :onGet
27
+ end
22
28
  end
23
29
  end
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -47,16 +47,16 @@ page.scroll childViews: ->(scroll) do
47
47
  form.spacer height: 20
48
48
  form.h2 text: 'Checkboxes with none_of_above'
49
49
  form.fields_checkGroup \
50
- valueForDisableAll: 'none_of_above',
51
- name: 'user[favorite_fruits][]',
52
- value: 'grape',
53
- uncheckValue: 1,
54
- childViews: ->(group) do
55
- group.fields_check label: 'Grape', checkValue: 'grape'
56
- group.fields_check label: 'Banana', checkValue: 'banana'
57
- group.fields_check label: 'Durian', checkValue: 'durian'
58
- group.fields_check label: 'I dont like fruits', checkValue: 'none_of_above'
59
- end
50
+ valueForDisableAll: 'none_of_above',
51
+ name: 'user[favorite_fruits][]',
52
+ value: 'grape',
53
+ uncheckValue: 1,
54
+ childViews: ->(group) do
55
+ group.fields_check label: 'Grape', checkValue: 'grape'
56
+ group.fields_check label: 'Banana', checkValue: 'banana'
57
+ group.fields_check label: 'Durian', checkValue: 'durian'
58
+ group.fields_check label: 'I dont like fruits', checkValue: 'none_of_above'
59
+ end
60
60
 
61
61
  form.spacer height: 20
62
62
  form.h2 text: 'Check all with checkGroup'
@@ -100,6 +100,26 @@ page.scroll childViews: ->(scroll) do
100
100
  form.fields_check id: 'check2', name: 'user[foo][]', label: 'Option 2', checkValue: true
101
101
  form.fields_check id: 'check3', name: 'user[foo][]', label: 'Option 3', checkValue: true
102
102
 
103
+ form.spacer height: 20
104
+ form.h2 text: 'Custom panels checkgroup'
105
+ form.fields_checkGroup \
106
+ width: 'matchParent',
107
+ name: 'user[custom_panels][]',
108
+ uncheckValue: 'unchecked',
109
+ childViews: ->(group) do
110
+ group.panels_flow id: 'flow', xs: { gap: { all: 8 } }, backgroundColor: 'grey', width: 'matchParent', childViews: ->(flow) do
111
+ flow.fields_check checkValue: '1', label: 'Choice 1', onChange: ->(action) do
112
+ action.components_set targetId: 'flow', data: { backgroundColor: '#ff0000' }
113
+ end
114
+ flow.fields_check checkValue: '2', label: 'Choice 2', onChange: ->(action) do
115
+ action.components_set targetId: 'flow', data: { backgroundColor: '#00ff00' }
116
+ end
117
+ flow.fields_check checkValue: '3', label: 'Choice 3', onChange: ->(action) do
118
+ action.components_set targetId: 'flow', data: { backgroundColor: '#0000ff' }
119
+ end
120
+ end
121
+ end
122
+
103
123
  form.spacer height: 20
104
124
  form.button text: 'Submit', onClick: ->(action) { action.forms_submit }
105
125
  end
@@ -30,7 +30,7 @@ page.form \
30
30
  form.h2 text: 'Button Date'
31
31
  form.label text: 'Plus 30 days'
32
32
  form.spacer height: 6
33
- form.fields_date width: 150, name: 'user[date_start1]', label: 'Add start date', value: '2024-12-12', template: { type: 'text' }, onChange: ->(action) do
33
+ form.fields_date name: 'user[date_start1]', label: 'Add start date', value: '2024-12-12', min: '2024-11-1', max: '2024-12-31', template: { type: 'text' }, onChange: ->(action) do
34
34
  action.logics_set targetId: 'date3', conditionalData: { value: { "sum_date": [{ "var": 'user[date_start1]' }, { value: 86400 * 30, format: 'date' }] } }
35
35
  end
36
36
  form.spacer height: 6
@@ -30,8 +30,8 @@ page.form url: json_ui_garage_url(path: 'forms/generic_post'), method: 'post', p
30
30
  template.fields_hidden name: 'error_message'
31
31
  template.fields_text width: 'matchParent', name: 'question', label: 'Question', placeholder: 'Question'
32
32
 
33
- form.panels_responsive id: 'responsive_{{entry_index}}', childViews: ->(column) do
34
- options = [:rating, :yes_no, :choices]
33
+ form.panels_responsive id: 'responsive_{{entryIndex}}', childViews: ->(column) do
34
+ options = [:rating, :yes_no, :choices, :unspecified]
35
35
  template.fields_select \
36
36
  width: 'matchParent',
37
37
  name: 'type',
@@ -41,16 +41,48 @@ page.form url: json_ui_garage_url(path: 'forms/generic_post'), method: 'post', p
41
41
  options: options.map { |o| { text: o.to_s.humanize, value: o } },
42
42
  onChangeAndLoad: ->(action) do
43
43
  action.runMultiple childActions: ->(multiple) do
44
+ multiple.fields_getValues \
45
+ fieldNames: {
46
+ '{{entryPrefix}}[type]' => nil,
47
+ '{{entryPrefix}}[question]' => 'question'
48
+ },
49
+ onGet: ->(get) do
50
+ # get.snackbars_alert paramName: 'message', fieldName: 'entry-{{entryIndex}}'
51
+
52
+ get.http_get \
53
+ fieldName: 'entry',
54
+ url: json_ui_garage_current_url(entry: {
55
+ index: '{{entryIndex}}'
56
+ }).gsub('%7B%7B', '{{').gsub('%7D%7D', '}}') # manually change url because rails escape {{entryIndex}}
57
+ end
58
+
59
+ # multiple.logics_run \
60
+ # condition: { "==": [{ "var": "user[evaluation][{{entryIndex}}][type]" }, 'unspecified'] },
61
+ # onTrue: ->(subaction) do
62
+ # subaction.dialogs_alert message: 'Please select a valid type'
63
+ # end
64
+
65
+ # multiple.logics_run \
66
+ # condition: { "==": [{ "var": "[{{entryIndex}}][type]" }, 'unspecified'] },
67
+ # onTrue: ->(subaction) do
68
+ # subaction.dialogs_alert message: 'Please select a valid type'
69
+ # end
70
+
71
+ multiple.logics_run \
72
+ condition: { "==": [{ "var": '{{entryPrefix}}[type]' }, 'unspecified'] },
73
+ onTrue: ->(subaction) do
74
+ subaction.dialogs_alert message: 'Please select a valid type'
75
+ end
76
+
44
77
  multiple.logics_set \
45
- cacheData: true, # This is so that the the new data is retained when the `dynamicGroup` gets re-rendered.
46
78
  debug: true,
47
- targetId: 'responsive_{{entry_index}}', dataBuilder: ->(set) do
79
+ targetId: 'responsive_{{entryIndex}}', dataBuilder: ->(set) do
48
80
  set.panels_responsive width: 'matchParent', accessory: ->(accessory) do
49
81
  accessory.footer childViews: ->(footer) do
50
82
  footer.fields_check \
51
83
  width: 'matchParent',
52
- id: 'check_{{entry_index}}',
53
- name: 'enabled',
84
+ id: 'check_{{entryIndex}}',
85
+ name: '{{entryPrefix}}[enabled]',
54
86
  label: 'Enable',
55
87
  checkValue: true
56
88
 
@@ -63,20 +95,20 @@ page.form url: json_ui_garage_url(path: 'forms/generic_post'), method: 'post', p
63
95
  end
64
96
  end, onSet: ->(subaction) do
65
97
  subaction.logics_set \
66
- targetId: 'check_{{entry_index}}',
98
+ targetId: 'check_{{entryIndex}}',
67
99
  conditionalData: {
68
100
  value: {
69
- "==": [{ "var": 'user[evaluation][{{entry_index}}][type]' }, 'rating']
101
+ "==": [{ "var": 'user[evaluation][{{entryIndex}}][type]' }, 'rating']
70
102
  }
71
103
  }
72
104
  end
73
105
 
74
106
  multiple.logics_set \
75
- targetId: 'choices_panel_{{entry_index}}',
107
+ targetId: 'choices_panel_{{entryIndex}}',
76
108
  debug: true,
77
109
  conditionalData: {
78
110
  displayed: {
79
- "==": [{ "var": 'user[evaluation][{{entry_index}}][type]' }, 'choices']
111
+ "==": [{ "var": 'user[evaluation][{{entryIndex}}][type]' }, 'choices']
80
112
  }
81
113
  }
82
114
  end
@@ -88,29 +120,29 @@ page.form url: json_ui_garage_url(path: 'forms/generic_post'), method: 'post', p
88
120
  end
89
121
 
90
122
  template.icon \
91
- id: 'error_icon_{{entry_index}}',
123
+ id: 'error_icon_{{entryIndex}}',
92
124
  name: 'error',
93
125
  onLoad: ->(action) do
94
- action.logics_set debug: true, targetId: 'error_icon_{{entry_index}}', conditionalData: {
126
+ action.logics_set debug: true, targetId: 'error_icon_{{entryIndex}}', conditionalData: {
95
127
  displayed: {
96
128
  "!!": [
97
- { 'var': '{{entry_prefix}}[error_message]' }
129
+ { 'var': '{{entryPrefix}}[error_message]' }
98
130
  ]
99
131
  },
100
- 'tooltip.text': { 'var': '{{entry_prefix}}[error_message]' }
132
+ 'tooltip.text': { 'var': '{{entryPrefix}}[error_message]' }
101
133
  }
102
134
  end
103
- template.panels_vertical id: 'choices_panel_{{entry_index}}', childViews: ->(vertical) do
135
+ template.panels_vertical id: 'choices_panel_{{entryIndex}}', childViews: ->(vertical) do
104
136
  (1..5).each do |i|
105
137
  vertical.fields_text \
106
- id: "input_choice_{{entry_index}}_#{i}",
138
+ id: "input_choice_{{entryIndex}}_#{i}",
107
139
  width: 'matchParent',
108
140
  name: "choices_#{i}",
109
141
  label: "Choice #{i}",
110
142
  displayed: i <= 1,
111
143
  onChange: ->(action) do
112
- action.logics_set targetId: "input_choice_{{entry_index}}_#{i + 1}", conditionalData: {
113
- displayed: { "isPresent": [{ "var": "user[evaluation][{{entry_index}}][choices_#{i}]" }] }
144
+ action.logics_set targetId: "input_choice_{{entryIndex}}_#{i + 1}", conditionalData: {
145
+ displayed: { "isPresent": [{ "var": "user[evaluation][{{entryIndex}}][choices_#{i}]" }] }
114
146
  }
115
147
  end
116
148
  end
@@ -130,25 +130,19 @@ page.form \
130
130
  column.fields_radio\
131
131
  width: 'matchParent',
132
132
  height: 'matchParent',
133
- value: 'yes', label: 'Yes', icon: { template: 'featured', name: 'edit', size: 40, color: '#d1d1d1' },
134
- onClick: ->(action) do
135
- action.windows_openWeb url: 'http://www.google.com'
136
- end
133
+ value: 'yes', label: 'Yes', icon: { template: 'featured', name: 'edit', size: 40, color: '#d1d1d1' }
137
134
  end
138
135
  res.panels_column width: 'matchParent', lg: { cols: 4, padding: { x: 10 } }, childViews: ->(column) do
139
136
  column.fields_radio\
140
137
  width: 'matchParent',
141
138
  value: 'no', label: 'No (very very very very very very very very very very very long description)',
142
- image: { template: 'featured', url: 'https://cdn.pixabay.com/photo/2020/08/05/13/12/eco-5465432_1280.png', width: 80, height: 80 },
143
- onClick: ->(action) do
144
- action.windows_openWeb url: 'http://www.google.com'
145
- end
139
+ image: { template: 'featured', url: 'https://cdn.pixabay.com/photo/2020/08/05/13/12/eco-5465432_1280.png', width: 80, height: 80 }
146
140
  end
147
141
  res.panels_column width: 'matchParent', lg: { cols: 4 }, childViews: ->(column) do
148
142
  column.fields_radio\
149
143
  value: 'idk', label: 'Not Sure',
150
144
  image: { template: 'thumbnail', url: 'https://cdn.pixabay.com/photo/2020/08/05/13/12/eco-5465432_1280.png', width: 24, height: 24 }
151
- column.fields_radio value: '', label: 'Empty'
145
+ column.fields_radio value: 'empty', label: 'Empty'
152
146
  end
153
147
 
154
148
  end
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -9,10 +9,10 @@ per_page = 20
9
9
  page_index = params[:page]&.to_i || 1
10
10
 
11
11
  page.scroll padding: glib_json_padding_body, childViews: ->(scroll) do
12
- scroll.panels_table firstSection: ->(section) do
12
+ scroll.panels_table key: params[:page], firstSection: ->(section) do
13
13
  section.header cellViews: ->(header) do
14
- header.label text: "Name"
15
- header.label text: "Status"
14
+ header.label text: 'Name'
15
+ header.label text: 'Status'
16
16
  end
17
17
 
18
18
  items = (1..per_page).map do |index|
@@ -1,4 +1,4 @@
1
- navs = ['form', 'dialog', 'form_dynamic', 'auto_validate', 'multiupload', 'dirty_state', 'window']
1
+ navs = ['form', 'dialog', 'form_dynamic', 'auto_validate', 'multiupload', 'dirty_state', 'window', 'selectable']
2
2
 
3
3
  view.panels_flow innerPadding: { bottom: 0 }, styleClass: 'align-right', width: 'matchParent', childViews: ->(res) do
4
4
  navs.each_with_index do |nav, index|
@@ -118,6 +118,22 @@ page.body childViews: ->(body) do
118
118
 
119
119
  form.fields_textarea width: 'matchParent', name: 'user[textarea]', id: 'textarea', value: 'Lorem ipsum et dumet bla bla bla...'
120
120
 
121
+ form.hr width: 'matchParent'
122
+
123
+ form.hr width: 'matchParent'
124
+
125
+ form.fields_check label: 'show nested panel', name: 'not_user[nested_panel]', checkValue: true, onChange: ->(action) do
126
+ action.logics_set targetId: 'nested_panel', conditionalData: { displayed: { "var": 'not_user[nested_panel]' } }
127
+ end
128
+ form.panels_responsive backgroundColor: '#FF0000', padding: { all: 8 }, displayed: false, id: 'nested_panel', width: 'matchParent', childViews: ->(xres) do
129
+ xres.panels_horizontal backgroundColor: '#00FF00', padding: { all: 8 }, width: 'matchParent', childViews: ->(ver) do
130
+ ver.panels_vertical width: 'matchParent', childViews: ->(hori) do
131
+ hori.fields_text width: 300, name: 'user[should_not_submitted]', value: ''
132
+ end
133
+ end
134
+ end
135
+ form.fields_text width: 300, name: 'user[should_submitted]', displayed: false, value: 'Should be submitted even if not visible', submitWhenNotDisplayed: true
136
+
121
137
  form.hr width: 'matchParent'
122
138
  form.fields_submit text: 'submit'
123
139
  form.spacer height: 2
@@ -36,8 +36,8 @@ page.body childViews: ->(body) do
36
36
  template.fields_hidden name: 'error_message'
37
37
  template.fields_text width: 'matchParent', name: 'question', label: 'Question', placeholder: 'Question', styleClass: 'question'
38
38
 
39
- form.panels_responsive id: 'responsive_{{entry_index}}', childViews: ->(column) do
40
- options = [:rating, :yes_no, :choices]
39
+ form.panels_responsive id: 'responsive_{{entryIndex}}', childViews: ->(column) do
40
+ options = [:rating, :yes_no, :choices, :unspecified]
41
41
  template.fields_select \
42
42
  width: 'matchParent',
43
43
  name: 'type',
@@ -48,16 +48,22 @@ page.body childViews: ->(body) do
48
48
  options: options.map { |o| { text: o.to_s.humanize, value: o } },
49
49
  onChangeAndLoad: ->(action) do
50
50
  action.runMultiple childActions: ->(multiple) do
51
+ multiple.fields_getValues fieldNames: { '{{entryPrefix}}[type]' => nil, '{{entryPrefix}}[question]' => nil }, onGet: ->(get) do
52
+ get.snackbars_alert paramName: 'message', fieldName: 'entry-{{entryIndex}}'
53
+ end
54
+ multiple.logics_run \
55
+ condition: { "==": [{ "var": '{{entryPrefix}}[type]' }, 'unspecified'] },
56
+ onTrue: ->(subaction) do
57
+ subaction.dialogs_alert message: 'Please select a valid type'
58
+ end
51
59
  multiple.logics_set \
52
- cacheData: true, # This is so that the the new data is retained when the `dynamicGroup` gets re-rendered.
53
- debug: true,
54
- targetId: 'responsive_{{entry_index}}', dataBuilder: ->(set) do
60
+ targetId: 'responsive_{{entryIndex}}', dataBuilder: ->(set) do
55
61
  set.panels_responsive width: 'matchParent', accessory: ->(accessory) do
56
62
  accessory.footer childViews: ->(footer) do
57
63
  footer.fields_check \
58
64
  width: 'matchParent',
59
- id: 'check_{{entry_index}}',
60
- name: 'enabled',
65
+ id: 'check_{{entryIndex}}',
66
+ name: '{{entryPrefix}}[enabled]',
61
67
  label: 'Enable',
62
68
  styleClass: 'enable',
63
69
  checkValue: true
@@ -71,20 +77,19 @@ page.body childViews: ->(body) do
71
77
  end
72
78
  end, onSet: ->(subaction) do
73
79
  subaction.logics_set \
74
- targetId: 'check_{{entry_index}}',
80
+ targetId: 'check_{{entryIndex}}',
75
81
  conditionalData: {
76
82
  value: {
77
- "==": [{ "var": 'user[evaluation][{{entry_index}}][type]' }, 'rating']
83
+ "==": [{ "var": 'user[evaluation][{{entryIndex}}][type]' }, 'rating']
78
84
  }
79
85
  }
80
86
  end
81
87
 
82
88
  multiple.logics_set \
83
- targetId: 'choices_panel_{{entry_index}}',
84
- debug: true,
89
+ targetId: 'choices_panel_{{entryIndex}}',
85
90
  conditionalData: {
86
91
  displayed: {
87
- "==": [{ "var": 'user[evaluation][{{entry_index}}][type]' }, 'choices']
92
+ "==": [{ "var": 'user[evaluation][{{entryIndex}}][type]' }, 'choices']
88
93
  }
89
94
  }
90
95
  end
@@ -96,29 +101,29 @@ page.body childViews: ->(body) do
96
101
  end
97
102
 
98
103
  template.icon \
99
- id: 'error_icon_{{entry_index}}',
104
+ id: 'error_icon_{{entryIndex}}',
100
105
  name: 'error',
101
106
  onLoad: ->(action) do
102
- action.logics_set debug: true, targetId: 'error_icon_{{entry_index}}', conditionalData: {
107
+ action.logics_set targetId: 'error_icon_{{entryIndex}}', conditionalData: {
103
108
  displayed: {
104
109
  "!!": [
105
- { 'var': '{{entry_prefix}}[error_message]' }
110
+ { 'var': '{{entryPrefix}}[error_message]' }
106
111
  ]
107
112
  },
108
- 'tooltip.text': { 'var': '{{entry_prefix}}[error_message]' }
113
+ 'tooltip.text': { 'var': '{{entryPrefix}}[error_message]' }
109
114
  }
110
115
  end
111
- template.panels_vertical id: 'choices_panel_{{entry_index}}', childViews: ->(vertical) do
116
+ template.panels_vertical id: 'choices_panel_{{entryIndex}}', childViews: ->(vertical) do
112
117
  (1..5).each do |i|
113
118
  vertical.fields_text \
114
- id: "input_choice_{{entry_index}}_#{i}",
119
+ id: "input_choice_{{entryIndex}}_#{i}",
115
120
  width: 'matchParent',
116
- name: "choices_#{i}",
121
+ name: "[choices][#{i}]",
117
122
  label: "Choice #{i}",
118
123
  displayed: i <= 1,
119
124
  onChange: ->(action) do
120
- action.logics_set targetId: "input_choice_{{entry_index}}_#{i + 1}", conditionalData: {
121
- displayed: { "isPresent": [{ "var": "user[evaluation][{{entry_index}}][choices_#{i}]" }] }
125
+ action.logics_set targetId: "input_choice_{{entryIndex}}_#{i + 1}", conditionalData: {
126
+ displayed: { "isPresent": [{ "var": "{{entryPrefix}}[choices][#{i}]" }] }
122
127
  }
123
128
  end
124
129
  end
@@ -0,0 +1,84 @@
1
+ page = json_ui_page json
2
+
3
+ languages = {
4
+ 'East Asia' => {
5
+ 'zh' => 'Chinese',
6
+ 'ja' => 'Japanese',
7
+ 'ko' => 'Korean',
8
+ },
9
+ 'Middle East' => {
10
+ 'ar' => 'Arabic',
11
+ 'hi' => 'Hindi',
12
+ },
13
+ 'Europe' => {
14
+ 'nl' => 'Dutch',
15
+ 'en' => 'English',
16
+ 'fr' => 'French',
17
+ 'de' => 'German',
18
+ 'it' => 'Italian',
19
+ 'pt' => 'Portuguese',
20
+ 'es' => 'Spanish',
21
+ },
22
+ 'Eastern Europe' => {
23
+ 'ru' => 'Russian',
24
+ }
25
+ }
26
+ options = []
27
+ languages.each do |group, sub|
28
+ options << { type: 'label', text: group }
29
+ options.concat(sub.map { |k, v| { value: k, text: v, subtitle: 'Country' } })
30
+ options << { type: 'divider' }
31
+ end
32
+ options << { text: 'None of above', value: 'none_of_above' }
33
+
34
+ page.body padding: glib_json_padding_body, childViews: ->(body) do
35
+ body.panels_form \
36
+ url: json_ui_garage_url(path: 'forms/generic_post'),
37
+ method: 'post',
38
+ onChange: ->(action) do
39
+ action.logics_set targetId: 'checker2', skipOnChange: true, conditionalData: {
40
+ value: { "==": [{ "countNonNull": [{ "var": 'user[foo][]' }] }, 3] },
41
+ indeterminate: { "<": [0, { "countNonNull": [{ "var": 'user[foo][]' }] }, 3] }
42
+ }
43
+ end,
44
+ width: 'matchParent',
45
+ childViews: ->(form) do
46
+ form.h2 text: 'Select prepend & none_of_above'
47
+
48
+ form.fields_select \
49
+ valueForDisableAll: 'none_of_above',
50
+ prependSelectAll: true,
51
+ name: 'user[cities2][]',
52
+ width: 'matchParent',
53
+ label: 'Cities',
54
+ options: options,
55
+ value: ['melbourne', 'sydney'],
56
+ multiple: true
57
+
58
+ form.spacer height: 8
59
+
60
+ form.h2 text: 'Checkboxes none_of_above'
61
+ form.fields_checkGroup \
62
+ valueForDisableAll: 'none_of_above',
63
+ name: 'user[favorite_fruits][]',
64
+ value: 'grape',
65
+ uncheckValue: 1,
66
+ childViews: ->(group) do
67
+ group.fields_check label: 'Grape', checkValue: 'grape'
68
+ group.fields_check label: 'Banana', checkValue: 'banana'
69
+ group.fields_check label: 'Durian', checkValue: 'durian'
70
+ group.fields_check label: 'I dont like fruits', checkValue: 'none_of_above'
71
+ end
72
+
73
+ form.h2 text: 'Check all'
74
+ form.fields_check name: 'check_all_1', id: 'checker2', label: 'check all', checkValue: true, onChange: ->(action) do
75
+ action.logics_set targetIds: ['check1', 'check2', 'check3'], conditionalData: { value: { "!!": [{ "var": 'check_all_1' }] } }
76
+ end
77
+ form.fields_check id: 'check1', name: 'user[foo][]', label: 'Option 1', checkValue: true
78
+ form.fields_check id: 'check2', name: 'user[foo][]', label: 'Option 2', checkValue: true
79
+ form.fields_check id: 'check3', name: 'user[foo][]', label: 'Option 3', checkValue: true
80
+
81
+ form.spacer height: 8
82
+ form.fields_submit text: 'Submit'
83
+ end
84
+ end
@@ -63,12 +63,12 @@ page.scroll padding: glib_json_padding_body, childViews: ->(scroll) do
63
63
  onClick: ->(action) do
64
64
  action.popovers_show \
65
65
  key: 'menu2',
66
- placement: 'bottom-start',
66
+ placement: 'right-start',
67
67
  width: 200,
68
68
  content: ->(dialog) do
69
69
  dialog.body styleClass: 'popover-menu', padding: glib_json_padding_body, childViews: ->(res) do
70
70
  res.label text: 'Item 1', styleClass: 'popover-menu-item', onClick: ->(saction) do
71
- saction.popovers_close key: 'menu2'
71
+ saction.windows_open url: json_ui_garage_url(path: 'pages/index')
72
72
  end
73
73
  res.label text: 'Item 2', styleClass: 'popover-menu-item', onClick: ->(saction) do
74
74
  saction.popovers_close key: 'menu2'
@@ -92,7 +92,17 @@ page.scroll padding: glib_json_padding_body, childViews: ->(scroll) do
92
92
  icon: 'info',
93
93
  styleClasses: ['icon', 'text'],
94
94
  onClick: ->(action) do
95
- action.dialogs_alert message: 'Perform action'
95
+ # action.dialogs_alert message: 'Perform action'
96
+ action.popovers_show \
97
+ key: 'menu2',
98
+ placement: 'bottom-start',
99
+ width: 200,
100
+ persistent: true,
101
+ content: ->(dialog) do
102
+ dialog.body styleClass: 'popover-menu', padding: glib_json_padding_body, childViews: ->(res) do
103
+ res.label text: 'This is a persistent popover'
104
+ end
105
+ end
96
106
  end
97
107
 
98
108
  scroll.spacer height: 20
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
data/lib/glib/value.rb CHANGED
File without changes
data/lib/glib/version.rb CHANGED
File without changes
data/lib/tasks/db.rake CHANGED
@@ -79,6 +79,8 @@ namespace :db do
79
79
  attrs[key] = value.utc
80
80
  elsif value.is_a? ActiveSupport::HashWithIndifferentAccess
81
81
  attrs[key] = value.to_json
82
+ elsif value.is_a? BigDecimal
83
+ attrs[key] = value.to_f
82
84
  end
83
85
  end
84
86
 
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.20.0
4
+ version: 4.22.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ''
@@ -325,6 +325,7 @@ files:
325
325
  - app/views/json_ui/garage/test_page/form.json.jbuilder
326
326
  - app/views/json_ui/garage/test_page/form_dynamic.json.jbuilder
327
327
  - app/views/json_ui/garage/test_page/multiupload.json.jbuilder
328
+ - app/views/json_ui/garage/test_page/selectable.json.jbuilder
328
329
  - app/views/json_ui/garage/test_page/window.json.jbuilder
329
330
  - app/views/json_ui/garage/views/_chart_data.json.jbuilder
330
331
  - app/views/json_ui/garage/views/banners.json.jbuilder
@@ -408,8 +409,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
408
409
  - !ruby/object:Gem::Version
409
410
  version: '0'
410
411
  requirements: []
411
- rubyforge_project:
412
- rubygems_version: 2.7.6
412
+ rubygems_version: 3.4.6
413
413
  signing_key:
414
414
  specification_version: 4
415
415
  summary: ''