glib-web 0.14.5 → 0.15.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (100) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/concerns/glib/json/new_dynamic_text.rb +0 -0
  3. data/app/controllers/concerns/glib/json/traversal.rb +6 -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/forms_helper.rb +0 -0
  7. data/app/helpers/glib/json_ui/action_builder/dialogs.rb +0 -6
  8. data/app/helpers/glib/json_ui/action_builder/sheets.rb +0 -0
  9. data/app/helpers/glib/json_ui/action_builder/snackbars.rb +0 -0
  10. data/app/helpers/glib/json_ui/analytics_helper.rb +0 -0
  11. data/app/helpers/glib/json_ui/generic_builders.rb +0 -0
  12. data/app/helpers/glib/json_ui/page_helper.rb +12 -2
  13. data/app/helpers/glib/json_ui/table_builders.rb +0 -0
  14. data/app/helpers/glib/urls_helper.rb +0 -0
  15. data/app/models/glib/active_storage/attachment.rb +0 -0
  16. data/app/models/glib/active_storage/blob.rb +0 -0
  17. data/app/models/glib/dynamic_text_record.rb +0 -0
  18. data/app/models/glib/text.rb +0 -0
  19. data/app/validators/email_typo_validator.rb +0 -0
  20. data/app/validators/email_validator.rb +0 -0
  21. data/app/validators/url_validator.rb +0 -0
  22. data/app/views/json_ui/garage/actions/_dialogs.json.jbuilder +1 -5
  23. data/app/views/json_ui/garage/actions/_dialogs_show.json.jbuilder +1 -1
  24. data/app/views/json_ui/garage/actions/_panels.json.jbuilder +0 -0
  25. data/app/views/json_ui/garage/actions/_reload.json.jbuilder +0 -0
  26. data/app/views/json_ui/garage/actions/_sheets.json.jbuilder +0 -0
  27. data/app/views/json_ui/garage/actions/_snackbars.json.jbuilder +0 -0
  28. data/app/views/json_ui/garage/actions/dialogs_oauth_post.json.jbuilder +0 -0
  29. data/app/views/json_ui/garage/forms/dynamic_group.json.jbuilder +0 -0
  30. data/app/views/json_ui/garage/forms/dynamic_select_data.json.jbuilder +0 -0
  31. data/app/views/json_ui/garage/forms/floating_submit.json.jbuilder +0 -0
  32. data/app/views/json_ui/garage/forms/{full_window_form.json.jbuilder → full_page_form.json.jbuilder} +2 -5
  33. data/app/views/json_ui/garage/forms/generic_post.json.jbuilder +0 -0
  34. data/app/views/json_ui/garage/forms/index.json.jbuilder +5 -5
  35. data/app/views/json_ui/garage/forms/show_hide.json.jbuilder +69 -0
  36. data/app/views/json_ui/garage/forms/submission_flow.json.jbuilder +0 -0
  37. data/app/views/json_ui/garage/forms/submission_flow_post.json.jbuilder +0 -0
  38. data/app/views/json_ui/garage/forms/submission_indicator.json.jbuilder +0 -0
  39. data/app/views/json_ui/garage/forms/submission_indicator_post.json.jbuilder +0 -0
  40. data/app/views/json_ui/garage/home/blank.json.jbuilder +0 -0
  41. data/app/views/json_ui/garage/home/slow.json.jbuilder +0 -0
  42. data/app/views/json_ui/garage/lists/autoload_all.json.jbuilder +0 -0
  43. data/app/views/json_ui/garage/lists/autoload_as_needed.json.jbuilder +0 -0
  44. data/app/views/json_ui/garage/lists/chat_ui.json.jbuilder +0 -0
  45. data/app/views/json_ui/garage/lists/fab.json.jbuilder +0 -0
  46. data/app/views/json_ui/garage/notifications/web_socket.json.jbuilder +0 -0
  47. data/app/views/json_ui/garage/pages/flat_centered.json.jbuilder +0 -0
  48. data/app/views/json_ui/garage/pages/full_width.json.jbuilder +0 -0
  49. data/app/views/json_ui/garage/pages/full_width_height.json.jbuilder +0 -0
  50. data/app/views/json_ui/garage/pages/index.json.jbuilder +0 -0
  51. data/app/views/json_ui/garage/pages/layout.json.jbuilder +0 -0
  52. data/app/views/json_ui/garage/pages/lifecycle_hooks.json.jbuilder +0 -0
  53. data/app/views/json_ui/garage/pages/loading_indicator.json.jbuilder +0 -0
  54. data/app/views/json_ui/garage/pages/nested_scroll.json.jbuilder +0 -0
  55. data/app/views/json_ui/garage/panels/_styled.json.jbuilder +0 -0
  56. data/app/views/json_ui/garage/panels/card.json.jbuilder +0 -0
  57. data/app/views/json_ui/garage/panels/custom.json.jbuilder +0 -0
  58. data/app/views/json_ui/garage/panels/outlined.json.jbuilder +0 -0
  59. data/app/views/json_ui/garage/services/dynamic_text.json.jbuilder +0 -0
  60. data/app/views/json_ui/garage/services/image.json.jbuilder +0 -0
  61. data/app/views/json_ui/garage/services/index.json.jbuilder +0 -0
  62. data/app/views/json_ui/garage/tables/_autoload_section.json.jbuilder +0 -0
  63. data/app/views/json_ui/garage/tables/autoload_all.json.jbuilder +0 -0
  64. data/app/views/json_ui/garage/tables/autoload_as_needed.json.jbuilder +0 -0
  65. data/app/views/json_ui/garage/tables/export_import.json.jbuilder +0 -0
  66. data/app/views/json_ui/garage/tables/index.json.jbuilder +0 -0
  67. data/app/views/json_ui/garage/views/calendar_data.json.jbuilder +0 -0
  68. data/app/views/json_ui/garage/views/links.json.jbuilder +0 -0
  69. data/app/views/json_ui/garage/views/map_cluster_data.json.jbuilder +0 -0
  70. data/app/views/json_ui/garage/views/map_data.json.jbuilder +0 -0
  71. data/app/views/json_ui/garage/views/multimedia.json.jbuilder +0 -0
  72. data/config/routes.rb +0 -0
  73. data/lib/generators/glib/install_generator.rb +0 -0
  74. data/lib/generators/templates/20191017062519_create_texts.rb +0 -0
  75. data/lib/generators/templates/20191024063257_add_scope_to_texts.rb +0 -0
  76. data/lib/generators/templates/20191112095018_add_lang_to_texts.rb +0 -0
  77. data/lib/generators/templates/20191126071051_create_active_storage_tables.active_storage.rb +0 -0
  78. data/lib/generators/templates/database.yml +0 -0
  79. data/lib/generators/templates/dynamic_text.rb +0 -0
  80. data/lib/glib/crypt/utils.rb +0 -0
  81. data/lib/glib/crypt.rb +0 -0
  82. data/lib/glib/dynamic_text/config.rb +0 -0
  83. data/lib/glib/dynamic_text.rb +0 -0
  84. data/lib/glib/engine.rb +0 -0
  85. data/lib/glib/json_crawler/action_crawler.rb +0 -0
  86. data/lib/glib/json_crawler/action_crawlers/action_http.rb +0 -0
  87. data/lib/glib/json_crawler/action_crawlers/forms_submit.rb +13 -1
  88. data/lib/glib/json_crawler/action_crawlers/menu.rb +0 -0
  89. data/lib/glib/json_crawler/action_crawlers/nav_initiate.rb +0 -0
  90. data/lib/glib/json_crawler/action_crawlers/run_multiple.rb +0 -0
  91. data/lib/glib/json_crawler/action_crawlers/windows_open.rb +2 -0
  92. data/lib/glib/json_crawler/coverage.rb +0 -0
  93. data/lib/glib/json_crawler/router.rb +9 -3
  94. data/lib/glib/json_crawler.rb +0 -0
  95. data/lib/glib/mailer_tester.rb +0 -0
  96. data/lib/glib/value.rb +0 -0
  97. data/lib/glib/version.rb +0 -0
  98. data/lib/glib-web.rb +0 -0
  99. data/lib/tasks/db.rake +0 -0
  100. metadata +4 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8a62b186979dd157da8572e5b70ff225c19ea7c17e1e8bc5e09f2112f2badc11
