glib-web 4.0.0 → 4.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (79) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/concerns/glib/json/libs.rb +4 -4
  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/sheets.rb +0 -0
  7. data/app/helpers/glib/json_ui/analytics_helper.rb +0 -0
  8. data/app/helpers/glib/json_ui/generic_builders.rb +0 -0
  9. data/app/helpers/glib/json_ui/view_builder/fields.rb +7 -2
  10. data/app/helpers/glib/json_ui/view_builder/panels.rb +32 -2
  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_oauth_post.json.jbuilder +0 -0
  19. data/app/views/json_ui/garage/forms/checkboxes.json.jbuilder +5 -0
  20. data/app/views/json_ui/garage/forms/dynamic_select_data.json.jbuilder +0 -0
  21. data/app/views/json_ui/garage/forms/generic_post.json.jbuilder +0 -0
  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/forms/text_validation.json.jbuilder +1 -0
  27. data/app/views/json_ui/garage/home/blank.json.jbuilder +0 -0
  28. data/app/views/json_ui/garage/home/slow.json.jbuilder +0 -0
  29. data/app/views/json_ui/garage/lists/_autoload_section.json.jbuilder +1 -1
  30. data/app/views/json_ui/garage/lists/autoload_all.json.jbuilder +0 -0
  31. data/app/views/json_ui/garage/lists/autoload_as_needed.json.jbuilder +0 -0
  32. data/app/views/json_ui/garage/lists/chat_ui.json.jbuilder +0 -0
  33. data/app/views/json_ui/garage/lists/fab.json.jbuilder +0 -0
  34. data/app/views/json_ui/garage/notifications/web_socket.json.jbuilder +0 -0
  35. data/app/views/json_ui/garage/pages/custom_style_class.json.jbuilder +0 -0
  36. data/app/views/json_ui/garage/pages/full_width.json.jbuilder +0 -0
  37. data/app/views/json_ui/garage/pages/full_width_height.json.jbuilder +0 -0
  38. data/app/views/json_ui/garage/pages/layout.json.jbuilder +0 -0
  39. data/app/views/json_ui/garage/pages/loading_indicator.json.jbuilder +0 -0
  40. data/app/views/json_ui/garage/pages/nested_scroll.json.jbuilder +0 -0
  41. data/app/views/json_ui/garage/pages/redirect_onload.json.jbuilder +0 -0
  42. data/app/views/json_ui/garage/panels/_styled.json.jbuilder +0 -0
  43. data/app/views/json_ui/garage/panels/card.json.jbuilder +0 -0
  44. data/app/views/json_ui/garage/panels/custom.json.jbuilder +0 -0
  45. data/app/views/json_ui/garage/panels/outlined.json.jbuilder +0 -0
  46. data/app/views/json_ui/garage/panels/ul.json.jbuilder +19 -4
  47. data/app/views/json_ui/garage/services/dynamic_text.json.jbuilder +0 -0
  48. data/app/views/json_ui/garage/services/image.json.jbuilder +0 -0
  49. data/app/views/json_ui/garage/services/index.json.jbuilder +0 -0
  50. data/app/views/json_ui/garage/tables/_autoload_section.json.jbuilder +0 -0
  51. data/app/views/json_ui/garage/tables/autoload_all.json.jbuilder +0 -0
  52. data/app/views/json_ui/garage/tables/autoload_as_needed.json.jbuilder +0 -0
  53. data/app/views/json_ui/garage/tables/export_import.json.jbuilder +0 -0
  54. data/app/views/json_ui/garage/tables/index.json.jbuilder +0 -0
  55. data/app/views/json_ui/garage/views/calendar_data.json.jbuilder +0 -0
  56. data/app/views/json_ui/garage/views/links.json.jbuilder +1 -1
  57. data/app/views/json_ui/garage/views/map_data.json.jbuilder +0 -0
  58. data/app/views/json_ui/garage/views/multimedia.json.jbuilder +0 -0
  59. data/app/views/layouts/json_ui/no_custom.html.erb +0 -0
  60. data/lib/generators/glib/install_generator.rb +0 -0
  61. data/lib/generators/templates/20191017062519_create_texts.rb +0 -0
  62. data/lib/generators/templates/20191024063257_add_scope_to_texts.rb +0 -0
  63. data/lib/generators/templates/20191112095018_add_lang_to_texts.rb +0 -0
  64. data/lib/generators/templates/20191126071051_create_active_storage_tables.active_storage.rb +0 -0
  65. data/lib/generators/templates/database.yml +0 -0
  66. data/lib/generators/templates/dynamic_text.rb +0 -0
  67. data/lib/glib/dynamic_text/config.rb +0 -0
  68. data/lib/glib/dynamic_text.rb +0 -0
  69. data/lib/glib/json_crawler/action_crawler.rb +0 -0
  70. data/lib/glib/json_crawler/action_crawlers/action_http.rb +0 -0
  71. data/lib/glib/json_crawler/action_crawlers/dialogs_alert.rb +0 -0
  72. data/lib/glib/json_crawler/action_crawlers/menu.rb +0 -0
  73. data/lib/glib/json_crawler/action_crawlers/run_multiple.rb +0 -0
  74. data/lib/glib/json_crawler/action_crawlers/windows_open.rb +0 -0
  75. data/lib/glib/json_crawler/coverage.rb +0 -0
  76. data/lib/glib/test_helpers.rb +2 -0
  77. data/lib/glib/value.rb +0 -0
  78. data/lib/glib/version.rb +0 -0
  79. metadata +3 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 559c94d3c5c18214daed6e708f570879f069e39aabba1f08d248f2d0e2d62bf2
