glib-web 0.5.3 → 0.5.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (153) hide show
  1. checksums.yaml +5 -5
  2. data/app/controllers/concerns/glib/auth/policy.rb +0 -0
  3. data/app/controllers/concerns/glib/json/new_dynamic_text.rb +0 -0
  4. data/app/controllers/concerns/glib/json/traversal.rb +0 -0
  5. data/app/controllers/concerns/glib/json/ui.rb +7 -0
  6. data/app/controllers/glib/home_controller.rb +1 -1
  7. data/app/helpers/glib/app_feature_support_helper.rb +16 -0
  8. data/app/helpers/glib/dynamic_images_helper.rb +0 -0
  9. data/app/helpers/glib/dynamic_texts_helper.rb +0 -0
  10. data/app/helpers/glib/forms_helper.rb +0 -0
  11. data/app/helpers/glib/json_ui/abstract_builder.rb +9 -3
  12. data/app/helpers/glib/json_ui/action_builder.rb +36 -6
  13. data/app/helpers/glib/json_ui/action_builder/dialogs.rb +0 -0
  14. data/app/helpers/glib/json_ui/action_builder/http.rb +0 -0
  15. data/app/helpers/glib/json_ui/action_builder/sheets.rb +0 -0
  16. data/app/helpers/glib/json_ui/action_builder/snackbars.rb +0 -0
  17. data/app/helpers/glib/json_ui/action_builder/windows.rb +1 -0
  18. data/app/helpers/glib/json_ui/generic_builders.rb +0 -0
  19. data/app/helpers/glib/json_ui/list_builders.rb +0 -0
  20. data/app/helpers/glib/json_ui/menu_builder.rb +0 -0
  21. data/app/helpers/glib/json_ui/page_helper.rb +13 -5
  22. data/app/helpers/glib/json_ui/response_helper.rb +1 -1
  23. data/app/helpers/glib/json_ui/split_builders.rb +0 -0
  24. data/app/helpers/glib/json_ui/styling_helper.rb +22 -0
  25. data/app/helpers/glib/json_ui/table_builders.rb +0 -0
  26. data/app/helpers/glib/json_ui/view_builder.rb +16 -16
  27. data/app/helpers/glib/json_ui/view_builder/banners.rb +0 -0
  28. data/app/helpers/glib/json_ui/view_builder/fields.rb +9 -1
  29. data/app/helpers/glib/json_ui/view_builder/panels.rb +2 -0
  30. data/app/helpers/glib/urls_helper.rb +7 -0
  31. data/app/models/glib/active_storage/attachment.rb +0 -0
  32. data/app/models/glib/active_storage/blob.rb +0 -0
  33. data/app/models/glib/dynamic_text_record.rb +0 -0
  34. data/app/models/glib/text.rb +0 -0
  35. data/app/policies/glib/application_policy.rb +27 -30
  36. data/app/validators/email_typo_validator.rb +0 -0
  37. data/app/validators/email_validator.rb +0 -0
  38. data/app/validators/url_validator.rb +0 -0
  39. data/app/views/app/views/json_ui/vue/renderer.html.erb +0 -0
  40. data/app/views/json_ui/garage/_nav_menu.json.jbuilder +0 -0
  41. data/app/views/json_ui/garage/actions/_dialogs.json.jbuilder +20 -14
  42. data/app/views/json_ui/garage/actions/_http.json.jbuilder +0 -0
  43. data/app/views/json_ui/garage/actions/_reload.json.jbuilder +0 -0
  44. data/app/views/json_ui/garage/actions/_sheets.json.jbuilder +0 -0
  45. data/app/views/json_ui/garage/actions/_snackbars.json.jbuilder +0 -0
  46. data/app/views/json_ui/garage/actions/_timeouts.json.jbuilder +0 -0
  47. data/app/views/json_ui/garage/actions/_windows.json.jbuilder +0 -0
  48. data/app/views/json_ui/garage/actions/dialogs_oauth_post.json.jbuilder +0 -0
  49. data/app/views/json_ui/garage/actions/index.json.jbuilder +2 -2
  50. data/app/views/json_ui/garage/forms/_alert_post_data.json.jbuilder +0 -0
  51. data/app/views/json_ui/garage/forms/basic.json.jbuilder +0 -0
  52. data/app/views/json_ui/garage/forms/basic_post.json.jbuilder +0 -0
  53. data/app/views/json_ui/garage/forms/checkboxes.json.jbuilder +0 -0
  54. data/app/views/json_ui/garage/forms/dynamic_group.json.jbuilder +9 -18
  55. data/app/views/json_ui/garage/forms/dynamic_select.json.jbuilder +0 -0
  56. data/app/views/json_ui/garage/forms/dynamic_select_data.json.jbuilder +0 -0
  57. data/app/views/json_ui/garage/forms/file_upload.json.jbuilder +0 -0
  58. data/app/views/json_ui/garage/forms/floating_submit.json.jbuilder +0 -0
  59. data/app/views/json_ui/garage/forms/generic_post.json.jbuilder +0 -0
  60. data/app/views/json_ui/garage/forms/get_request.json.jbuilder +0 -0
  61. data/app/views/json_ui/garage/forms/index.json.jbuilder +0 -0
  62. data/app/views/json_ui/garage/forms/pickers.json.jbuilder +6 -3
  63. data/app/views/json_ui/garage/forms/rich_text.json.jbuilder +0 -0
  64. data/app/views/json_ui/garage/forms/selects.json.jbuilder +0 -0
  65. data/app/views/json_ui/garage/forms/show_hide.json.jbuilder +20 -3
  66. data/app/views/json_ui/garage/forms/styled_boxes.json.jbuilder +4 -1
  67. data/app/views/json_ui/garage/forms/submission_flow.json.jbuilder +0 -0
  68. data/app/views/json_ui/garage/forms/submission_flow_post.json.jbuilder +0 -0
  69. data/app/views/json_ui/garage/forms/submission_indicator.json.jbuilder +0 -0
  70. data/app/views/json_ui/garage/forms/submission_indicator_post.json.jbuilder +0 -0
  71. data/app/views/json_ui/garage/forms/text_validation.json.jbuilder +1 -1
  72. data/app/views/json_ui/garage/home/blank.json.jbuilder +0 -0
  73. data/app/views/json_ui/garage/home/index.json.jbuilder +0 -0
  74. data/app/views/json_ui/garage/home/slow.json.jbuilder +0 -0
  75. data/app/views/json_ui/garage/lists/_infinite_scroll_section.json.jbuilder +15 -5
  76. data/app/views/json_ui/garage/lists/edit_actions.json.jbuilder +0 -0
  77. data/app/views/json_ui/garage/lists/fab.json.jbuilder +0 -0
  78. data/app/views/json_ui/garage/lists/index.json.jbuilder +0 -0
  79. data/app/views/json_ui/garage/lists/infinite_scroll.json.jbuilder +0 -0
  80. data/app/views/json_ui/garage/lists/templating.json.jbuilder +0 -0
  81. data/app/views/json_ui/garage/notifications/index.json.jbuilder +0 -43
  82. data/app/views/json_ui/garage/notifications/web_socket.json.jbuilder +19 -21
  83. data/app/views/json_ui/garage/pages/flat_centered.json.jbuilder +0 -0
  84. data/app/views/json_ui/garage/pages/full_width.json.jbuilder +0 -0
  85. data/app/views/json_ui/garage/pages/full_width_height.json.jbuilder +0 -0
  86. data/app/views/json_ui/garage/pages/index.json.jbuilder +11 -0
  87. data/app/views/json_ui/garage/pages/layout.json.jbuilder +12 -13
  88. data/app/views/json_ui/garage/pages/loading_indicator.json.jbuilder +0 -0
  89. data/app/views/json_ui/garage/pages/nav_buttons.json.jbuilder +28 -16
  90. data/app/views/json_ui/garage/pages/nested_scroll.json.jbuilder +40 -0
  91. data/app/views/json_ui/garage/pages/tab_bar.json.jbuilder +0 -0
  92. data/app/views/json_ui/garage/panels/_styled.json.jbuilder +0 -0
  93. data/app/views/json_ui/garage/panels/card.json.jbuilder +0 -0
  94. data/app/views/json_ui/garage/panels/carousel.json.jbuilder +24 -3
  95. data/app/views/json_ui/garage/panels/custom.json.jbuilder +0 -0
  96. data/app/views/json_ui/garage/panels/flow.json.jbuilder +0 -0
  97. data/app/views/json_ui/garage/panels/horizontal.json.jbuilder +0 -0
  98. data/app/views/json_ui/garage/panels/index.json.jbuilder +0 -0
  99. data/app/views/json_ui/garage/panels/outlined.json.jbuilder +0 -0
  100. data/app/views/json_ui/garage/panels/responsive.json.jbuilder +0 -0
  101. data/app/views/json_ui/garage/panels/split.json.jbuilder +0 -0
  102. data/app/views/json_ui/garage/panels/vertical.json.jbuilder +0 -0
  103. data/app/views/json_ui/garage/services/dynamic_text.json.jbuilder +0 -0
  104. data/app/views/json_ui/garage/services/image.json.jbuilder +0 -0
  105. data/app/views/json_ui/garage/services/index.json.jbuilder +0 -0
  106. data/app/views/json_ui/garage/tables/_autoload_section.json.jbuilder +0 -0
  107. data/app/views/json_ui/garage/tables/autoload_all.json.jbuilder +0 -0
  108. data/app/views/json_ui/garage/tables/autoload_as_needed.json.jbuilder +39 -0
  109. data/app/views/json_ui/garage/tables/export_import.json.jbuilder +0 -0
  110. data/app/views/json_ui/garage/tables/horizontal_scroll.json.jbuilder +0 -0
  111. data/app/views/json_ui/garage/tables/index.json.jbuilder +3 -0
  112. data/app/views/json_ui/garage/tables/layout.json.jbuilder +0 -0
  113. data/app/views/json_ui/garage/views/_chart_data.json.jbuilder +1 -1
  114. data/app/views/json_ui/garage/views/banners.json.jbuilder +0 -0
  115. data/app/views/json_ui/garage/views/calendar_data.json.jbuilder +23 -27
  116. data/app/views/json_ui/garage/views/charts.json.jbuilder +0 -0
  117. data/app/views/json_ui/garage/views/icons.json.jbuilder +22 -0
  118. data/app/views/json_ui/garage/views/images.json.jbuilder +4 -4
  119. data/app/views/json_ui/garage/views/index.json.jbuilder +3 -3
  120. data/app/views/json_ui/garage/views/links.json.jbuilder +0 -0
  121. data/app/views/json_ui/garage/views/map_data.json.jbuilder +0 -0
  122. data/app/views/json_ui/garage/views/misc.json.jbuilder +0 -0
  123. data/app/views/json_ui/garage/views/texts.json.jbuilder +0 -0
  124. data/config/routes.rb +0 -0
  125. data/lib/generators/glib/install_generator.rb +0 -0
  126. data/lib/generators/templates/20191017062519_create_texts.rb +0 -0
  127. data/lib/generators/templates/20191024063257_add_scope_to_texts.rb +0 -0
  128. data/lib/generators/templates/20191112095018_add_lang_to_texts.rb +0 -0
  129. data/lib/generators/templates/20191126071051_create_active_storage_tables.active_storage.rb +0 -0
  130. data/lib/generators/templates/database.yml +0 -0
  131. data/lib/generators/templates/dynamic_text.rb +0 -0
  132. data/lib/glib-web.rb +0 -0
  133. data/lib/glib/crypt.rb +1 -1
  134. data/lib/glib/crypt/utils.rb +0 -0
  135. data/lib/glib/dynamic_text.rb +1 -1
  136. data/lib/glib/dynamic_text/config.rb +0 -0
  137. data/lib/glib/engine.rb +0 -0
  138. data/lib/glib/json_crawler.rb +1 -0
  139. data/lib/glib/json_crawler/action_crawler.rb +0 -0
  140. data/lib/glib/json_crawler/action_crawlers/action_http.rb +0 -0
  141. data/lib/glib/json_crawler/action_crawlers/forms_submit.rb +1 -1
  142. data/lib/glib/json_crawler/action_crawlers/menu.rb +12 -0
  143. data/lib/glib/json_crawler/action_crawlers/nav_initiate.rb +1 -1
  144. data/lib/glib/json_crawler/action_crawlers/windows_open.rb +0 -0
  145. data/lib/glib/json_crawler/coverage.rb +0 -0
  146. data/lib/glib/json_crawler/http.rb +7 -4
  147. data/lib/glib/json_crawler/router.rb +2 -1
  148. data/lib/glib/test_helpers.rb +4 -4
  149. data/lib/glib/value.rb +0 -0
  150. data/lib/glib/version.rb +0 -0
  151. data/lib/tasks/db.rake +0 -0
  152. metadata +8 -3
  153. data/app/views/json_ui/garage/views/carousels.json.jbuilder +0 -37
