glib-web 4.29.0 → 4.30.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0a07fbc8b0073fa52868b3e79f133568487d2b16c230f8b93481992d61dab930
4
- data.tar.gz: c949b616ab4a3e7f774d5fc21b1e9046c5f653e62c4ce5b25d619b96e54d701d
3
+ metadata.gz: e2383b2b6102e7ef3eefe20eee5597154badb36c36d92f8f05b38db845a78200
4
+ data.tar.gz: d5843df8082c4781b96c3116aaa93342dc6713510ef2c061b28b58a5833144a0
5
5
  SHA512:
6
- metadata.gz: eca316a8bf2e3694f4f023a785bb6c15f20168d1f4a61335cb9645e095c17f91073a8d918589c23e663d253187c34232bf965ec3ccd977f2c592ea22e4d96ea2
7
- data.tar.gz: 2215d6aaf581273cb6a5672d8baa73c4f79b8aa360bc24938d8953c7d2bbd965ce8c2e8284d1846ed7381103d1df4eb5111b7e15852e2232d202a4fb595ea7f0
6
+ metadata.gz: 44155bcc598d8cc5443b14a82975339d206ec92173ac21b20681cbf8c1137a4fe340a4ebf2f1821e654a57e92684af2fec901e25de424af8cb4f1f25f215da7b
7
+ data.tar.gz: aa13100f8b37a89da04c5577828e6119406e58d32f9d28ada01ad81bb6ab606e2c0be8946075bff75e4406ec67b0c1a4145384868084cb56570d071c4159f342
@@ -38,8 +38,20 @@ module Glib::Json::Ui
38
38
 
39
39
  def json_ui_page_lifecycle_prop(name)
40
40
  if (hash = json_transformation_start).is_a?(Hash) && hash['body'] # A valid page
41
- hash[name] ||= { 'action' => 'runMultiple', 'childActions' => [] }
42
- hash[name]['childActions']
41
+ original_action = hash[name]
42
+
43
+ if original_action && original_action['action'] == 'runMultiple'
44
+ child_actions = original_action['childActions']
45
+ else
46
+ hash[name] = { 'action' => 'runMultiple', 'childActions' => [] }
47
+ child_actions = hash[name]['childActions']
48
+ child_actions << original_action
49
+ end
50
+
51
+ # hash[name] ||= { 'action' => 'runMultiple', 'childActions' => [] }
52
+ # child_actions = hash[name]['childActions']
53
+
54
+ child_actions
43
55
  end
44
56
  end
45
57
 
@@ -28,6 +28,7 @@ class Glib::JsonUi::ActionBuilder
28
28
  end
29
29
 
30
30
  class Open < Action
31
+ views :loaderViews
31
32
  string :url, cache: true
32
33
  bool :disableCloseButton
33
34
  string :fullscreen
@@ -39,6 +40,7 @@ class Glib::JsonUi::ActionBuilder
39
40
  end
40
41
 
41
42
  class Reload < Action
43
+ views :loaderViews
42
44
  string :url, cache: true
43
45
  bool :disableCloseButton
44
46
  string :fullscreen # mobile, always
@@ -26,6 +26,7 @@ class Glib::JsonUi::ActionBuilder
26
26
  class Open < Action
27
27
  string :url
28
28
  string :placement # top, right, bottom, left
29
+ views :loaderViews
29
30
  end
30
31
 
31
32
  class Show < Action
@@ -13,20 +13,20 @@ class Glib::JsonUi::ActionBuilder
13
13
  string :url, cache: true
14
14
  bool :updateExisting
15
15
  action :onOpen
16
+ views :loaderViews
16
17
  end
17
18
 
18
19
  class OpenWeb < Action
19
20
  # string :url
20
21
 
21
22
  def url(value, options = {})
22
- other_host = !!options[:other_host]
23
23
  regex = /\/.+\.json|format=json/
24
24
 
25
- if Rails.env.development? || Rails.env.test? && !other_host
25
+ if Rails.env.development? || Rails.env.test? && same_host?(value)
26
26
  raise "JSON url detected #{value}" if value.to_s.match?(regex)
