glib-web 3.20.4 → 3.21.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (86) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/concerns/glib/json/libs.rb +38 -12
  3. data/app/controllers/concerns/glib/json/new_dynamic_text.rb +0 -0
  4. data/app/helpers/glib/app_feature_support_helper.rb +0 -0
  5. data/app/helpers/glib/dynamic_texts_helper.rb +0 -0
  6. data/app/helpers/glib/json_ui/action_builder/fields.rb +4 -0
  7. data/app/helpers/glib/json_ui/action_builder/sheets.rb +0 -0
  8. data/app/helpers/glib/json_ui/analytics_helper.rb +0 -0
  9. data/app/helpers/glib/json_ui/generic_builders.rb +0 -0
  10. data/app/helpers/glib/json_ui/view_builder/fields.rb +1 -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/validators/email_typo_validator.rb +0 -0
  16. data/app/validators/email_validator.rb +0 -0
  17. data/app/validators/url_validator.rb +0 -0
  18. data/app/views/json_ui/garage/actions/_dialogs_show.json.jbuilder +5 -3
  19. data/app/views/json_ui/garage/actions/_sheets.json.jbuilder +0 -0
  20. data/app/views/json_ui/garage/actions/dialogs_oauth_post.json.jbuilder +0 -0
  21. data/app/views/json_ui/garage/forms/dialogs_update.json.jbuilder +8 -1
  22. data/app/views/json_ui/garage/forms/dynamic_select_data.json.jbuilder +0 -0
  23. data/app/views/json_ui/garage/forms/generic_post.json.jbuilder +0 -0
  24. data/app/views/json_ui/garage/forms/pickers.json.jbuilder +2 -1
  25. data/app/views/json_ui/garage/forms/selects.json.jbuilder +8 -0
  26. data/app/views/json_ui/garage/forms/submission_flow.json.jbuilder +0 -0
  27. data/app/views/json_ui/garage/forms/submission_flow_post.json.jbuilder +0 -0
  28. data/app/views/json_ui/garage/forms/submission_indicator.json.jbuilder +0 -0
  29. data/app/views/json_ui/garage/forms/submission_indicator_post.json.jbuilder +0 -0
  30. data/app/views/json_ui/garage/home/blank.json.jbuilder +0 -0
  31. data/app/views/json_ui/garage/home/slow.json.jbuilder +0 -0
  32. data/app/views/json_ui/garage/lists/autoload_all.json.jbuilder +0 -0
  33. data/app/views/json_ui/garage/lists/autoload_as_needed.json.jbuilder +0 -0
  34. data/app/views/json_ui/garage/lists/chat_ui.json.jbuilder +0 -0
  35. data/app/views/json_ui/garage/lists/fab.json.jbuilder +0 -0
  36. data/app/views/json_ui/garage/notifications/action_cable.json.jbuilder +9 -3
  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/lifecycle_hooks.json.jbuilder +0 -0
  43. data/app/views/json_ui/garage/pages/loading_indicator.json.jbuilder +0 -0
  44. data/app/views/json_ui/garage/pages/nested_scroll.json.jbuilder +0 -0
  45. data/app/views/json_ui/garage/pages/redirect_onload.json.jbuilder +0 -0
  46. data/app/views/json_ui/garage/panels/_styled.json.jbuilder +0 -0
  47. data/app/views/json_ui/garage/panels/card.json.jbuilder +0 -0
  48. data/app/views/json_ui/garage/panels/custom.json.jbuilder +0 -0
  49. data/app/views/json_ui/garage/panels/outlined.json.jbuilder +0 -0
  50. data/app/views/json_ui/garage/services/dynamic_text.json.jbuilder +0 -0
  51. data/app/views/json_ui/garage/services/image.json.jbuilder +0 -0
  52. data/app/views/json_ui/garage/services/index.json.jbuilder +0 -0
  53. data/app/views/json_ui/garage/tables/_autoload_section.json.jbuilder +0 -0
  54. data/app/views/json_ui/garage/tables/autoload_all.json.jbuilder +0 -0
  55. data/app/views/json_ui/garage/tables/autoload_as_needed.json.jbuilder +0 -0
  56. data/app/views/json_ui/garage/tables/export_import.json.jbuilder +0 -0
  57. data/app/views/json_ui/garage/tables/index.json.jbuilder +0 -0
  58. data/app/views/json_ui/garage/views/calendar_data.json.jbuilder +0 -0
  59. data/app/views/json_ui/garage/views/icon_names.json.jbuilder +2153 -1332
  60. data/app/views/json_ui/garage/views/icons.json.jbuilder +4 -0
  61. data/app/views/json_ui/garage/views/links.json.jbuilder +0 -0
  62. data/app/views/json_ui/garage/views/map_data.json.jbuilder +0 -0
  63. data/app/views/json_ui/garage/views/multimedia.json.jbuilder +0 -0
  64. data/app/views/layouts/json_ui/no_custom.html.erb +0 -0
  65. data/app/views/layouts/json_ui/renderer.html.erb +1 -1
  66. data/lib/generators/glib/install_generator.rb +0 -0
  67. data/lib/generators/templates/20191017062519_create_texts.rb +0 -0
  68. data/lib/generators/templates/20191024063257_add_scope_to_texts.rb +0 -0
  69. data/lib/generators/templates/20191112095018_add_lang_to_texts.rb +0 -0
  70. data/lib/generators/templates/20191126071051_create_active_storage_tables.active_storage.rb +0 -0
  71. data/lib/generators/templates/database.yml +0 -0
  72. data/lib/generators/templates/dynamic_text.rb +0 -0
  73. data/lib/glib/crypt/utils.rb +0 -0
  74. data/lib/glib/crypt.rb +0 -0
  75. data/lib/glib/dynamic_text/config.rb +0 -0
  76. data/lib/glib/dynamic_text.rb +0 -0
  77. data/lib/glib/json_crawler/action_crawler.rb +0 -0
  78. data/lib/glib/json_crawler/action_crawlers/action_http.rb +0 -0
  79. data/lib/glib/json_crawler/action_crawlers/dialogs_alert.rb +0 -0
  80. data/lib/glib/json_crawler/action_crawlers/menu.rb +0 -0
  81. data/lib/glib/json_crawler/action_crawlers/run_multiple.rb +0 -0
  82. data/lib/glib/json_crawler/action_crawlers/windows_open.rb +0 -0
  83. data/lib/glib/json_crawler/coverage.rb +0 -0
  84. data/lib/glib/value.rb +0 -0
  85. data/lib/glib/version.rb +0 -0
  86. metadata +3 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9b0a9aabf5f0d62144bddff30fc741b14b1661580a26628a9b62428c55422202