4
- data.tar.gz: ebbc9e67417afb0a0543f018cef6f57b2010ee500c751ff7119a14fc1a73939b
3
+ metadata.gz: 884f9ef9236368bb5739d56715d0aca1196e6d85f905ad258aaf2d7942333d07
4
+ data.tar.gz: 3c870f312d7cb7b921ca4ff244d247d7c9b7e7f94ae359cd93696f6544c9682c
5
5
  SHA512:
6
- metadata.gz: 3fb285f688abaf2ce2836665a5705d30d35f5b1be67c477bf5b7f6e15aac58b059f44d2723a710512385d95eae0d51c8c95add3bd320aef542fb6e90f25557e0
7
- data.tar.gz: 2c835ce86a20ffe1b571953cc7950f9e2c3abb8ebb328f3467803e4a2d9e739da203c47e7e4fd67013741ce81df73a3e6ae0b1feadaccb0f1a7ac876a3825d46
6
+ metadata.gz: 34f43053111cf3304a15a0311fc0b85031554b7a0c3be65b7795ebab0d438850ad7550eb977c33cc099ba09ea2d06258880aed767b89398b6fe2a8d80327f7f9
7
+ data.tar.gz: f332e88b5d80b56c7b5fef95fce6551a7ca13a1a7a05b71626161b344d02f594a98c74b19e97d3247e4260c0cb5ab208ec83ac21d516d9ceb644706ddf1d6542
@@ -39,6 +39,12 @@ module Glib::Json::Traversal
39
39
  @forms = []
