glib-web 4.21.0 → 4.23.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (83) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/concerns/glib/auth/policy.rb +35 -42
  3. data/app/controllers/concerns/glib/json/libs.rb +5 -1
  4. data/app/controllers/concerns/glib/json/new_dynamic_text.rb +0 -0
  5. data/app/helpers/glib/app_feature_support_helper.rb +0 -0
  6. data/app/helpers/glib/dynamic_texts_helper.rb +0 -0
  7. data/app/helpers/glib/json_ui/action_builder/dialogs.rb +2 -0
  8. data/app/helpers/glib/json_ui/action_builder/fields.rb +2 -1
  9. data/app/helpers/glib/json_ui/analytics_helper.rb +0 -0
  10. data/app/helpers/glib/json_ui/generic_builders.rb +0 -0
  11. data/app/models/glib/active_storage/attachment.rb +0 -0
  12. data/app/models/glib/active_storage/blob.rb +0 -0
  13. data/app/models/glib/dynamic_text_record.rb +0 -0
  14. data/app/models/glib/text.rb +0 -0
  15. data/app/policies/glib/application_policy.rb +12 -13
  16. data/app/validators/email_typo_validator.rb +0 -0
  17. data/app/validators/email_validator.rb +0 -0
  18. data/app/validators/url_validator.rb +0 -0
  19. data/app/views/json_ui/garage/actions/_dialogs.json.jbuilder +8 -1
  20. data/app/views/json_ui/garage/actions/_dialogs_show.json.jbuilder +3 -1
  21. data/app/views/json_ui/garage/actions/dialogs_oauth_post.json.jbuilder +0 -0
  22. data/app/views/json_ui/garage/forms/bulk_edit_post.json.jbuilder +0 -0
  23. data/app/views/json_ui/garage/forms/checkboxes.json.jbuilder +30 -10
  24. data/app/views/json_ui/garage/forms/conditional_value.json.jbuilder +1 -1
  25. data/app/views/json_ui/garage/forms/generic_post.json.jbuilder +0 -0
  26. data/app/views/json_ui/garage/forms/show_hide.json.jbuilder +3 -9
  27. data/app/views/json_ui/garage/forms/submission_flow.json.jbuilder +0 -0
  28. data/app/views/json_ui/garage/forms/submission_flow_post.json.jbuilder +0 -0
  29. data/app/views/json_ui/garage/forms/submission_indicator.json.jbuilder +0 -0
  30. data/app/views/json_ui/garage/forms/submission_indicator_post.json.jbuilder +0 -0
  31. data/app/views/json_ui/garage/home/blank.json.jbuilder +0 -0
  32. data/app/views/json_ui/garage/home/slow.json.jbuilder +0 -0
  33. data/app/views/json_ui/garage/lists/autoload_all.json.jbuilder +0 -0
  34. data/app/views/json_ui/garage/lists/autoload_as_needed.json.jbuilder +0 -0
  35. data/app/views/json_ui/garage/lists/chat_ui.json.jbuilder +0 -0
  36. data/app/views/json_ui/garage/lists/fab.json.jbuilder +0 -0
  37. data/app/views/json_ui/garage/notifications/web_socket.json.jbuilder +0 -0
  38. data/app/views/json_ui/garage/pages/custom_style_class.json.jbuilder +0 -0
  39. data/app/views/json_ui/garage/pages/full_width.json.jbuilder +0 -0
  40. data/app/views/json_ui/garage/pages/full_width_height.json.jbuilder +0 -0
  41. data/app/views/json_ui/garage/pages/layout.json.jbuilder +0 -0
  42. data/app/views/json_ui/garage/pages/loading_indicator.json.jbuilder +0 -0
  43. data/app/views/json_ui/garage/pages/nested_scroll.json.jbuilder +0 -0
  44. data/app/views/json_ui/garage/pages/redirect_onload.json.jbuilder +0 -0
  45. data/app/views/json_ui/garage/panels/_styled.json.jbuilder +0 -0
  46. data/app/views/json_ui/garage/panels/card.json.jbuilder +0 -0
  47. data/app/views/json_ui/garage/panels/custom.json.jbuilder +0 -0
  48. data/app/views/json_ui/garage/panels/outlined.json.jbuilder +0 -0
  49. data/app/views/json_ui/garage/services/dynamic_text.json.jbuilder +0 -0
  50. data/app/views/json_ui/garage/services/image.json.jbuilder +0 -0
  51. data/app/views/json_ui/garage/services/index.json.jbuilder +0 -0
  52. data/app/views/json_ui/garage/tables/_autoload_section.json.jbuilder +0 -0
  53. data/app/views/json_ui/garage/tables/autoload_all.json.jbuilder +0 -0
  54. data/app/views/json_ui/garage/tables/autoload_as_needed.json.jbuilder +0 -0
  55. data/app/views/json_ui/garage/tables/export_import.json.jbuilder +0 -0
  56. data/app/views/json_ui/garage/tables/pagination.json.jbuilder +1 -1
  57. data/app/views/json_ui/garage/test_page/_header.json.jbuilder +1 -1
  58. data/app/views/json_ui/garage/test_page/form_dynamic.json.jbuilder +6 -1
  59. data/app/views/json_ui/garage/test_page/selectable.json.jbuilder +91 -0
  60. data/app/views/json_ui/garage/views/calendar_data.json.jbuilder +0 -0
  61. data/app/views/json_ui/garage/views/map_data.json.jbuilder +0 -0
  62. data/app/views/json_ui/garage/views/multimedia.json.jbuilder +0 -0
  63. data/app/views/layouts/json_ui/no_custom.html.erb +0 -0
  64. data/lib/generators/glib/install_generator.rb +0 -0
  65. data/lib/generators/templates/20191017062519_create_texts.rb +0 -0
  66. data/lib/generators/templates/20191024063257_add_scope_to_texts.rb +0 -0
  67. data/lib/generators/templates/20191112095018_add_lang_to_texts.rb +0 -0
  68. data/lib/generators/templates/20191126071051_create_active_storage_tables.active_storage.rb +0 -0
  69. data/lib/generators/templates/database.yml +0 -0
  70. data/lib/generators/templates/dynamic_text.rb +0 -0
  71. data/lib/glib/dynamic_text/config.rb +0 -0
  72. data/lib/glib/dynamic_text.rb +0 -0
  73. data/lib/glib/json_crawler/action_crawler.rb +0 -0
  74. data/lib/glib/json_crawler/action_crawlers/action_http.rb +0 -0
  75. data/lib/glib/json_crawler/action_crawlers/dialogs_alert.rb +0 -0
  76. data/lib/glib/json_crawler/action_crawlers/menu.rb +0 -0
  77. data/lib/glib/json_crawler/action_crawlers/run_multiple.rb +0 -0
  78. data/lib/glib/json_crawler/action_crawlers/windows_open.rb +0 -0
  79. data/lib/glib/json_crawler/coverage.rb +0 -0
  80. data/lib/glib/value.rb +0 -0
  81. data/lib/glib/version.rb +0 -0
  82. data/lib/tasks/db.rake +2 -0
  83. metadata +4 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d78202b475738a29ed66ed9ab23374b4ccebdbd9d58554e60273d41fa99acf8a