4
- data.tar.gz: 6d3cc151c5226a7741a5508d27a77463ea64e09e5db08601ff3927d8a5c9191c
3
+ metadata.gz: 5022fe611c19e51340f145ab4bb5577c208211186b575a2e784f8f50de06860c
4
+ data.tar.gz: c1fc17633202ac17023f5040129165779283654334212168933608ed7df12e4f
5
5
  SHA512:
6
- metadata.gz: bacdb36e88f43a3ce8ce1ff7be69b14414024dfa34ac41c51d8dacc72f23122f09dcfe4400c138134245b4fa785d6e5075c3f6573bc6d3d46820b4fc80ab2ec5
7
- data.tar.gz: 255300aeb08012f9fdb26eda37c8f288728cbfa8cca9ca0400287d8ad1bc3fff416946c3044716d486fb0194d68993127aebe59ddd69809658b8087bb68f42a2
6
+ metadata.gz: d42b359a6e270fcdadfb8592af408974defc48bbd632d9cf91116f3a37fba4c47ac4bd54f53417c07ccb36afc883b1cbb72cd4afc1e0378b7a7dff283079c365
7
+ data.tar.gz: 2b96d286b67a6e6faa900a474ea93d34a060eef45c0c1d85a493993757497ba8c0a14a624ba3e0764ad9c599bf35518c761f3c061af7a9ec20fa22c6948fd8ae
@@ -74,7 +74,7 @@ module Glib::Json::Libs
74
74
  url.sub(/[\&\?]format=json/, '');
75
75
  end
76
76
 
77
- def glib_redirect_to(url, return_to_previous: false)
77
+ def glib_redirect_to(url, return_to_previous: false, status: :ok)
78
78
  url = __delete_redirect_back_url(url) if return_to_previous
79
79
 
80
80
  respond_to do |format|
@@ -87,7 +87,7 @@ module Glib::Json::Libs
87
87
  return
88
88
  end
89
89
 
90
- json_ui_redirect_to url
90
+ json_ui_redirect_to url, status: status
91
91
  end
92
92
  end
93
93
  end
@@ -235,7 +235,7 @@ module Glib::Json::Libs
235
235
  end
236
236
  end
237
237
 
238
- def json_ui_redirect_to(url)
238
+ def json_ui_redirect_to(url, status: :ok)
239
239
  # Use windows_reload instead of windows_open so clicking back will skip the bridging page.
240
240
  # on_response = { action: 'windows/open', url: url }
