glib-web 4.36.4 → 4.36.5

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: 9263cfb74f958fdf57439259ab5c8bc58662845bb7ea05fb1be8d5c4cd1a8c89
4
- data.tar.gz: 87718fc39abc6797fe0b333cc54df6a082b198809fc2d1dd01dbf633081eaac5
3
+ metadata.gz: e657850bcd9c7e8e881d35180ee54e239302bdf680511cb49f4cdde2b87c9379
4
+ data.tar.gz: 106a0f38b451f40536fb00f76ad24a62105ae53dcd2f5047239b1ec7dd2b7d72
5
5
  SHA512:
6
- metadata.gz: 3dc998e34afa4e0c88cad3a2b53a4a08933c93538fd163612bf857a3f527d6a5d04007703e54dca432398e3c9781c0e9bbd090362ca3b6892f679dd443f7a932
7
- data.tar.gz: 6d69e9ffe8566cfff01f612f495601a9da09ae70d244b8560a06aeebf2e0a987567f8afdc30dfc944110e591a492c9463b2d331b591b92903b8c460ba71323e2
6
+ metadata.gz: 4d9fbae4fcc33c99c7081f0aaf458e41e26228df11f6709d537f2ec584140af02dd8c2b4252c4e0356cd9dffee152dd273457e12b96b6ce0898680f96998353e
7
+ data.tar.gz: 84dfef2ffce458eacfe1d9e279d09b2c0fd818cd4ba0f26eb4db16ea6f1c87d6f8bdd5f7c6fa71c0cb3244d54cb3fc41acfb4f0c2a4a6420682149c49ed9dd66
@@ -11,23 +11,21 @@ module Glib::Auth
11
11
  params[:_dialog].present? # E.g. _dialog=v1
12
12
  end
13
13
 
