turbo_modal 0.3.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 44e01e6f2393f5d94f8bd717862f49e73e049f550a9916e58ede3b561e5f3f54
4
- data.tar.gz: 3abc1568da233389ace10ce3ca9c7b092f07833f9b46e45f588de7b4734a850a
3
+ metadata.gz: '0078dc10ef887436764ed4b1dd676e73ada176603190f8d8eb8eb02bd19837c5'
4
+ data.tar.gz: 777a55c156dd52f49b66b8eec882a7d093dbd5e3b7f9884bf4999eacbdb00d38
5
5
  SHA512:
6
- metadata.gz: dde473c24794b73d4991021b5a943619ed21c8ee3a5bdc01f61fe06e3fead2ac5de88c33eb509a3fe505f8aed5bbc1c951938eaa514461f6365f5cb4bc6ddacf
7
- data.tar.gz: 131c41b10b3eecc05f7a4854d2c478b58d8405f4709d21fd584e9854cf76da690076a5e0ece96ba82466bef2f61bf373f2e0072d5b842ba0615b71c03758cfc4
6
+ metadata.gz: 3f19861545c075e19cad1f516c05e022ee7fed7b64825e922b4c62fbc4f8a65ef59525db850fe6488cc26a89da3555c39493abc4fee8f78871025a0b503c7a2c
7
+ data.tar.gz: dd29b5c61a67d68721cc57a4806b0f62cf15c421444598981074d258767a727840774769e0d920655cccd40a4af2d6a474f42f82ebf88b1114aef9b4b15d0a7d
@@ -19,7 +19,7 @@ class ModalController extends Controller {
19
19
  open(e) {
20
20
  this.turboFrameTarget.src = e.detail.url;
21
21
  this.typeValue = e.detail.type;
22
- showScrim();
22
+ showScrim(e.detail.dismiss);
23
23
  }
24
24
 
25
25
  close(e) {
@@ -50,8 +50,8 @@ class ModalController extends Controller {
50
50
  /**
51
51
  * Show a modal, requires a url for a page that renders a turbo-frame with id `modal`.
52
52
  */
53
- function openModal(url, type = "") {
54
- window.dispatchEvent(new CustomEvent("modal:open", { detail: { url: url, type: type }}));
53
+ function openModal(url, type = "", dismiss = true) {
54
+ window.dispatchEvent(new CustomEvent("modal:open", { detail: { url: url, type: type, dismiss: dismiss }}));
55
55
  }
56
56
 
57
57
  /**
@@ -17,6 +17,10 @@ class ScrimController extends Controller {
17
17
  delete this.scrimTarget.dataset.hidden;
18
18
  document.body.style.height = "100vh";
19
19
  document.body.style.overflow = "hidden";
20
+
21
+ if (!event.detail.dismiss) {
22
+ this.scrimTarget.style.pointerEvents = "none";
23
+ }
20
24
  }
21
25
 
22
26
  hide(event) {
@@ -39,8 +43,8 @@ class ScrimController extends Controller {
39
43
  /**
40
44
  * Show the scrim element
41
45
  */
42
- function showScrim() {
43
- window.dispatchEvent(new Event("scrim:show"));
46
+ function showScrim(dismiss = true) {
47
+ window.dispatchEvent(new CustomEvent("scrim:show", { detail: { dismiss: dismiss }}));
44
48
  }
45
49
 
46
50
  /**
@@ -1,3 +1,3 @@
1
1
  module TurboModal
2
- VERSION = "0.3.1".freeze
2
+ VERSION = "0.3.2".freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: turbo_modal
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alan Cornthwaite
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2022-05-09 00:00:00.000000000 Z
12
+ date: 2022-05-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails