lato_cms 3.1.0 → 3.1.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: fe4976c31eee3bc5137206d66037755baf19825e152a1c37a4be32e5b715dd6d
4
- data.tar.gz: a209a52cb918989ce0179da4c902e3f4f71f0bb0843b6c4e7fac83c8b901424c
3
+ metadata.gz: 0bb418bbe488978095559ae9b357d135817dfabc9b07758a4d4de227c64193bd
4
+ data.tar.gz: eecb8e9c4dc67d3407a50fefffc3886a6000fbafeee2ad559b796abffd725b1f
5
5
  SHA512:
6
- metadata.gz: 469fa040c5c8ea3b04d630c1d664e0ff2db92a418089852eb2252c57899da646325c76969b4389dd219f20ff96c3f679b0581548107e19a354e9f47977bde3bd
7
- data.tar.gz: 7638ec4ca940ab161bb361ec69fff832fb3950ab814dd656d3f4dabe422cafdf6b91ebff1962949dfcd89e86fd269d2bde9d95d17fff3f1a25eb16a36dc9413b
6
+ metadata.gz: 3ecd3728c992b947b2b44c1caaa5caa0dcb6629aab9dfccc5fbf7a197288e34b78eaf05f76d58feac3739b4dd42c1c7173e298e86789681efd37dcedcfaa55d0
7
+ data.tar.gz: 83671037f9b74b4044459782c9adf708b1cd99cbdb4f9b3fa95a2d6c3f3b2f692dd177c8c1d970b8b33a5fb5a416a1402a433d1122047089cad2198580515229
@@ -1,12 +1,17 @@
1
1
  import { Controller } from '@hotwired/stimulus'
2
2
 
3
- // Refreshes the enclosing turbo-frame (or the whole page) whenever a
4
- // Bootstrap modal on the page closes. Used after triggering a
3
+ // Refreshes the enclosing turbo-frame (or the whole page) when the shared
4
+ // `lato_operation` progress modal closes used after triggering a
5
5
  // Lato::Operation (e.g. "Regenerate with AI", "Clone & translate") from a
6
6
  // link inside it: the underlying page/frame has no way to know when that
7
7
  // background job finishes, so once the admin dismisses the operation's
8
8
  // progress modal, refresh so the result is shown without a manual reload.
9
9
  //
10
+ // Only reacts when the modal that just closed actually contains the
11
+ // `#lato_operation` frame — every Bootstrap modal on the page fires
12
+ // `hidden.bs.modal`, including ones with nothing to do with an operation
13
+ // (e.g. this very form's own modal), and those must not trigger a reload.
14
+ //
10
15
  // Mounted on an element INSIDE the turbo-frame's content, not on the frame
11
16
  // tag itself: when this frame is opened inside a modal, `lato-action`
12
17
  // pre-creates a bare `<turbo-frame>` via innerHTML before Turbo fetches
@@ -18,15 +23,17 @@ import { Controller } from '@hotwired/stimulus'
18
23
  // page (no frame at all, so it falls back to reloading the whole page).
19
24
  export default class extends Controller {
20
25
  connect () {
21
- this.reload = this.reload.bind(this)
22
- document.addEventListener('hidden.bs.modal', this.reload)
26
+ this.onModalHidden = this.onModalHidden.bind(this)
27
+ document.addEventListener('hidden.bs.modal', this.onModalHidden)
23
28
  }
24
29
 
25
30
  disconnect () {
26
- document.removeEventListener('hidden.bs.modal', this.reload)
31
+ document.removeEventListener('hidden.bs.modal', this.onModalHidden)
27
32
  }
28
33
 
29
- reload () {
34
+ onModalHidden (event) {
35
+ if (!event.target.querySelector('#lato_operation')) return
36
+
30
37
  const frame = this.element.closest('turbo-frame')
31
38
  if (frame && frame.getAttribute('src')) {
32
39
  frame.reload()
@@ -1,3 +1,3 @@
1
1
  module LatoCms
2
- VERSION = "3.1.0"
2
+ VERSION = "3.1.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lato_cms
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.0
4
+ version: 3.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gregorio Galante