40
40
  end
41
41
 
42
+ def parse_page(spec)
43
+ if (form = spec['fullPageForm'])
44
+ @forms << form
45
+ end
46
+ end
47
+
42
48
  def traverse_multiple(views, block)
43
49
  if views.is_a? Array
44
50
  views.each do |view|
File without changes
File without changes
File without changes
@@ -26,8 +26,6 @@ class Glib::JsonUi::ActionBuilder
26
26
  class Show < Action
27
27
  panels_builder :content, :body
28
28
  bool :showClose
29
- string :fullscreen # mobile, always
30
- length :width
31
29
 
32
30
  # Future plan
33
31
  # panels_builder :content, :body, :footer
@@ -36,16 +34,12 @@ class Glib::JsonUi::ActionBuilder
36
34
  class Open < Action
37
35
  string :url, cache: true
38
36
  bool :showClose
39
- string :fullscreen
40
- length :width
41
37
  end
42
38
 
43
39
  class Reload < Action
44
40
  panels_builder :content, :body
45
41
  string :url, cache: true
46
42
  bool :showClose
47
- string :fullscreen # mobile, always
48
- length :width
49
43
  end
50
44
 
51
45
  class Close < Action
File without changes
File without changes
File without changes
File without changes
@@ -174,9 +174,19 @@ module Glib
174
174
  end
175
175
 
176
176
  def form(options = {})
177
- scroll childViews: ->(scroll) do
178
- @view_builder.add_view('panels_form', options.reverse_merge(width: 'matchParent'))
177
+ form = Glib::JsonUi::ViewBuilder::Panels::Form.new(json, self)
178
+ form.childViews(->(view_builder) {})
179
+ panel_options = options.slice!(:url, :method, :local, :onSubmit, :paramNameForFormData, :model)
180
+
181
+ json.fullPageForm do
182
+ json.view 'panels/fullPageForm'
183
+ form.props(options)
179
184
  end