@@ -0,0 +1,12 @@
1
+ module Glib
2
+ module JsonCrawler
3
+ class Menu < ActionCrawler
4
+ def initialize(http, args, action)
5
+ super(http)
6
+
7
+ @http.router.log action, nil
8
+ crawl args['buttons']
9
+ end
10
+ end
11
+ end
12
+ end
@@ -3,7 +3,7 @@ module Glib
3
3
  class NavInitiate < ActionCrawler
4
4
  def initialize(http, args, action)
5
5
  super(http)
6
-
6
+
7
7
  @http = http
8
8
  if (json = (@http.get args['url'], action, args.except('url'))) && (left_drawer = json['leftDrawer'])
9
9
  crawl left_drawer['header']&.[]('childViews')
File without changes
@@ -8,8 +8,8 @@ module Glib
8
8
  VALID_RESPONSE_CODES = [
9
9
  (200..299).to_a,
10
10
  ## Note, the JSON API does not allow redirects
11
- 401, ## UNAUTHORIZED Should be used for not-logged-in
12
- 403, ## FORBIDDEN Should be used for logged-in but not allowed to access
11
+ # 401, ## UNAUTHORIZED Should be used for not-logged-in
12
+ # 403, ## FORBIDDEN Should be used for logged-in but not allowed to access
13
13
  ].flatten