14
- def json_ui_401_response(sign_in_url)
14
+ def json_ui_401_response(sign_in_url, **redirect_options)
15
+ allow_other_host = redirect_options[:allow_other_host]
15
16
  {
16
17
  # Handle dialogs_open and windows_open
17
18
  glib_json_dialog_mode? ? :onLoad : :onResponse => __glib_error_dialog(
18
- 'Your session has ended', 'Please re-login.', [
19
- {
20
- view: 'spacer',
21
- height: 20
22
- },
19
+ 'Your session has ended', 'Please re-login.', ['dialog-401-error'], [
23
20
  {
24
21
  view: 'button',
25
22
  text: 'Re-login',
26
23
  onClick: {
27
24
  action: 'dialogs/close',
28
25
  onClose: {
29
- action: 'windows/open',
30
- url: sign_in_url
26
+ action: allow_other_host ? 'windows/openWeb' : 'windows/open',
27
+ url: sign_in_url,
28
+ targetWindow: allow_other_host ? '_self' : nil
31
29
  }
32
30
  }
33
31
  },
@@ -68,10 +68,10 @@ module Glib::Json::Libs
68
68
 
69
69
  # As much as possible, try retaining the front fragment by matching the back, because
70
70
  # the front could be either a `?` or `&`
71
- url = url.sub(/format=json\&/, '');
71
+ url = url.sub(/format=json\&/, '')
72
72
 
73
73
  # If no match, then we replace the front fragment
74
- url.sub(/[\&\?]format=json/, '');
74
+ url.sub(/[\&\?]format=json/, '')
75
75
  end
76
76
 
77
77
  def glib_redirect_to(url, return_to_previous: false, status: :ok)
@@ -131,7 +131,9 @@ module Glib::Json::Libs
131
131
  redirect_to sign_in_url, **redirect_options
132
132
  end
133
133
  format.json do
134
- render json: json_ui_401_response(sign_in_url), status: Rails.env.test? ? :unauthorized : :ok
134
+ render \
135
+ json: json_ui_401_response(sign_in_url, **redirect_options),
136
+ status: Rails.env.test? ? :unauthorized : :ok
135
137
  end
136
138
  format.csv do
137
139
  if Rails.env.test?
@@ -158,15 +160,23 @@ module Glib::Json::Libs
158
160
  return
159
161
  end
160
162
 
161
- render json: if glib_json_dialog_mode?
162
- { onLoad: __glib_error_dialog('Access denied', "Make sure you're logged in with the correct account.") }
163
- else
164
- {
165
- onResponse: {
166
- action: 'windows/open', url: user_default_url
163
+ json_response = \
164
+ if glib_json_dialog_mode?
165
+ {
166
+ onLoad: __glib_error_dialog(
167
+ 'Access denied',
168
+ "Make sure you're logged in with the correct account.",
169
+ ['dialog-403-error']
170
+ )
167
171
  }
168
- }
169
- end, status: Rails.env.test? ? :forbidden : :ok
172
+ else
173
+ {
174
+ onResponse: {
175
+ action: 'windows/open', url: user_default_url
176
+ }
177
+ }
178
+ end
179
+ render json: json_response, status: Rails.env.test? ? :forbidden : :ok
170
180
  end
171
181
  format.csv do
172
182
  if Rails.env.test?
@@ -203,7 +213,7 @@ module Glib::Json::Libs
203
213
  # end
204
214
  # end
205
215
 
206
- def __glib_error_dialog(title, message, bottom_views = [])
216
+ def __glib_error_dialog(title, message, style_classes, bottom_views = [])
207
217
  {
208
218
  action: 'dialogs/show',
209
219
  # Don't show another dialog, just use the current one since it's a new dialog anyway, which means
@@ -214,7 +224,7 @@ module Glib::Json::Libs
214
224
  childViews: [
215
225
  {
216
226
  view: 'panels/vertical',
217
- styleClasses: ['glib-error-dialog'],
227
+ styleClasses: ['glib-error-dialog'].concat(style_classes),
218
228
  childViews: [
219
229
  {
220
230
  view: 'label',
@@ -236,7 +246,7 @@ module Glib::Json::Libs
236
246
  if json_ui_activated?
237
247
  if Rails.env.production? || preview_mode
238
248
  if defined?(Rollbar) && !preview_mode
239
- Rollbar.error(exception, :use_exception_level_filters => true)
249
+ Rollbar.error(exception, use_exception_level_filters: true)
240
250
  end
241
251
 
242
252
  render file: Rails.root.join('public', '500.html'), status: :internal_server_error
@@ -342,7 +352,7 @@ module Glib::Json::Libs
342
352
  format.json do
343
353
  render json: {
344
354
  glib_json_dialog_mode? ? :onLoad : :onResponse => __glib_error_dialog(
345
- 'Your session has expired', 'Please refresh the page and retry.', [
355
+ 'Your session has expired', 'Please refresh the page and retry.', ['dialog-csrf-error'], [
346
356
  {
347
357
  view: 'button',
348
358
  text: 'Refresh',
@@ -77,4 +77,34 @@ page.scroll padding: glib_json_padding_body, childViews: ->(scroll) do
77
77
  panel.spacer width: 10
78
78
  panel.label text: 'bottom'
79
79
  end
80
+
81
+ scroll.label text: "\n"
82
+ scroll.h1 text: 'Changed when Hover'
83
+ scroll.panels_flow \
84
+ id: 'default1',
85
+ padding: { left: 20, right: 20, top: 10, bottom: 10 },
86
+ backgroundColor: '#b3bac2',
87
+ onMouseEnter: ->(action) {
88
+ action.runMultiple childActions: ->(saction) do
89
+ saction.components_set targetId: 'default1', data: { displayed: false }
90
+ saction.components_set targetId: 'hovered1', data: { displayed: true }
91
+ end
92
+ }, childViews: ->(panel) do
93
+ panel.label text: 'Hover me'
94
+ end
95
+ scroll.panels_flow \
96
+ id: 'hovered1',
97
+ displayed: false,
98
+ padding: { left: 20, right: 20, top: 10, bottom: 10 },
99
+ backgroundColor: '#b3bac2',
100
+ onMouseLeave: ->(action) {
101
+ action.runMultiple childActions: ->(saction) do
102
+ saction.components_set targetId: 'default1', data: { displayed: true }
103
+ saction.components_set targetId: 'hovered1', data: { displayed: false }
104
+ end
105
+ }, childViews: ->(panel) do
106
+ panel.label text: 'Hover active'
107
+ end
108
+
109
+ scroll.label text: "\n"
80
110
  end
@@ -163,5 +163,63 @@ json_ui_page json do |page|
163
163
  }
164
164
 
165
165
  scroll.label text: "\n"
166
+ scroll.h1 text: 'Changed when Hover'
167
+ scroll.panels_horizontal \
168
+ id: 'default1',
169
+ padding: { left: 20, right: 20, top: 10, bottom: 10 },
170
+ backgroundColor: '#b3bac2',
171
+ onMouseEnter: ->(action) {
172
+ action.runMultiple childActions: ->(saction) do
173
+ saction.components_set targetId: 'default1', data: { displayed: false }
174
+ saction.components_set targetId: 'hovered1', data: { displayed: true }
175
+ end
176
+ }, childViews: ->(panel) do
177
+ panel.label text: 'Hover me'
178
+ end
179
+ scroll.panels_horizontal \
180
+ id: 'hovered1',
181
+ displayed: false,
182
+ padding: { left: 20, right: 20, top: 10, bottom: 10 },
183
+ backgroundColor: '#b3bac2',
184
+ onMouseLeave: ->(action) {
185
+ action.runMultiple childActions: ->(saction) do
186
+ saction.components_set targetId: 'default1', data: { displayed: true }
187
+ saction.components_set targetId: 'hovered1', data: { displayed: false }
188
+ end
189
+ }, childViews: ->(panel) do
190
+ panel.label text: 'Hover active'
191
+ end
192
+
193
+ scroll.label text: "\n"
194
+ scroll.h1 text: 'Changed when Hover (with onClick)'
195
+ scroll.panels_horizontal \
196
+ id: 'default2',
197
+ padding: { left: 20, right: 20, top: 10, bottom: 10 },
198
+ backgroundColor: '#b3bac2',
199
+ onMouseEnter: ->(action) {
200
+ action.runMultiple childActions: ->(saction) do
201
+ saction.components_set targetId: 'default2', data: { displayed: false }
202
+ saction.components_set targetId: 'hovered2', data: { displayed: true }
203
+ end
204
+ }, childViews: ->(panel) do
205
+ panel.label text: 'Hover me'
206
+ end
207
+ scroll.panels_horizontal \
208
+ id: 'hovered2',
209
+ displayed: false,
210
+ padding: { left: 20, right: 20, top: 10, bottom: 10 },
211
+ backgroundColor: '#b3bac2',
212
+ onMouseLeave: ->(action) {
213
+ action.runMultiple childActions: ->(saction) do
214
+ saction.components_set targetId: 'default2', data: { displayed: true }
215
+ saction.components_set targetId: 'hovered2', data: { displayed: false }
216
+ end
217
+ }, childViews: ->(panel) do
218
+ panel.label text: 'Click me'
219
+ end, onClick: ->(action) do
220
+ action.windows_open url: json_ui_garage_url(path: 'home/blank')
221
+ end
222
+
223
+ scroll.label text: "\n"
166
224
  end
167
225
  end
@@ -158,7 +158,67 @@ page.scroll padding: glib_json_padding_body, childViews: ->(scroll) do
158
158
  action.windows_open url: json_ui_garage_url(path: 'home/blank')
159
159
  end
160
160
 
161
- scroll.spacer height: 16
161
+ scroll.spacer height: 32
162
+ scroll.h1 text: 'Changed when Hover'
163
+ scroll.spacer height: 8
164
+ scroll.panels_responsive \
165
+ id: 'default1',
166
+ padding: { left: 20, right: 20, top: 10, bottom: 10 },
167
+ backgroundColor: '#c3cad2',
168
+ onMouseEnter: ->(action) {
169
+ action.runMultiple childActions: ->(saction) do
170
+ saction.components_set targetId: 'default1', data: { displayed: false }
171
+ saction.components_set targetId: 'hovered1', data: { displayed: true }
172
+ end
173
+ }, childViews: ->(panel) do
174
+ panel.label text: 'Hover me'
175
+ end
176
+ scroll.panels_responsive \
177
+ id: 'hovered1',
178
+ displayed: false,
179
+ padding: { left: 20, right: 20, top: 10, bottom: 10 },
180
+ backgroundColor: '#c3cad2',
181
+ onMouseLeave: ->(action) {
182
+ action.runMultiple childActions: ->(saction) do
183
+ saction.components_set targetId: 'default1', data: { displayed: true }
184
+ saction.components_set targetId: 'hovered1', data: { displayed: false }
185
+ end
186
+ }, childViews: ->(panel) do
187
+ panel.label text: 'Hover active'
188
+ end
189
+
190
+ scroll.spacer height: 32
191
+ scroll.h1 text: 'Changed when Hover (with onClick)'
192
+ scroll.spacer height: 8
193
+ scroll.panels_responsive \
194
+ id: 'default2',
195
+ padding: { left: 20, right: 20, top: 10, bottom: 10 },
196
+ backgroundColor: '#c3cad2',
197
+ onMouseEnter: ->(action) {
198
+ action.runMultiple childActions: ->(saction) do
199
+ saction.components_set targetId: 'default2', data: { displayed: false }
200
+ saction.components_set targetId: 'hovered2', data: { displayed: true }
201
+ end
202
+ }, childViews: ->(panel) do
203
+ panel.label text: 'Hover me'
204
+ end
205
+ scroll.panels_responsive \
206
+ id: 'hovered2',
207
+ displayed: false,
208
+ padding: { left: 20, right: 20, top: 10, bottom: 10 },
209
+ backgroundColor: '#c3cad2',
210
+ onMouseLeave: ->(action) {
211
+ action.runMultiple childActions: ->(saction) do
212
+ saction.components_set targetId: 'default2', data: { displayed: true }
213
+ saction.components_set targetId: 'hovered2', data: { displayed: false }
214
+ end
215
+ }, childViews: ->(panel) do
216
+ panel.label text: 'Click me'
217
+ end, onClick: ->(action) do
218
+ action.windows_open url: json_ui_garage_url(path: 'home/blank')
219
+ end
220
+
221
+ scroll.spacer height: 32
162
222
  scroll.h4 text: 'With grid-like functionality'
163
223
  scroll.spacer height: 8
164
224
  scroll.panels_responsive \
@@ -66,5 +66,45 @@ json_ui_page json do |page|
66
66
  end, childViews: ->(panel) do
67
67
  panel.label text: 'Click me'
68
68
  end
69
+
70
+ scroll.label text: "\n"
71
+ scroll.h1 text: 'Changed when Hover'
72
+ scroll.panels_vertical id: 'default1', width: 100, height: 100, backgroundColor: '#b3bac2', align: 'center', onMouseEnter: ->(action) {
73
+ action.runMultiple childActions: ->(saction) do
74
+ saction.components_set targetId: 'default1', data: { displayed: false }
75
+ saction.components_set targetId: 'hovered1', data: { displayed: true }
76
+ end
77
+ }, childViews: ->(panel) do
78
+ panel.label text: 'Hover me'
79
+ end
80
+ scroll.panels_vertical id: 'hovered1', displayed: false, width: 100, height: 100, backgroundColor: '#b3bac2', align: 'center', onMouseLeave: ->(action) {
81
+ action.runMultiple childActions: ->(saction) do
82
+ saction.components_set targetId: 'default1', data: { displayed: true }
83
+ saction.components_set targetId: 'hovered1', data: { displayed: false }
84
+ end
85
+ }, childViews: ->(panel) do
86
+ panel.label text: 'Hover active'
87
+ end
88
+
89
+ scroll.label text: "\n"
90
+ scroll.h1 text: 'Changed when Hover (with onClick)'
91
+ scroll.panels_vertical id: 'default2', width: 100, height: 100, backgroundColor: '#b3bac2', align: 'center', onMouseEnter: ->(action) {
92
+ action.runMultiple childActions: ->(saction) do
93
+ saction.components_set targetId: 'default2', data: { displayed: false }
94
+ saction.components_set targetId: 'hovered2', data: { displayed: true }
95
+ end
96
+ }, childViews: ->(panel) do
97
+ panel.label text: 'Hover me'
98
+ end
99
+ scroll.panels_vertical id: 'hovered2', displayed: false, width: 100, height: 100, backgroundColor: '#b3bac2', align: 'center', onMouseLeave: ->(action) {
100
+ action.runMultiple childActions: ->(saction) do
101
+ saction.components_set targetId: 'default2', data: { displayed: true }
102
+ saction.components_set targetId: 'hovered2', data: { displayed: false }
103
+ end
104
+ }, childViews: ->(panel) do
105
+ panel.label text: 'Click me'
106
+ end, onClick: ->(action) do
107
+ action.windows_open url: json_ui_garage_url(path: 'home/blank')
108
+ end
69
109
  end
70
110
  end
@@ -104,6 +104,29 @@ page.scroll padding: glib_json_padding_body, childViews: ->(scroll) do
104
104
  tooltip: { text: 'Hello world' },
105
105
  disabled: true
106
106
 
107
+ scroll.spacer height: 10
108
+ scroll.button \
109
+ text: 'Button with mouse enter and leave',
110
+ id: 'default',
111
+ onMouseEnter: ->(action) {
112
+ action.runMultiple childActions: ->(saction) do
113
+ saction.components_set targetId: 'default', data: { displayed: false }
114
+ saction.components_set targetId: 'hovered', data: { displayed: true }
115
+ end
116
+ }
117
+ scroll.button \
118
+ text: 'Button with mouse enter and leave (Active)',
119
+ id: 'hovered',
120
+ displayed: false,
121
+ onMouseLeave: ->(action) {
122
+ action.runMultiple childActions: ->(saction) do
123
+ saction.components_set targetId: 'default', data: { displayed: true }
124
+ saction.components_set targetId: 'hovered', data: { displayed: false }
125
+ end
126
+ }, onClick: ->(action) do
127
+ action.dialogs_alert message: 'Perform action'
128
+ end
129
+
107
130
  scroll.spacer height: 20
108
131
  scroll.button \
109
132
  icon: 'info',
metadata CHANGED
@@ -1,11 +1,11 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glib-web
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.36.4
4
+ version: 4.36.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - ''
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
  date: 2019-10-04 00:00:00.000000000 Z
@@ -136,7 +136,7 @@ dependencies:
136
136
  - - ">="
137
137
  - !ruby/object:Gem::Version
138
138
  version: '0'
139
- description:
139
+ description:
140
140
  email: ''
141
141
  executables: []
142
142
  extensions: []
@@ -445,10 +445,10 @@ files:
445
445
  - lib/glib/value.rb
446
446
  - lib/glib/version.rb
447
447
  - lib/tasks/db.rake
448
- homepage:
448
+ homepage:
449
449
  licenses: []
450
450
  metadata: {}
451
- post_install_message:
451
+ post_install_message:
452
452
  rdoc_options: []
453
453
  require_paths:
454
454
  - lib
@@ -464,7 +464,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
464
464
  version: '0'
465
465
  requirements: []
466
466
  rubygems_version: 3.4.6
467
- signing_key:
467
+ signing_key:
468
468
  specification_version: 4
469
469
  summary: ''
470
470
  test_files: []