185
+
186
+ # So that the containing fields have context (e.g. can use form's model for naming).
187
+ self.current_form = form
188
+ scroll panel_options
189
+ self.current_form = nil
180
190
  end
181
191
 
182
192
  def data(options = {})
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
@@ -59,11 +59,7 @@ section.rows builder: ->(template) do
59
59
  end
60
60
 
61
61
  template.thumbnail title: 'dialogs/open', onClick: ->(action) do
62
- action.dialogs_open width: 950, url: json_ui_garage_url(path: 'forms/basic', mode: 'dialog')
63
- end
64
-
65
- template.thumbnail title: 'dialogs/open (fullscreen on mobile)', onClick: ->(action) do
66
- action.dialogs_open fullscreen: 'mobile', url: json_ui_garage_url(path: 'forms/basic', mode: 'dialog')
62
+ action.dialogs_open url: json_ui_garage_url(path: 'forms/basic', mode: 'dialog')
67
63
  end
68
64
 
69
65
  template.thumbnail title: 'dialogs/oauth', onClick: ->(action) do
@@ -13,7 +13,7 @@ action.send "dialogs_#{dialog_mode}", showClose: true, content: ->(dialog) do
13
13
  split.left childViews: ->(left) do
14
14
  left.panels_horizontal height: 'matchParent', align: 'middle', childViews: ->(horizontal) do
15
15
  horizontal.label text: 'Open current', onClick: ->(subaction) do
16
- subaction.dialogs_reload width: 900, fullscreen: 'mobile', url: json_ui_garage_url(path: 'forms/basic', mode: 'dialog_reload')
16
+ subaction.dialogs_reload url: json_ui_garage_url(path: 'forms/basic', mode: 'dialog_reload')
17
17
  end
18
18
  end
19
19
  end
@@ -4,16 +4,13 @@ page = json_ui_page json
4
4
 
5
5
  render "#{@path_prefix}/nav_menu", json: json, page: page
6
6
 
7
- # The form will be automatically injected into the window.
8
- #page.template 'full_window_form'
9
-
10
- # TODO: This needs to produce page-level form attributes
11
7
  page.form url: json_ui_garage_url(path: 'forms/basic_post'), method: 'post', padding: glib_json_padding_body, childViews: ->(form) do
12
- # page.scroll padding: glib_json_padding_body, childViews: ->(form) do
13
8
  form.fields_text name: 'user[name]', width: 'matchParent', label: 'Name'
14
9
  form.fields_password name: 'user[password]', width: 'matchParent', label: 'Password'
15
10
  end
16
11
 
17
12
  page.footer padding: glib_json_padding_body, backgroundColor: '#b3bac2', childViews: ->(footer) do
13
+ footer.label text: 'This button will submit the form above because this whole page is wrapped in a giant form.'
14
+ footer.spacer height: 6
18
15
  footer.fields_submit text: 'Submit'
19
16
  end