241
241
  on_response = { action: 'windows/reload', url: url }
@@ -248,7 +248,7 @@ module Glib::Json::Libs
248
248
 
249
249
  # Use onResponse because it is harder to guarantee that `onLoad` executes in Vuejs because it relies
250
250
  # on app.vue's reactivity.
251
- render json: { onResponse: on_response }
251
+ render json: { onResponse: on_response }, status: status
252
252
  end
253
253
 
254
254
  module ClassMethods
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -53,6 +53,10 @@ class Glib::JsonUi::ViewBuilder
53
53
  @prop = prop
54
54
  end
55
55
 
56
+ def autoValidate(autoValidate)
57
+ @autoValidate = autoValidate
58
+ end
59
+
56
60
  # Override
57
61
  def created
58
62
  if @prop && (form = page.current_form)
@@ -79,8 +83,7 @@ class Glib::JsonUi::ViewBuilder
79
83
  # - Placeholder competes with label for space
80
84
  json.placeholder @placeholder if @placeholder
81
85
 
82
- # TODO: Add a flag so the framework's user can turn it on and off.
83
- # json.validation @validation if @validation
86
+ json.validation @validation if @autoValidate
84
87
  end
85
88
 
86
89
  # To be overridden
@@ -139,6 +142,7 @@ class Glib::JsonUi::ViewBuilder
139
142
  string :text
140
143
  color :color
141
144
  icon :icon
145
+ bool :disableIfFormInvalid
142
146
  end
143
147
 
144
148
  class CheckGroup < AbstractField
@@ -317,6 +321,7 @@ class Glib::JsonUi::ViewBuilder
317
321
 
318
322
  string :storagePrefix
319
323
  hash :metadata
324
+ hash :tags
320
325
 
321
326
  required :accepts, :directUploadUrl
322
327
 
@@ -121,10 +121,40 @@ class Glib::JsonUi::ViewBuilder
121
121
  def self.field_validation(model, prop)
122
122
  validations = {}
123
123
  model.class.validators_on(prop).each do |validator|
124
- if validator.kind == :presence
125
- validations[:required] = { message: 'Required' }
124
+ validations[validator.kind] = validator.options.except(:if, :unless)
125
+ validations[validator.kind][:message] = validator.options[:message]
126
+ case validator.kind
127
+ when :presence
128
+ validations[validator.kind][:message] ||= I18n.t('errors.messages.present')
129
+ when :acceptance
130
+ validations[validator.kind][:message] ||= I18n.t('errors.messages.accepted')
131
+ when :confirmation
132
+ # raise NotImplemented
133
+ when :numericality
134
+ # raise NotImplemented
135
+ when :comparison
136
+ comparison = validator.options.first[0]
137
+ validations[validator.kind][:message] ||= I18n.t("errors.messages.#{comparison}")
138
+ when :format
139
+ validations[validator.kind][:message] ||= I18n.t('errors.messages.invalid')
140
+ when :inclusion
141
+ validations[validator.kind][:message] ||= I18n.t('errors.messages.inclusion')
142
+ when :exclusion
143
+ validations[validator.kind][:message] ||= I18n.t('errors.messages.exclusion')
144
+ when :length
145
+ validations[validator.kind][:message] = {
146
+ too_long: I18n.t('errors.messages.too_long'),
147
+ wrong_length: I18n.t('errors.messages.wrong_length'),
148
+ too_short: I18n.t('errors.messages.too_short')
149
+ }
126
150
  end
127
151
  end
152
+
153
+ if validations[:presence].present?
154
+ validations[:required] = validations[:presence]
155
+ validations.delete(:presence)
156
+ end
157
+
128
158
  validations
129
159
  end
130
160
 
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -32,6 +32,11 @@ page.scroll childViews: ->(scroll) do
32
32
  group.fields_check checkValue: 4, label: 'Photography'
33
33
  end
34
34
 
35
+ form.spacer height: 20
36
+ form.h2 text: 'Check without group'
37
+ form.spacer height: 4
38
+ form.fields_check name: 'user[driver]', label: 'Do you have driver license?'
39
+
35
40
  form.spacer height: 20
