ama_layout 9.4.1 → 9.5.0

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
  SHA1:
3
- metadata.gz: 5eec21049a6f1660f9786d4d1a0615674d81e2bb
4
- data.tar.gz: 8ccc19c0885fc02d09a8a75083ccc61eb2b95800
3
+ metadata.gz: 44d88e21d02649839bb1d1def73de6fa18c493bc
4
+ data.tar.gz: b6ffdddd351a0192c5149eef34c3e1eec2f2ac6a
5
5
  SHA512:
6
- metadata.gz: 97d8fd7d8652dbb53574478c7f6f62208699cb12c579d1bda62ca6abbd52aae5924ff592d124c9b25878ef5d6db384faa6e7ef476925198bc71dd02ea0f98af7
7
- data.tar.gz: dd26f7f47189d45689c9f0eb6b2b62ee6203df78dcf6d58979a2714d1f513eb4a836ec5f8f62ec19113a52cf4eacc33fec141039f76c427fc7098bee4b2e6a09
6
+ metadata.gz: 5555d55e931fe951a9bbe4233e9e4ff80223689416e576201aec4ba38480b7f2a4976cb30bd495430ae3b1137b12364d07159ff1168dd92116b609c08fd1d80f
7
+ data.tar.gz: 8c40548bf6150847879dcd90ce835b0023db1d45787ce400e4429f5f96ef4cab46136ac41b4059ca7714b2fed0c26b0f745b94fab9ec60f09a297a91a59fe3bd
@@ -2,8 +2,8 @@
2
2
  Override the default confirm dialog
3
3
  defined by jQuery UJS
4
4
  */
5
- $.rails.allowAction = function(link){
6
- if (link.data('confirm') == undefined){
5
+ $.rails.allowAction = function(link) {
6
+ if (link.data('confirm') == undefined) {
7
7
  return true;
8
8
  }
9
9
  $.rails.showConfirmationDialog(link);
@@ -15,7 +15,7 @@ $.rails.allowAction = function(link){
15
15
  Rails doesn't re-trigger the modal. Then
16
16
  trigger a click of the link.
17
17
  */
18
- $.rails.confirmed = function(link){
18
+ $.rails.confirmed = function(link) {
19
19
  link.data('confirm', null);
20
20
  if (link.data('method')){
21
21
  // let rails handle non-GET requests
@@ -29,13 +29,19 @@ $.rails.confirmed = function(link){
29
29
  Toggle the Foundation reveal modal when a data-confirm
30
30
  element is clicked.
31
31
  */
32
- $.rails.showConfirmationDialog = function(link){
32
+ $.rails.showConfirmationDialog = function(link) {
33
33
  var el = link.data('confirm');
34
- $('[data-' + el + ']').foundation('open');
34
+ var modal = $('[data-' + el + ']');
35
+ var key = link.data('reveal-confirm-key');
36
+ if (key && key.length) {
37
+ modal.data('reveal-confirm-key', key);
38
+ }
39
+ modal.foundation('open');
35
40
  }
36
41
 
37
42
  /*
38
- General Usage:
43
+ Single Link/Single Modal:
44
+
39
45
  Link
40
46
  <a href="somewhere" data-confirm="my-data-element">Delete</a>
41
47
 
@@ -45,12 +51,31 @@ $.rails.showConfirmationDialog = function(link){
45
51
  <a href="#" data-reveal-confirm="my-data-element">OK</a>
46
52
  ...
47
53
  </div>
54
+
55
+ Multiple Links/Single Modal:
56
+
57
+ Links
58
+ <a href="somewhere" data-confirm="my-data-element" data-reveal-confirm-key="element-1">Delete</a>
59
+ <a href="somewhere-else" data-confirm="my-data-element" data-reveal-confirm-key="element-2">Delete</a>
60
+
61
+ Modal
62
+ <div class="reveal" data-reveal data-my-data-element>
63
+ ...
64
+ <a href="#" data-reveal-confirm="my-data-element">OK</a>
65
+ ...
66
+ </div>
48
67
  */
49
- $(document).on('click', '*[data-reveal-confirm]', function(e){
68
+ $(document).on('click', '*[data-reveal-confirm]', function(e) {
50
69
  e.preventDefault();
51
- var el = $(e.currentTarget).data('reveal-confirm');
52
- var link = $('[data-confirm="'+ el + '"]');
70
+ var target = e.currentTarget;
71
+ var el = $(target).data('reveal-confirm');
53
72
  var modal = $('[data-' + el + ']');
73
+ var key = $(modal).data('reveal-confirm-key');
74
+ var link = $('[data-confirm="'+ el + '"]');
75
+ if (key && key.length) {
76
+ link = $('[data-reveal-confirm-key=' + key + ']');
77
+ }
54
78
  $(modal).foundation('close');
79
+ $(modal).data('reveal-confirm-key', null);
55
80
  $.rails.confirmed(link);
56
81
  });
@@ -1,3 +1,3 @@
1
1
  module AmaLayout
2
- VERSION = '9.4.1'
2
+ VERSION = '9.5.0'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ama_layout
3
3
  version: !ruby/object:Gem::Version
4
- version: 9.4.1
4
+ version: 9.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael van den Beuken
@@ -18,7 +18,7 @@ authors:
18
18
  autorequire:
19
19
  bindir: bin
20
20
  cert_chain: []
21
- date: 2018-06-22 00:00:00.000000000 Z
21
+ date: 2018-06-26 00:00:00.000000000 Z
22
22
  dependencies:
23
23
  - !ruby/object:Gem::Dependency
24
24
  name: foundation-rails