4
- data.tar.gz: b51e17878e5274b4955a2784a8c28f1fd739668ecea83a216b73380f4aa75d48
3
+ metadata.gz: 9044e86258995ce4d869c421c35d5c17d3d2c7127f5129d5a8247bf9b94cc560
4
+ data.tar.gz: c1f3991fbe7147ffabc04e626aa02e9ce4809957f1618b5c2e73835f2830cb48
5
5
  SHA512:
6
- metadata.gz: a70cb51681f41ee739ff26fc4551b85ed5a7518267d9c911fcc0c5822261a7b0daa51bf25eab87868fba4206567355448cea1bf241bca10a903b3f6b2d603259
7
- data.tar.gz: dfa00b2574d73744bf31643d1e71db360772c79eebae88e2e1bc6ce9c6fae18a999f0caee5756dba83b5081f698a52753693a5300e6ca9d0e80709281be795fe
6
+ metadata.gz: b3f10f85edf2d3dc57bb70723b70683691c624295a8ef673c870731449bf0f7222d5786317fa6c77bb3c8a55bc90315864c641e94dbf52eae5fc94de7250bc25
7
+ data.tar.gz: 447a0021c20e6cd60be6f5d140ae7d25f975927e40686d10d13faf83ad71bef7fbbece7ade06104533a6ff1538606f0900be3580911aa5968f9e6e7ad9166e46
@@ -22,8 +22,7 @@ module Glib::Auth
22
22
  end