4
- data.tar.gz: 6db894d335f8541170d6ade933885c43bc925e0ab388a717473ceaf7ef134030
3
+ metadata.gz: 6a1d6390dceb59db91cdb5fea9a123375d9442af6941b74770881736a6f25de0
4
+ data.tar.gz: 46bfd89ea540dfd8fc125c5c486595fad64d5a40fc55de365b66bf1fb8dbccce
5
5
  SHA512:
6
- metadata.gz: 16bb14ab3192323e5e2cb0ad7f5564c514c82fd3b63e8e15dffb689d40dbefa186a22b9041654a77c66f903ca107c856c9985c848a5ca77e94847a238b83a8a2
7
- data.tar.gz: e71ae51ec669c61dc162cb7b598f9e66ac396cfe948069f7193340b64902bb3ea35f162768a1299e3babfe7fad892095e02a90874ccba67a696cb090e4d4ca74
6
+ metadata.gz: 4e3536a448117c3c53b26899cc02457dff0326386d187fd1f538d1169f677a2d231a1b3238ace6d53cca7ebbe0effd4b0319c59ec4477f90ec691a571a4c62ea
7
+ data.tar.gz: 32ecff8bb25917bd35605764f4e34c8d52f17e5d89be17738aa5c5230bac8fec4bab40d69c32e470473ad1425338197e0c201b6026985443f6ed4d14a383d4b9
@@ -68,6 +68,11 @@ module Glib::Json::Libs
68
68
  redirect_to url
