pg_rails 7.0.8.pre.alpha.63 → 7.0.8.pre.alpha.64

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: 8d32d439bc5fe9dd6527c13d1800daf3381c2590b883844e772ca336732efeec
4
- data.tar.gz: f9aff03d93288060f00dfb7efcb6c9160ffc2f7ac6ba9cd3c59aa6f3934d5bbe
3
+ metadata.gz: 897b3e763decbc3633e769f5c80b03b2ac4beeb6d7870418205890f07be921a3
4
+ data.tar.gz: bcb3121b4f5c7dbdbf43f7363121617fdc1576b37fae413b508e947e68b1789b
5
5
  SHA512:
6
- metadata.gz: 397c4960f4e804ed8b88096542573b34475a935426db607cb14542a70991697c76404bae1460b0a8859eb3dbe6eefc2b9f829ebebf9cb019a9501b89c5b24790
7
- data.tar.gz: dd5e763c4fe36a2f5b7115dffcadceba504e8bdd99a874c727e5ce1197698dafadb142b5601ada51d61a980421c6beef2fbea865fa3df1a15dd0391e96054d82
6
+ metadata.gz: 14f270d418616143ce27842e5ea615760ad472fdd81f758a41303a3cb45173b57beaec9ff54cdea07ef0b1200f02cfe24e2e978476f41d82f74627ce1de4c34c
7
+ data.tar.gz: e66b21ddb42ee202b0bcd62b5e6cb0a22f16e6f5561edbc4e142b12acdcc91bd0131402dfef49f20db159fff99b05b76d5f57db9a53acec4ad92251d3e46ee42
@@ -311,7 +311,7 @@ module PgEngine
311
311
  direction = options[:default].first[1]
312
312
  do_sort(scope, field, direction)
313
313
  else
314
- scope
314
+ do_sort(scope, 'id', 'desc')
315
315
  end
316
316
  end
317
317
  end
@@ -22,7 +22,7 @@ module PgEngine
22
22
 
23
23
  protect_from_forgery with: :exception
24
24
 
25
- rescue_from PgEngine::Error, with: :internal_error
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', bindToasts)
37
- document.addEventListener('turbo:render', bindToasts)
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 bindToasts () {
49
- const toastElList = document.querySelectorAll('.toast:not(.hide):not(.show)')
50
- Array.from(toastElList).map(toastEl => new bootstrap.Toast(toastEl).show())
48
+ function bindToastElements () {
49
+ const toastQuery = '.pg-toast:not(.hide):not(.show)'
50
+
51
+ const toastElList = document.querySelectorAll(toastQuery)
52
+ Array.from(toastElList).each(toastEl => {
53
+ new bootstrap.Toast(toastEl).show()
54
+ toastEl.addEventListener('hidden.bs.toast', () => {
55
+ toastEl.remove()
56
+ })
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
- // console.log('A child node has been added or removed.')
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').style.visibility = 'hidden'
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
- .alert.alert-dismissible[
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] }
@@ -1,3 +1,3 @@
1
1
  #flash-wrapper.d-flex.justify-content-around
2
- #flash.flash
2
+ #flash.flash.position-relative.w-100.d-flex.justify-content-center
3
3
  = render partial: 'pg_layout/flash'
@@ -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"
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PgRails
4
- VERSION = '7.0.8-alpha.63'
4
+ VERSION = '7.0.8-alpha.64'
5
5
  end
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.63
4
+ version: 7.0.8.pre.alpha.64
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-09 00:00:00.000000000 Z
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