23
23
 
24
24
  module Overrides
25
-
26
- public # Override
25
+ # Override
27
26
  def policy(record, policy_name = nil, context = nil)
28
27
  policy_name ||= record
29
28
 
@@ -50,11 +49,10 @@ module Glib::Auth
50
49
  end
51
50
 
52
51
  # Expose protected method
53
- public # Override
52
+ # Override
54
53
  def policy_scope(*args, **opts)
55
54
  super
56
55
  end
57
-
58
56
  end
59
57
 
60
58
  def glib_raise_forbidden
@@ -71,13 +69,11 @@ module Glib::Auth
71
69
  policy(record, nil, context).send("#{action}?")
72
70
  end
73
71
 
74
- public
75
72
  def cannot?(action, record, context = nil)
76
73
  !policy(record, nil, context).send("#{action}?")
77
74
  end
78
75
 
79
76
  # Inspired from https://github.com/ryanb/cancan/wiki/Non-RESTful-Controllers
80
- public
81
77
  def glib_authorize_resource(*args)
82
78
  options = args.extract_options!
83
79
  resource_name = args.first
@@ -104,14 +100,11 @@ module Glib::Auth
104
100
  raise_access_denied(resource_instance, policy_instance) unless policy_instance.public_send(query)
105
101
  end
106
102
 
107
-
108
-
109
103
  class UnauthorizedError < Pundit::NotAuthorizedError
110
104
  end
111
105
 
112
-
113
-
114
106
  module ClassMethods
107
+ # rubocop:disable Style/ClassVars
115
108
  def glib_auth_init
116
109
  @@__glib_auth_init = true
117
110
 
@@ -122,40 +115,40 @@ module Glib::Auth
122
115
  def glib_auth_inited?
123
116
  @@__glib_auth_init ||= false
124
117
  end
118
+ # rubocop:enable Style/ClassVars
125
119
 
126
120
  # TODO: Consider deprecating
127
- public
128
- def authorize_resource(*args)
129
- options = args.extract_options!
130
- resource_name = args.first
131
-
132
- self.before_action(options.slice(:only, :except, :if, :unless)) do |controller|
133
- resource_name ||= resource_name_from_controller
134
-
135
- begin
136
- if !(resource_key = options[:class]).nil?
137
- resource = case resource_key
138
- when false
139
- resource_name.to_sym
140
- when Symbol, Class
141
- resource_key
142
- else
143
- raise "Invalid resource class: #{resource_key}"
144
- end
145
-
146
- authorize resource
147
- elsif (resource_instance = controller.instance_variable_get("@#{resource_name}"))
148
- authorize resource_instance
149
- else
150
- authorize resource_name.camelize.constantize
151
- end
152
- rescue Pundit::NotAuthorizedError => e
153
- raise_access_denied(e.record, e.policy)
154
- end
155
-
156
- verify_authorized
157
- end
158
- end
121
+ # def authorize_resource(*args)
122
+ # options = args.extract_options!
123
+ # resource_name = args.first
124
+
125
+ # self.before_action(options.slice(:only, :except, :if, :unless)) do |controller|
126
+ # resource_name ||= resource_name_from_controller
127
+
128
+ # begin
129
+ # if !(resource_key = options[:class]).nil?
130
+ # resource = case resource_key
131
+ # when false
132
+ # resource_name.to_sym
133
+ # when Symbol, Class
134
+ # resource_key
135
+ # else
136
+ # raise "Invalid resource class: #{resource_key}"
137
+ # end
138
+
139
+ # authorize resource
140
+ # elsif (resource_instance = controller.instance_variable_get("@#{resource_name}"))
141
+ # authorize resource_instance
142
+ # else
143
+ # authorize resource_name.camelize.constantize
144
+ # end
145
+ # rescue Pundit::NotAuthorizedError => e
146
+ # raise_access_denied(e.record, e.policy)
147
+ # end
148
+
149
+ # verify_authorized
150
+ # end
151
+ # end
159
152
  end
160
153
 
161
154
  def resource_name_from_controller