36
41
  form.button text: 'Submit', onClick: ->(action) { action.forms_submit }
37
42
  end
@@ -106,4 +106,5 @@ page.form \
106
106
 
107
107
  form.spacer height: 30
108
108
  form.fields_submit text: 'Submit'
109
+ form.fields_submit text: 'Submit (disable if form invalid)', disableIfFormInvalid: true
109
110
  end
File without changes
File without changes
@@ -11,7 +11,7 @@ section.rows builder: ->(row) do
11
11
  array.each do |i|
12
12
  index = page_index * batch_count + i
13
13
  if local_assigns[:reorder]
14
- row.thumbnail title: "Item #{index}", id: "item_#{index}"
14
+ row.thumbnail title: "Item #{index}"
15
15
  else
16
16
  row.thumbnail title: "Item #{index}", subtitle: "Sub Item #{index}", subsubtitle: "Sub Sub Item #{index}"
17
17
  end
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -38,10 +38,25 @@ page.scroll padding: glib_json_padding_body, childViews: ->(scroll) do
38
38
  action.windows_open url: json_ui_garage_url(path: 'home/blank')
39
39
  end
40
40
 
41
- ul.button icon: 'keyboard_arrow_down', text: 'Level 2', styleClass: 'link', childButtons: ->(menu) do
42
- menu.button text: 'Dropdown item 1'
43
- menu.button text: 'Dropdown item 2'
44
- menu.button text: 'Dropdown item 3'
41
+ ul.button icon: 'keyboard_arrow_down', text: 'Level 2', styleClass: 'link', onClick: ->(action) do
42
+ action.popovers_show \
43
+ key: 'menu',
44
+ placement: 'bottom-start',
45
+ content: ->(dialog) do
46
+ dialog.body childViews: ->(view) do
47
+ view.panels_responsive styleClass: 'popover-menu', width: 200, childViews: ->(res) do
48
+ res.label text: 'Item 1', styleClass: 'popover-menu-item', onClick: ->(saction) do
49
+ saction.popovers_close key: 'menu'
50
+ end
51
+ res.label text: 'Item 2', styleClass: 'popover-menu-item', onClick: ->(saction) do
52
+ saction.popovers_close key: 'menu'
53
+ end
54
+ res.label text: 'Item 3', styleClass: 'popover-menu-item', onClick: ->(saction) do
55
+ saction.popovers_close key: 'menu'
56
+ end
57
+ end
58
+ end
59
+ end
45
60
  end
46
61
  ul.label text: 'Level 3'
47
62
  end
File without changes
@@ -58,7 +58,7 @@ json_ui_page json do |page|
58
58
  scroll.spacer height: 20
59
59
  scroll.h2 text: 'Icon with onClick'
60
60
  scroll.spacer height: 6
61
- scroll.icon spec: 'info', onClick: ->(action) do
61
+ scroll.icon name: 'info', onClick: ->(action) do
62
62
  action.windows_open url: json_ui_garage_url(path: 'home/blank')
63
63
  end
64
64
 
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
@@ -20,7 +20,9 @@ module Glib
20
20
  end
21
21
  end
22
22
 
23
+ # See https://stackoverflow.com/questions/51583321/it-is-safe-to-use-lvh-me-instead-of-localhost-for-testing
23
24
  HOST = 'www.lvh.me:3000'
25
+
24
26
  # LOG_DIR = File.expand_path(
25
27
  # File.join(File.dirname(__FILE__), 'integration/json_ui_crawler_test_results')
26
28
  # )
data/lib/glib/value.rb CHANGED
File without changes
data/lib/glib/version.rb CHANGED
File without changes
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.0.0
4
+ version: 4.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - ''
@@ -352,7 +352,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
352
352
  - !ruby/object:Gem::Version
353
353
  version: '0'
354
354
  requirements: []
355
- rubygems_version: 3.4.6
355
+ rubyforge_project:
356
+ rubygems_version: 2.7.6
356
357
  signing_key:
357
358
  specification_version: 4
358
359
  summary: ''