69
69
  end
70
70
  format.json do
71
+ if __json_ui_rendering?
72
+ redirect_to url
73
+ return
74
+ end
75
+
71
76
  json_ui_redirect_to url
72
77
  end
73
78
  end
@@ -91,6 +96,10 @@ module Glib::Json::Libs
91
96
 
92
97
  REDIRECT_BACK_KEY = :glib_return_to_url
93
98
 
99
+ def json_ui_save_return_url(url = nil)
100
+ session[REDIRECT_BACK_KEY] = url || url_for(params.to_unsafe_h.merge(format: nil))
101
+ end
102
+
94
103
  def glib_handle_401(sign_in_url)
95
104
  if !glib_json_dialog_mode? && request.get?
96
105
  session[REDIRECT_BACK_KEY] = url_for(params.to_unsafe_h.merge(format: nil))
@@ -172,10 +181,29 @@ module Glib::Json::Libs
172
181
  }
173
182
  end
174
183
 
175
- def glib_json_handle_500(exception)
176
- if json_ui_activated? && Rails.env.production?
177
- Rollbar.error(exception, :use_exception_level_filters => true) if defined?(Rollbar)
178
- render file: Rails.root.join('public', '500.html'), status: :internal_server_error
184
+ def glib_json_handle_500(exception, preview_mode)
185
+ if json_ui_activated?
186
+ if Rails.env.production? || preview_mode
187
+ if defined?(Rollbar) && !preview_mode
188
+ Rollbar.error(exception, :use_exception_level_filters => true)
189
+ end
190
+
191
+ render file: Rails.root.join('public', '500.html'), status: :internal_server_error
192
+ else
193
+ raise exception
194
+ end
195
+ else
196
+ raise exception
197
+ end
198
+ end
199
+
200
+ def glib_json_handle_404(exception, preview_mode)
201
+ if json_ui_activated?
202
+ if Rails.env.production? || preview_mode
203
+ render file: Rails.root.join('public', '404.html'), status: :not_found
204
+ else
205
+ raise exception
206
+ end
179
207
  else
180
208
  raise exception
181
209
  end
@@ -262,18 +290,16 @@ module Glib::Json::Libs
262
290
 
263
291
  # Call this before other rescues. Later rescue_from statements will take precedence, so more specific
264
292
  # rescues have to be declared later.
265
- def json_libs_rescue_500
293
+ def json_libs_rescue_500(preview_mode: false)
266
294
  rescue_from StandardError do |exception|
267
- glib_json_handle_500(exception)
295
+ glib_json_handle_500(exception, preview_mode)
268
296
  end
269
297
  end
270
298
 
271
- def json_libs_rescue_404
272
- # Removed because it doesn't seem to offer anything extra
273
- # rescue_from ActiveRecord::RecordNotFound do |exception|
274
- # glib_json_handle_404
275
- # end
299
+ def json_libs_rescue_404(preview_mode: false)
300
+ rescue_from ActiveRecord::RecordNotFound do |exception|
301
+ glib_json_handle_404(exception, preview_mode)
302
+ end
276
303
  end
277
-
278
304
  end
279
305
  end
File without changes
File without changes
@@ -5,6 +5,10 @@ class Glib::JsonUi::ActionBuilder
5
5
  action :onFocus
6
6
  end
7
7
 
8
+ class Blur < Action
9
+ action :onBlur
10
+ end
11
+
8
12
  class Reset < Action
9
13
  string :targetId
10
14
  action :onReset
File without changes
File without changes
File without changes
@@ -101,6 +101,7 @@ class Glib::JsonUi::ViewBuilder
101
101
  string :rightText