@@ -7,7 +7,7 @@ module Glib::Json::Libs
7
7
  helper_method :json_ui_app_bundle_id, :json_ui_app_build_version, :json_ui_app_device_os
8
8
  helper_method :json_ui_app_is_android?, :json_ui_app_is_ios?, :json_ui_app_is_web?
9
9
  # helper_method :json_ui_redirect_back_or_to
10
- helper_method :delete_redirect_back_url
10
+ helper_method :delete_redirect_back_url, :redirect_back_url
11
11
 
12
12
  include Glib::Auth::Response
13
13
  helper_method :glib_json_dialog_mode?
@@ -171,6 +171,10 @@ module Glib::Json::Libs
171
171
  end
172
172
  end
173
173
 
174
+ def redirect_back_url
175
+ session[REDIRECT_BACK_KEY]
176
+ end
177
+
174
178
  def __delete_redirect_back_url(url)
175
179
  session.delete(REDIRECT_BACK_KEY) || url
176
180
  end
File without changes
File without changes
@@ -15,6 +15,7 @@ class Glib::JsonUi::ActionBuilder
15
15
  length :width
16
16
  bool :closeOnBlur
17
17
  bool :updateExisting
18
+ action :onClose
18
19
 
19
20
  # def initialize(json, page)
20
21
  # @json = json
@@ -34,6 +35,7 @@ class Glib::JsonUi::ActionBuilder
34
35
  length :height
35
36
  bool :closeOnBlur
36
37
  bool :updateExisting
38
+ action :onClose
37
39
  end
38
40
 
39
41
  class Reload < Action
@@ -9,12 +9,13 @@ 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
- # deprecated
18
+ # deprecated, delete at next major version release
18
19
  class GetDynamicGroupEntryValues < Action
19
20
  array :names
20
21
  action :onGet
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -6,6 +6,7 @@ module Glib
6
6
  attr_reader :user, :record, :policy_name, :controller, :request, :params
7
7
 
8
8
  private
9
+ # rubocop:disable Metrics/ParameterLists
9
10
  def initialize(user, record, policy_name, controller, request, params)
10
11
  @user = user
11
12
  @record = record
@@ -16,13 +17,14 @@ module Glib
16
17
  @params = params
17
18
  @policy_name = policy_name
18
19
  end
20
+ # rubocop:enable Metrics/ParameterLists
19
21
 
20
22
  class << self
21
23
  attr_reader :catch_all
22
24
 
23
25
  # This is to define the authorization logic for an action (or a group of actions). It's different from controller's
24
26
  # authorize().
25
- private # Used by child
27
+ private # Used by child
26
28
  def authorize(*actions, &block)
27
29
  actions.each do |action|
28
30
  if action == :glib_all
@@ -33,19 +35,17 @@ module Glib
33
35
  # Avoid accidentally redefining multiple times from child policies. But it's okay if the child policy
34
36
  # wants to override the parent's authorization method.
35
37
  raise "Action authorization has been declared: #{action}" if instance_methods(false).include?(method_name.to_sym)
38
+
36
39
  define_method method_name, &block
37
40
  end
38
41
  end
39
42
  end
40
-
41
43
  end
42
44
 
43
- private
44
45
  def catch_all
45
46
  self.class.catch_all
46
47
  end
47
48
 
48
- private
49
49
  # To ensure the block is called on the policy's instance instead class.
50
50
  def call_catch_all
51
51
  instance_eval(&catch_all)
@@ -100,14 +100,17 @@ module Glib
100
100
 
101
101
  public
102
102
  def method_missing(name, *args, &block)
103
- if name.to_s.end_with?('?') && catch_all
103
+ if respond_to_missing?(name) && catch_all
104
104
  call_catch_all
105
105
  else
106
106
  super
107
107
  end
108
108
  end
109
109
 
110
- public
110
+ def respond_to_missing?(method_name, include_private = false)
111
+ method_name.to_s.end_with?('?') || super
112
+ end
113
+
111
114
  def scope
112
115
  policy_scope_class = Pundit::PolicyFinder.new(@policy_name).scope
113
116
  return unless policy_scope_class
@@ -115,15 +118,11 @@ module Glib
115
118
  controller.policy_scope(record.class, policy_scope_class: policy_scope_class)
116
119
  end
117
120
 
118
- public
119
121
  def self.args_builder