14
14
 
15
15
  def initialize(context, user, router)
@@ -58,7 +58,9 @@ module Glib
58
58
  history << url
59
59
  end
60
60
 
61
- @context.assert_match(URI_REGEXP, url)
61
+ if !URI_REGEXP.match(url)
62
+ raise "Invalid URL: `#{url}`. Make sure to use the absolute URL."
63
+ end
62
64
 
63
65
  http_header = {
64
66
  'Client-DeviceOS' => user[:device],
@@ -76,7 +78,7 @@ module Glib
76
78
  @context.send(method, url, params: params, headers: http_header)
77
79
  raw_response = @context.response
78
80
  response = Response.new(raw_response.code.to_i, raw_response.headers, raw_response.media_type, raw_response.body)
79
-
81
+
80
82
  if (controller = @context.controller)
81
83
  Glib::JsonCrawler::Coverage.coverage_files.add(controller.class.instance_method(controller.action_name).source_location.first)
82
84
  end
@@ -103,6 +105,7 @@ module Glib
103
105
  get redirect_uri.to_s, action, params
104
106
  else
105
107
  response_times << response.headers['X-Runtime'].to_f
108
+
106
109
  @context.assert_includes VALID_RESPONSE_CODES, code, "Expected a valid response but was [#{response.code}] #{Rack::Utils::HTTP_STATUS_CODES[response.code.to_i]}:\n#{url}"
107
110
  if response.media_type == 'application/json'
108
111
  JSON.parse(response.body)
@@ -36,7 +36,6 @@ module Glib
36
36
 
37
37
  if action.present?
38
38
  @depth += 1
39
- # child =
40
39
  case action
41
40
  when 'initiate_navigation'
42
41
  @read_only_actions.add([action, params['url']])
@@ -44,6 +43,8 @@ module Glib
44
43
  when 'windows/open-v1', 'dialogs/open-v1', 'windows/reload-v1', 'windows/open', 'dialogs/open', 'windows/reload'
45
44
  @read_only_actions.add([action, params['url']])
46
45
  JsonCrawler::WindowsOpen.new(http, params, action)
46
+ when 'sheets/select-v1', 'sheets/select'
47
+ JsonCrawler::Menu.new(http, params, action)
47
48
  when 'http/post-v1', 'http/post'
48
49
  JsonCrawler::ActionHttp.new(:post, http, params, action)
49
50
  when 'forms/submit-v1', 'forms/submit'
@@ -20,21 +20,21 @@ module Glib
20
20
  end
21
21
  @__log_dir
22
22
  end
23
-
23
+
24
24
  def __log_file
25
25
  @__log_file ||= "#{self.method_name}.json"
26
26
  end
27
-
27
+
28
28
  def __log json
29
29
  File.open("#{File.join(__log_dir, __log_file)}", "w") do |f|
30
30
  f << JSON.pretty_generate( JSON.parse(json) )
31
31
  end
32
32
  json
33
33
  end
34
-
34
+
35
35
  def __get_previous_result_from_git
36
36
  `git checkout -- "#{File.join(__log_dir, __log_file)}" > /dev/null 2>&1` if __git_is_available?
37
- File.exists?(File.join(__log_dir, __log_file)) ? File.open(File.join(__log_dir, __log_file)).read : "\{\}"
37
+ File.exist?(File.join(__log_dir, __log_file)) ? File.open(File.join(__log_dir, __log_file)).read : "\{\}"
38
38
  end
39
39
  end
40
40
  end
File without changes
File without changes
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.5.3
4
+ version: 0.5.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - ''
@@ -73,6 +73,7 @@ files:
73
73
  - app/controllers/concerns/glib/json/ui.rb
74
74
  - app/controllers/concerns/glib/json/validation.rb
75
75
  - app/controllers/glib/home_controller.rb
76
+ - app/helpers/glib/app_feature_support_helper.rb
76
77
  - app/helpers/glib/dynamic_images_helper.rb
77
78
  - app/helpers/glib/dynamic_texts_helper.rb
78
79
  - app/helpers/glib/forms_helper.rb
@@ -97,6 +98,7 @@ files:
97
98
  - app/helpers/glib/json_ui/view_builder/charts.rb
98
99
  - app/helpers/glib/json_ui/view_builder/fields.rb
99
100
  - app/helpers/glib/json_ui/view_builder/panels.rb
101
+ - app/helpers/glib/urls_helper.rb
100
102
  - app/models/glib/active_storage/attachment.rb
101
103
  - app/models/glib/active_storage/blob.rb
102
104
  - app/models/glib/dynamic_text_record.rb
@@ -156,6 +158,7 @@ files:
156
158
  - app/views/json_ui/garage/pages/layout.json.jbuilder
157
159
  - app/views/json_ui/garage/pages/loading_indicator.json.jbuilder
158
160
  - app/views/json_ui/garage/pages/nav_buttons.json.jbuilder
161
+ - app/views/json_ui/garage/pages/nested_scroll.json.jbuilder
159
162
  - app/views/json_ui/garage/pages/tab_bar.json.jbuilder
160
163
  - app/views/json_ui/garage/panels/_styled.json.jbuilder
161
164
  - app/views/json_ui/garage/panels/card.json.jbuilder
@@ -173,6 +176,7 @@ files:
173
176
  - app/views/json_ui/garage/services/index.json.jbuilder
174
177
  - app/views/json_ui/garage/tables/_autoload_section.json.jbuilder
175
178
  - app/views/json_ui/garage/tables/autoload_all.json.jbuilder
179
+ - app/views/json_ui/garage/tables/autoload_as_needed.json.jbuilder
176
180
  - app/views/json_ui/garage/tables/export_import.json.jbuilder
177
181
  - app/views/json_ui/garage/tables/horizontal_scroll.json.jbuilder
178
182
  - app/views/json_ui/garage/tables/index.json.jbuilder
@@ -180,8 +184,8 @@ files:
180
184
  - app/views/json_ui/garage/views/_chart_data.json.jbuilder
181
185
  - app/views/json_ui/garage/views/banners.json.jbuilder
182
186
  - app/views/json_ui/garage/views/calendar_data.json.jbuilder
183
- - app/views/json_ui/garage/views/carousels.json.jbuilder
184
187
  - app/views/json_ui/garage/views/charts.json.jbuilder
188
+ - app/views/json_ui/garage/views/icons.json.jbuilder
185
189
  - app/views/json_ui/garage/views/images.json.jbuilder
186
190
  - app/views/json_ui/garage/views/index.json.jbuilder
187
191
  - app/views/json_ui/garage/views/links.json.jbuilder
@@ -208,6 +212,7 @@ files:
208
212
  - lib/glib/json_crawler/action_crawler.rb
209
213
  - lib/glib/json_crawler/action_crawlers/action_http.rb
210
214
  - lib/glib/json_crawler/action_crawlers/forms_submit.rb
215
+ - lib/glib/json_crawler/action_crawlers/menu.rb
211
216
  - lib/glib/json_crawler/action_crawlers/nav_initiate.rb
212
217
  - lib/glib/json_crawler/action_crawlers/windows_open.rb
213
218
  - lib/glib/json_crawler/coverage.rb
@@ -236,7 +241,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
236
241
  version: '0'
237
242
  requirements: []
238
243
  rubyforge_project:
239
- rubygems_version: 2.7.6
244
+ rubygems_version: 2.6.8
240
245
  signing_key:
241
246
  specification_version: 4
242
247
  summary: ''
@@ -1,37 +0,0 @@
1
- json.title 'Views'
2
-
3
- image_url1 = 'http://ichef.bbci.co.uk/news/976/cpsprodpb/18106/production/_97266589_gettyimages-474547165.jpg'
4
- image_url2 = 'https://s.abcnews.com/images/International/Guam03-gty-jrl-170809_16x9_992.jpg'
5
-
6
- json_ui_page json do |page|
7
- render "#{@path_prefix}/nav_menu", json: json, page: page
8
-
9
- page.scroll childViews: ->(scroll) do
10
- scroll.label text: "\n"
11
- scroll.h1 text: 'Carousel with labels'
12
- scroll.panels_carousel width: 'matchParent', childViews: ->(carousel) do
13
- carousel.label text: 'Item 1'
14
- carousel.label text: 'Item 2'
15
- end
16
-
17
- scroll.label text: "\n"
18
- scroll.h1 text: 'Carousel with images'
19
- scroll.panels_carousel width: 'matchParent', childViews: ->(carousel) do
20
- carousel.image url: image_url1, width: 'matchParent'
21
- carousel.image url: image_url2, width: 'matchParent'
22
- end
23
-
24
- scroll.label text: "\n"
25
- scroll.h1 text: 'Carousel with complex layout'
26
- scroll.panels_carousel width: 'matchParent', childViews: ->(carousel) do
27
- carousel.panels_vertical childViews: ->(panel) do
28
- panel.h3 text: 'Item 1'
29
- panel.image url: image_url1, width: 'matchParent'
30
- end
31
- carousel.panels_vertical childViews: ->(panel) do
32
- panel.h3 text: 'Item 2'
33
- panel.image url: image_url2, width: 'matchParent'
34
- end
35
- end
36
- end
37
- end