pg_rails 7.0.8.pre.alpha.63 → 7.0.8.pre.alpha.65
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/pg_engine/app/controllers/concerns/pg_engine/resource.rb +1 -1
- data/pg_engine/app/controllers/pg_engine/base_controller.rb +1 -1
- data/pg_layout/app/javascript/application.js +17 -10
- data/pg_layout/app/javascript/controllers/navbar_controller.js +2 -1
- data/pg_layout/app/views/pg_layout/_flash.html.slim +1 -19
- data/pg_layout/app/views/pg_layout/_flash_container.html.slim +1 -1
- data/pg_layout/app/views/pg_layout/_flash_inner.html.slim +24 -0
- data/pg_rails/lib/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c1b7d742107efb7bfdd00d458d0df8b298395702ae8aacaa1cf1ffe9083ca09e
|
4
|
+
data.tar.gz: 2592e3ec5a153c28314bab3c754c86dfee514fe5cf308380bae1324e14167565
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1022d09e2a8fad3a7bca4cf92038ed521951daca564ecbca33c52c440cf565bd71758edbc7445f68e023c1eea4292647f50350f378675063912d1c3556a26030
|
7
|
+
data.tar.gz: 10910645b466eeb4bcbaae5610977f4ed61fe4c5886e9562ac25d3a4970f3b9a3c2f3153843d0be3f3d69e2c829683f5b1178e1ed8bb2d56f770aae3b6a8724c
|
@@ -22,7 +22,7 @@ module PgEngine
|
|
22
22
|
|
23
23
|
protect_from_forgery with: :exception
|
24
24
|
|
25
|
-
rescue_from
|
25
|
+
rescue_from StandardError, with: :internal_error
|
26
26
|
rescue_from Pundit::NotAuthorizedError, with: :not_authorized
|
27
27
|
rescue_from Redirect do |e|
|
28
28
|
redirect_to e.url
|
@@ -33,8 +33,8 @@ Rollbar.configure({
|
|
33
33
|
}
|
34
34
|
})
|
35
35
|
|
36
|
-
document.addEventListener('turbo:load',
|
37
|
-
document.addEventListener('turbo:render',
|
36
|
+
document.addEventListener('turbo:load', bindAndObserveToasts)
|
37
|
+
document.addEventListener('turbo:render', bindAndObserveToasts)
|
38
38
|
|
39
39
|
document.addEventListener('turbo:before-cache', () => {
|
40
40
|
document.querySelectorAll('.offcanvas-backdrop').forEach((el) => {
|
@@ -45,9 +45,20 @@ document.addEventListener('turbo:before-cache', () => {
|
|
45
45
|
})
|
46
46
|
})
|
47
47
|
|
48
|
-
function
|
49
|
-
const
|
50
|
-
|
48
|
+
function bindToastElements () {
|
49
|
+
const toastQuery = '.pg-toast:not(.hide):not(.show)'
|
50
|
+
|
51
|
+
const toastElList = document.querySelectorAll(toastQuery)
|
52
|
+
Array.from(toastElList).map(toastEl => {
|
53
|
+
toastEl.addEventListener('hidden.bs.toast', () => {
|
54
|
+
toastEl.remove()
|
55
|
+
})
|
56
|
+
return new bootstrap.Toast(toastEl).show()
|
57
|
+
})
|
58
|
+
}
|
59
|
+
|
60
|
+
function bindAndObserveToasts () {
|
61
|
+
bindToastElements()
|
51
62
|
|
52
63
|
// Select the node that will be observed for mutations
|
53
64
|
const targetNode = document.getElementById('flash')
|
@@ -59,11 +70,7 @@ function bindToasts () {
|
|
59
70
|
const callback = (mutationList, observer) => {
|
60
71
|
for (const mutation of mutationList) {
|
61
72
|
if (mutation.type === 'childList') {
|
62
|
-
|
63
|
-
const toastElList = document.querySelectorAll('.toast:not(.hide):not(.show)')
|
64
|
-
Array.from(toastElList).map(toastEl => new bootstrap.Toast(toastEl).show())
|
65
|
-
} else if (mutation.type === 'attributes') {
|
66
|
-
// console.log(`The ${mutation.attributeName} attribute was modified.`)
|
73
|
+
bindToastElements()
|
67
74
|
}
|
68
75
|
}
|
69
76
|
}
|
@@ -5,7 +5,8 @@ import { fadeOut, fadeIn } from './../utils/utils'
|
|
5
5
|
export default class extends Controller {
|
6
6
|
connect () {
|
7
7
|
if (document.getElementById('sidebar').classList.contains('opened')) {
|
8
|
-
document.querySelector('.navbar .navbar-brand')
|
8
|
+
const brand = document.querySelector('.navbar .navbar-brand')
|
9
|
+
if (brand) brand.style.visibility = 'hidden'
|
9
10
|
}
|
10
11
|
}
|
11
12
|
|
@@ -2,22 +2,4 @@
|
|
2
2
|
- flash_to_show = flash.select { |fm| fm[0].to_sym.in?(ApplicationController._flash_types) && fm[1].present? }
|
3
3
|
/ slim-lint:enable LineLength
|
4
4
|
- flash_to_show.each do |flash_type, message|
|
5
|
-
|
6
|
-
class="mt-2 d-flex align-items-center alert-#{flash_type_to_class(flash_type)}"
|
7
|
-
data-turbo-temporary="true"
|
8
|
-
aria-live="assertive" aria-atomic="true" role="alert"
|
9
|
-
]
|
10
|
-
- case flash_type
|
11
|
-
- when 'critical'
|
12
|
-
/ .bi.bi-emoji-dizzy.me-3.fs-2
|
13
|
-
.bi.bi-exclamation-triangle-fill.me-3.fs-2
|
14
|
-
- when 'alert'
|
15
|
-
.bi.bi-exclamation-triangle-fill.me-2
|
16
|
-
- when 'warning'
|
17
|
-
.bi.bi-exclamation-circle.me-2
|
18
|
-
- when 'success'
|
19
|
-
.bi.bi-check-lg.me-2
|
20
|
-
- when 'notice'
|
21
|
-
.bi.bi-info-circle.me-2
|
22
|
-
= message
|
23
|
-
button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"
|
5
|
+
= render partial: 'pg_layout/flash_inner', locals: { flash_type:, message:, toast: flash[:toast] }
|
@@ -0,0 +1,24 @@
|
|
1
|
+
/ # locals: (flash_type:, message:, toast: false)
|
2
|
+
|
3
|
+
.alert.alert-dismissible[
|
4
|
+
class="
|
5
|
+
mt-2 d-flex align-items-center
|
6
|
+
alert-#{flash_type_to_class(flash_type)}
|
7
|
+
#{'position-absolute pg-toast' if toast}"
|
8
|
+
data-turbo-temporary="true" data-bs-autohide="true"
|
9
|
+
aria-live="assertive" aria-atomic="true" role="alert"
|
10
|
+
]
|
11
|
+
- case flash_type
|
12
|
+
- when 'critical'
|
13
|
+
/ .bi.bi-emoji-dizzy.me-3.fs-2
|
14
|
+
.bi.bi-exclamation-triangle-fill.me-3.fs-2
|
15
|
+
- when 'alert'
|
16
|
+
.bi.bi-exclamation-triangle-fill.me-2
|
17
|
+
- when 'warning'
|
18
|
+
.bi.bi-exclamation-circle.me-2
|
19
|
+
- when 'success'
|
20
|
+
.bi.bi-check-lg.me-2
|
21
|
+
- when 'notice'
|
22
|
+
.bi.bi-info-circle.me-2
|
23
|
+
= message
|
24
|
+
button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"
|
data/pg_rails/lib/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pg_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 7.0.8.pre.alpha.
|
4
|
+
version: 7.0.8.pre.alpha.65
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Martín Rosso
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-05-
|
11
|
+
date: 2024-05-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -1093,6 +1093,7 @@ files:
|
|
1093
1093
|
- pg_layout/app/views/pg_layout/_error.html.erb
|
1094
1094
|
- pg_layout/app/views/pg_layout/_flash.html.slim
|
1095
1095
|
- pg_layout/app/views/pg_layout/_flash_container.html.slim
|
1096
|
+
- pg_layout/app/views/pg_layout/_flash_inner.html.slim
|
1096
1097
|
- pg_layout/app/views/pg_layout/_navbar.html.erb
|
1097
1098
|
- pg_layout/app/views/pg_layout/_sidebar.html.erb
|
1098
1099
|
- pg_layout/app/views/pg_layout/_sidebar_mobile.html.erb
|