120
- Proc.new { |controller| [] }
122
+ proc { |_controller| [] }
121
123
  end
122
124
 
123
- public
124
- def helpers
125
- controller.helpers
126
- end
125
+ delegate :helpers, to: :controller
127
126
 
128
127
  class Scope
129
128
  attr_reader :user, :scope
@@ -143,7 +142,7 @@ module Glib
143
142
  end
144
143
  end
145
144
 
146
- private # Used by child
145
+ private # Used by child
147
146
  def everyone
148
147
  true
149
148
  end
File without changes
File without changes
File without changes
@@ -49,7 +49,14 @@ section.rows builder: ->(template) do
49
49
  end
50
50
 
51
51
  template.thumbnail title: 'dialogs/open', onClick: ->(action) do
52
- action.dialogs_open width: 950, url: json_ui_garage_url(path: 'forms/basic', mode: 'dialog'), disableCloseButton: true
52
+ action.dialogs_open \
53
+ width: 950,
54
+ url: json_ui_garage_url(path: 'forms/basic', mode: 'dialog'),
55
+ disableCloseButton: true,
56
+ closeOnBlur: true,
57
+ onClose: ->(saction) do
58
+ saction.snackbars_alert message: 'dialog closed'
59
+ end
53
60
  end
54
61
 
55
62
  template.thumbnail title: 'dialogs/open (fullscreen on mobile)', onClick: ->(action) do
@@ -12,7 +12,9 @@ end
12
12
 
13
13
  include_form = local_assigns[:include_form]
14
14
 
15
- action.send "dialogs_#{dialog_mode}", **options, content: ->(dialog) do
15
+ action.send "dialogs_#{dialog_mode}", **options,
16
+ onClose: ->(action) { action.snackbars_alert message: 'dialog closed' },
17
+ content: ->(dialog) do
16
18
  dialog.body padding: glib_json_padding_body, childViews: ->(body) do
17
19
  body.markdown text: markdown
18
20
 
@@ -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
@@ -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,7 +9,7 @@ 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 key: params[:page], firstSection: ->(section) do
12
+ scroll.panels_table firstSection: ->(section) do
13
13
  section.header cellViews: ->(header) do
14
14
  header.label text: 'Name'
15
15
  header.label text: 'Status'
@@ -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|
@@ -37,7 +37,7 @@ page.body childViews: ->(body) do
37
37
  template.fields_text width: 'matchParent', name: 'question', label: 'Question', placeholder: 'Question', styleClass: 'question'
38
38
 
39
39
  form.panels_responsive id: 'responsive_{{entryIndex}}', childViews: ->(column) do
40
- options = [:rating, :yes_no, :choices]
40
+ options = [:rating, :yes_no, :choices, :unspecified]
41
41
  template.fields_select \
42
42
  width: 'matchParent',
43
43
  name: 'type',
@@ -51,6 +51,11 @@ page.body childViews: ->(body) do
51
51
  multiple.fields_getValues fieldNames: { '{{entryPrefix}}[type]' => nil, '{{entryPrefix}}[question]' => nil }, onGet: ->(get) do
52
52
  get.snackbars_alert paramName: 'message', fieldName: 'entry-{{entryIndex}}'
53
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
54
59
  multiple.logics_set \
55
60
  targetId: 'responsive_{{entryIndex}}', dataBuilder: ->(set) do
56
61
  set.panels_responsive width: 'matchParent', accessory: ->(accessory) do
@@ -0,0 +1,91 @@
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
+
83
+ form.h2 text: 'Timezone'
84
+ form.fields_timeZone name: 'user[timezone]', label: 'Timezone', value: 'Asia/Shanghai'
85
+ form.fields_timeZone name: 'user[timezone_with_current_local]', label: 'Local Timezone'
86
+
87
+ form.spacer height: 8
88
+
89
+ form.fields_submit text: 'Submit'
90
+ end
91
+ 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
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.21.0
4
+ version: 4.23.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,7 +409,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
408
409
  - !ruby/object:Gem::Version
409
410
  version: '0'
410
411
  requirements: []
411
- rubygems_version: 3.4.6
412
+ rubyforge_project:
413
+ rubygems_version: 2.7.6
412
414
  signing_key:
413
415
  specification_version: 4
414
416
  summary: ''