27
27
  end
28
28
 
29
- if value.to_s.match?(regex) && Rails.env.production? && !other_host
29
+ if value.to_s.match?(regex) && Rails.env.production? && same_host?(value)
30
30
  Rollbar.error("JSON url detected #{value}")
31
31
  # value = value.gsub('.json', '')
32
32
  end
@@ -35,16 +35,15 @@ class Glib::JsonUi::ActionBuilder
35
35
  json.set! 'url', value
36
36
  end
37
37
 
38
- # private
38
+ private
39
+ def same_host?(url)
40
+ host = URI(url.to_s).host
39
41
 
40
- # def same_host?(url)
41
- # host = URI(url.to_s).host
42
-
43
- # return true if host == request.host
44
- # return false unless host.nil?
45
- # return false unless url.to_s.start_with?("/")
46
- # !url.to_s.start_with?("//")
47
- # end
42
+ return true if host == page.context.request.host
43
+ return false unless host.nil?
44
+ return false unless url.to_s.start_with?('/')
45
+ !url.to_s.start_with?('//')
46
+ end
48
47
  end
49
48
 
50
49
  class Reload < Action
@@ -63,6 +62,7 @@ class Glib::JsonUi::ActionBuilder
63
62
  class CloseWithOpen < Action
64
63
  string :url
65
64
  action :onOpen
65
+ views :loaderViews
66
66
 
67
67
  required :url
68
68
  end
@@ -70,6 +70,7 @@ class Glib::JsonUi::ActionBuilder
70
70
  class CloseAllWithOpen < Action
71
71
  string :url
72
72
  action :onOpen
73
+ views :loaderViews
73
74
  end
74
75
 
75
76
  class Print < Action
@@ -357,6 +357,12 @@ module Glib
357
357
  array :items
358
358
  hash :dropData
359
359
  end
360
+
361
+ class Skeleton < View
362
+ def template(value)
363
+ json.set! 'template', value
364
+ end
365
+ end
360
366
  end
361
367
  end
362
368
  end
@@ -48,12 +48,18 @@ section.rows builder: ->(template) do
48
48
  render 'json_ui/garage/actions/dialogs_show', json: json, action: action, dialog_mode: :show, include_form: true
49
49
  end
50
50
 
51
- template.thumbnail title: 'dialogs/open', onClick: ->(action) do
51
+ template.thumbnail title: 'dialogs/open with loaderViews', onClick: ->(action) do
52
52
  action.dialogs_open \
53
53
  width: 950,
54
- url: json_ui_garage_url(path: 'forms/basic', mode: 'dialog'),
54
+ url: json_ui_garage_url(path: 'forms/basic', mode: 'dialog', sleep: true),
55
55
  disableCloseButton: true,
56
56
  closeOnBlur: true,
57
+ loaderViews: ->(view) do
58
+ view.panels_responsive padding: glib_json_padding_body, childViews: ->(res) do
59
+ res.skeleton template: 'textArea'
60
+ res.skeleton template: 'commentList'
61
+ end
62
+ end,
57
63
  onClose: ->(saction) do
58
64
  saction.snackbars_alert message: 'dialog closed'
59
65
  end
@@ -18,9 +18,15 @@ section.rows builder: ->(template) do
18
18
  template.thumbnail title: "sheets/open placement: 'top'", onClick: ->(action) do
19
19
  action.sheets_open placement: 'top', url: json_ui_garage_url(path: 'actions/sheet_content')
20
20
  end
21
- template.thumbnail title: "sheets/open placement: 'right'", onClick: ->(action) do
22
- action.sheets_open placement: 'right', url: json_ui_garage_url(path: 'actions/sheet_content')
23
- end
21
+ template.thumbnail \
22
+ title: "sheets/open placement: 'right' with loaderViews", onClick: ->(action) do
23
+ action.sheets_open placement: 'right', url: json_ui_garage_url(path: 'actions/sheet_content'), loaderViews: ->(sview) do
24
+ sview.panels_responsive padding: { all: 16 }, childViews: ->(res) do
25
+ res.skeleton template: 'textArea'
26
+ res.skeleton template: 'commentList'
27
+ end
28
+ end
29
+ end
24
30
  template.thumbnail title: "sheets/open placement: 'bottom'", onClick: ->(action) do