@@ -91,11 +91,11 @@ page.list sections: [
91
91
  action.windows_open url: json_ui_garage_url(path: 'forms/styled_boxes')
92
92
  end
93
93
  end
94
- # section.rows builder: ->(template) do
95
- # template.thumbnail title: 'Full Window', onClick: ->(action) do
96
- # action.windows_open url: json_ui_garage_url(path: 'forms/full_window_form')
97
- # end
98
- # end
94
+ section.rows builder: ->(template) do
95
+ template.thumbnail title: 'Full Page', onClick: ->(action) do
96
+ action.windows_open url: json_ui_garage_url(path: 'forms/full_page_form')
97
+ end
98
+ end
99
99
  end, ->(section) do
100
100
  section.header padding: glib_json_padding_list, childViews: ->(header) do
101
101
  header.h2 text: 'Web Only'
@@ -152,3 +152,72 @@ page.form url: json_ui_garage_url(path: 'forms/generic_post'), method: 'post', p
152
152
  form.fields_submit text: 'Submit'
153
153
  form.spacer height: 40
154
154
  end
155
+
156
+ # if text.length > 100
157
+ # inner_column.panels_form local: true, childViews: ->(form) do
158
+ # form.markdown \
159
+ # text: text,
160
+ # styleClasses: ['many-line'],
161
+ # showIf: {
162
+ # "!=": [
163
+ # {
164
+ # "var": 'expand[bundle_description]'
165
+ # },
166
+ # 'expand'
167
+ # ]
168
+ # }
169
+ # form.markdown \
170
+ # text: text,
171
+ # showIf: {
172
+ # "==": [
173
+ # {
174
+ # "var": 'expand[bundle_description]'
175
+ # },
176
+ # 'expand'
177
+ # ]
178
+ # }
179
+ # form.fields_check \
180
+ # width: 'matchParent',
181
+ # offIcon: 'expand_more',
182
+ # onIcon: 'expand_less',
183
+ # label: 'Read more',
184
+ # onLabel: 'Read less',
185
+ # checkValue: 'expand',
186
+ # uncheckValue: nil,
187
+ # name: 'expand[bundle_description]',
188
+ # disableDirtyCheck: true
189
+ # end
190
+ # else
191
+ # inner_column.markdown text: text
192
+ # end
193
+
194
+ # panel.panels_form width: 'matchParent', childViews: ->(visibility) do
195
+ # state = {
196
+ # has_content: false
197
+ # }
198
+ # style_classes ||= nil
199
+ # style_class ||= nil
200
+ # padding ||= nil
201
+ # id ||= nil
202
+
203
+ # visibility.banners_select \
204
+ # id: id,
205
+ # width: 'matchParent',
206
+ # styleClass: style_class || (style_classes ? nil : 'warning'),
207
+ # message: message,
208
+ # padding: padding,
209
+ # buttons: ->(menu) do
210
+ # yield(menu, state)
211
+ # end,
212
+ # showIf: {
213
+ # "==": [
214
+ # {
215
+ # "var": 'banner'
216
+ # },
217
+ # 'show'
218
+ # ]
219
+ # }
220
+ # visibility.fields_hidden name: 'banner', value: state[:has_content] ? 'show' : 'hide'
221
+ # end
222
+
223
+
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/config/routes.rb CHANGED
File without changes
File without changes
File without changes
File without changes
File without changes
data/lib/glib/crypt.rb CHANGED
File without changes
File without changes
File without changes
data/lib/glib/engine.rb CHANGED
File without changes
File without changes
File without changes
@@ -1,3 +1,4 @@
1
+
1
2
  module Glib
2
3
  module JsonCrawler
3
4
  class FormsSubmit < ActionCrawler
@@ -24,7 +25,18 @@ module Glib
24
25
  url = view['url']
25
26
  fields = []
26
27
  params = {}
27
- @http.router.crawl_multiple view['childViews'], ->(child) do
28
+ child_views = view['childViews'] || []
29
+
30
+ # If this form is page level, we need to check the child views of the entire page.
31
+ if view['view'] == 'panels/fullPageForm'
32
+ child_views += @http.router.page_spec['header']&.[]('childViews') || []
33
+ child_views += @http.router.page_spec['body']&.[]('childViews') || []
34
+ child_views += @http.router.page_spec['footer']&.[]('childViews') || []
35
+ end
36
+
37
+ @http.router.crawl_multiple child_views, ->(child) do
38
+ next if child['template'].present?
39
+
28
40
  name = child['view']
29
41
  if name.start_with?('fields/')
30
42
  fields << child
File without changes
@@ -8,6 +8,8 @@ module Glib
8
8
  json = @http.get(url, action, args.except('url'))
9
9
 
10
10
  unless json.nil?
11
+ @http.router.parse_page(json)
12
+
11
13
  crawl json['header']&.[]('childViews')
12
14
  crawl json['body']&.[]('childViews')
13
15
  crawl json['footer']&.[]('childViews')
File without changes
@@ -1,7 +1,7 @@
1
1
  module Glib
2
2
  module JsonCrawler
3
3
  class Router
4
- attr_reader :read_only_actions, :logger
4
+ attr_reader :read_only_actions, :logger, :page_spec
5
5
  attr_accessor :host
6
6
 
7
7
  def log(action, url, response = nil)
@@ -19,6 +19,7 @@ module Glib
19
19
  @read_only_actions = Set.new
20
20
  # default rails's development host
21
21
  @host ||= 'localhost:3000'
22
+ @page_spec = nil
22
23
  end
23
24
 
24
25
  def step(http, args)
@@ -53,7 +54,8 @@ module Glib
53
54
  JsonCrawler::NavInitiate.new(http, params, action)
54
55
  when 'runMultiple-v1', 'runMultiple'
55
56
  JsonCrawler::RunMultiple.new(http, params, action)
56
- when 'windows/open-v1', 'dialogs/open-v1', 'windows/reload-v1', 'windows/open', 'dialogs/open', 'windows/reload', 'windows/openWeb', 'windows/openWeb-v1'
57
+ when 'windows/open-v1', 'dialogs/open-v1', 'windows/reload-v1', 'windows/open',
58
+ 'dialogs/open', 'windows/reload', 'windows/openWeb', 'windows/openWeb-v1'
57
59
  if allowed?(params['url'])
58
60
  @read_only_actions.add([action, params['url']])
59
61
  JsonCrawler::WindowsOpen.new(http, params, action)
@@ -66,7 +68,6 @@ module Glib
66
68
  JsonCrawler::ActionHttp.new(:post, http, params, action)
67
69
  when 'forms/submit-v1', 'forms/submit'
68
70
  forms = @visitor.forms
69
- # raise 'Submit action needs to be inside a form' if forms.size < 1
70
71
  JsonCrawler::FormsSubmit.new(http, forms.last)
71
72
  else
72
73
  unless [
@@ -93,6 +94,11 @@ module Glib
93
94
  @visitor.traverse_multiple views, block
94
95
  end
95
96
 
97
+ def parse_page(spec)
98
+ @page_spec = spec
99
+ @visitor.parse_page spec
100
+ end
101
+
96
102
  def allowed?(url)
97
103
  regex = Regexp.new("#{host}.+(?<!\.pdf)$")
98
104
  regex.match(url)
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/glib-web.rb CHANGED
File without changes
data/lib/tasks/db.rake 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: 0.14.5
4
+ version: 0.15.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ''
@@ -153,7 +153,7 @@ files:
153
153
  - app/views/json_ui/garage/forms/dynamic_select_data.json.jbuilder
154
154
  - app/views/json_ui/garage/forms/file_upload.json.jbuilder
155
155
  - app/views/json_ui/garage/forms/floating_submit.json.jbuilder
156
- - app/views/json_ui/garage/forms/full_window_form.json.jbuilder
156
+ - app/views/json_ui/garage/forms/full_page_form.json.jbuilder
157
157
  - app/views/json_ui/garage/forms/generic_post.json.jbuilder
158
158
  - app/views/json_ui/garage/forms/index.json.jbuilder
159
159
  - app/views/json_ui/garage/forms/local_request.json.jbuilder
@@ -301,7 +301,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
301
301
  - !ruby/object:Gem::Version
302
302
  version: '0'
303
303
  requirements: []
304
- rubygems_version: 3.1.4
304
+ rubyforge_project:
305
+ rubygems_version: 2.7.6
305
306
  signing_key:
306
307
  specification_version: 4
307
308
  summary: ''