102
102
  action :onTypeStart
103
103
  action :onTypeEnd
104
+ action :onClick
104
105
  end
105
106
 
106
107
  class Number < Text
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -5,9 +5,11 @@ markdown = '## Emphasis' + "\n" +
5
5
  "\n" +
6
6
  '~~Strikethrough~~' + "\n"
7
7
 
8
- options = {
9
- updateExisting: true
10
- }
8
+ options = {}
9
+ if (update_existing = local_assigns[:update_existing])
10
+ options[:updateExisting] = update_existing
11
+ end
12
+
11
13
  action.send "dialogs_#{dialog_mode}", **options, content: ->(dialog) do
12
14
  dialog.body padding: glib_json_padding_body, childViews: ->(body) do
13
15
  body.markdown text: markdown
@@ -8,5 +8,12 @@ page.scroll childViews: ->(scroll) do
8
8
  end
9
9
 
10
10
  page.on load: ->(action) do
11
- render 'json_ui/garage/actions/dialogs_show', json: json, action: action, dialog_mode: :show
11
+ action.timeouts_set interval: 500, onTimeout: ->(subaction) do
12
+ render \
13
+ 'json_ui/garage/actions/dialogs_show',
14
+ json: json,
15
+ action: subaction,
16
+ dialog_mode: :show,
17
+ update_existing: true
18
+ end
12
19
  end
@@ -82,7 +82,8 @@ page.form \
82
82
  form.h2 text: 'Country'
83
83
  form.spacer height: 6
84
84
  region_field = { name: 'user[city]', label: 'City' }
85
- form.fields_country name: 'user[country]', width: 'matchParent', label: 'Country', region: region_field
85
+ form.fields_country name: 'user[country]', width: 'matchParent', label: 'Country', region: nil
86
+ form.fields_country name: 'user[country_with_region]', width: 'matchParent', label: 'Country with region', region: region_field
86
87
 
87
88
  form.spacer height: 20
88
89
  form.h2 text: 'Map'
@@ -72,6 +72,14 @@ page.form url: json_ui_garage_url(path: 'forms/generic_post'), method: 'post', p
72
72
  end
73
73
  accessory.footer padding: { x: 16, y: 10 }, childViews: ->(footer) do
74
74
  footer.label text: 'Footer'
75
+ footer.spacer height: 14
76
+ footer.label text: 'Click me', onClick: ->(action) do
77
+ action.components_findClosest view: 'fields/select', onFind: ->(subaction) do
78
+ subaction.components_set data: { value: 'pt' }, onSet: ->(subsubaction) do
79
+ subsubaction.fields_blur
80
+ end
81
+ end
82
+ end
75
83
  end
76
84
  end
77
85
 
File without changes
File without changes
File without changes
File without changes
@@ -19,13 +19,19 @@ if room.present?
19
19
  }
20
20
  ],
21
21
  onOpen: ->(action) do
22
- action.labels_set targetId: 'label-1', text: "Room ##{room.upcase}"
22
+ action.components_update targetId: 'label-1', views: ->(view) do
23
+ view.p text: "Room ##{room.upcase}"
24
+ end
23
25
  end,
24
26
  onClose: ->(action) do
25
- action.labels_set targetId: 'label-1', text: "Room ##{room.upcase} (OFF)"
27
+ action.components_update targetId: 'label-1', views: ->(view) do
28
+ view.p text: "Room ##{room.upcase} (OFF)"
29
+ end
26
30
  end,
27
31
  onError: ->(action) do
28
- action.labels_set targetId: 'label-1', text: "Room ##{room.upcase} (ERROR)"
32
+ action.components_update targetId: 'label-1', views: ->(view) do
33
+ view.p text: "Room ##{room.upcase} (ERROR)"
34
+ end
29
35
  end
30
36
  end
31
37
 
File without changes
File without changes
File without changes
File without changes