25
31
  action.sheets_open placement: 'bottom', url: json_ui_garage_url(path: 'actions/sheet_content')
26
32
  end
@@ -11,16 +11,29 @@ section.rows builder: ->(template) do
11
11
  end
12
12
 
13
13
  template.thumbnail title: 'windows/open', onClick: ->(action) do
14
- action.windows_open url: json_ui_garage_url(path: 'home/blank')
14
+ action.windows_open url: json_ui_garage_url(path: 'home/blank', sleep: true), loaderViews: ->(view) do
15
+ view.panels_responsive padding: { all: 16 }, childViews: ->(res) do
16
+ res.skeleton template: 'bigProgressCircle'
17
+ end
18
+ end
15
19
  end
16
20
 
17
21
  template.thumbnail title: 'windows/open (updateExisting: true)', onClick: ->(action) do
18
- action.windows_open updateExisting: true, url: json_ui_garage_url(path: 'home/blank')
22
+ action.windows_open updateExisting: true, url: json_ui_garage_url(path: 'home/blank', sleep: true), loaderViews: ->(view) do
23
+ view.panels_responsive padding: { all: 16 }, childViews: ->(res) do
24
+ res.skeleton template: 'textArea'
25
+ res.skeleton template: 'commentList'
26
+ end
27
+ end
19
28
  end
20
29
 
21
30
  template.thumbnail title: 'windows/closeAllWithOpen', onClick: ->(action) do
22
- action.windows_closeAllWithOpen url: json_ui_garage_url(path: 'home/index')
23
-
31
+ action.windows_closeAllWithOpen url: json_ui_garage_url(path: 'home/index', sleep: true), loaderViews: ->(view) do
32
+ view.panels_responsive padding: { all: 16 }, childViews: ->(res) do
33
+ res.skeleton template: 'textArea'
34
+ res.skeleton template: 'commentList'
35
+ end
36
+ end
24
37
  end
25
38
 
26
39
  template.thumbnail title: 'windows/openWeb', onClick: ->(action) do
@@ -1,3 +1,4 @@
1
+ sleep 3
1
2
  page = json_ui_page json
2
3
 
3
4
  page.body childViews: ->(body) do
@@ -1,5 +1,9 @@
1
1
  json.title 'Forms'
2
2
 
3
+ if params[:sleep].present?
4
+ sleep 3
5
+ end
6
+
3
7
  page = json_ui_page json
4
8
  render "#{@path_prefix}/nav_menu", json: json, page: page
5
9
 
@@ -31,6 +31,7 @@ page.form url: json_ui_garage_url(path: 'forms/generic_post'), method: 'post', p
31
31
  template.spacer height: 10
32
32
  template.fields_hidden name: 'message[error]'
33
33
  template.fields_text width: 'matchParent', name: 'question', label: 'Question', placeholder: 'Question'
34
+ template.fields_richText width: 'matchParent', name: 'description', label: 'Desc', placeholder: 'Desc'
34
35
 
35
36
  form.panels_responsive id: 'responsive_{{entryIndex}}', childViews: ->(column) do
36
37
  column.panels_split width: 'matchParent', content: ->(split) do
@@ -1,4 +1,6 @@
1
- sleep 0.5
1
+ if params[:sleep].present?
2
+ sleep 1
3
+ end
2
4
 
3
5
  json.title 'Menu'
4
6
 
@@ -1,3 +1,7 @@
1
+ if params[:sleep].present?
2
+ sleep 1
3
+ end
4
+
1
5
  json.title 'Menu'
2
6
 
3
7
  page = json_ui_page json
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.29.0
4
+ version: 4.30.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - ''