rails-sweetalert2-confirm 0.9.9 → 0.9.10
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d5bf640acac05705af83e22b000f8c7089122fed38c1826463ddf770c18c3ee1
|
4
|
+
data.tar.gz: 614e66aa79624a8f744d1f843437270c7abdc1a28d60f564bddb5792c95924f8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2cb5b3cd4c5a65e8c3b55b8500d7bce4a913d341469f5fc6d03a2ff601fd9d089621508cffc6d9cc655dab8cc44b38201db9df6aafaf78d74a93abbc89b46461
|
7
|
+
data.tar.gz: c8fbf9c8220b1e9175be9766874445f380e185102215b29a66c4797d5842f9efb6dba2e329239b8cc5005aadd792ba7642c53d9351d2a5101ce1f176b15b4f94
|
@@ -1,10 +1,6 @@
|
|
1
|
-
|
2
|
-
SWAL_OPTIONS_MAPPINGS = {
|
3
|
-
confirm: :title,
|
4
|
-
remote: :remote,
|
5
|
-
method: :method
|
6
|
-
}
|
1
|
+
# frozen_string_literal: true
|
7
2
|
|
3
|
+
module RailsSweetAlert2Confirm
|
8
4
|
module ViewHelpers
|
9
5
|
def link_to(*args, &block)
|
10
6
|
options = args[block_given? ? 1 : 2] || {}
|
@@ -23,37 +19,38 @@ module RailsSweetAlert2Confirm
|
|
23
19
|
super(*args, &block)
|
24
20
|
end
|
25
21
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
options =
|
30
|
-
options =
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
22
|
+
private def merge_options_into_swal(options)
|
23
|
+
return options unless options_have_confirm?(options)
|
24
|
+
options = configure_swal_options(options)
|
25
|
+
options = merge_swal_remote_options(options)
|
26
|
+
options = merge_swal_confirm_options(options)
|
27
|
+
end
|
28
|
+
|
29
|
+
private def configure_swal_options(options)
|
30
|
+
options[:data] ||= {}
|
31
|
+
options[:data][:swal] ||= {}
|
32
|
+
end
|
33
|
+
|
34
|
+
private def merge_swal_remote_options(options)
|
35
|
+
return options unless options_have_remote?(options)
|
36
|
+
options[:data][:swal][:remote] = fetch_option(:remote, options)
|
37
|
+
end
|
38
|
+
|
39
|
+
private def merge_swal_confirm_options(options)
|
40
|
+
return options unless options_have_confirm?(options)
|
41
|
+
options[:data][:swal][:title] = fetch_option(:confirm, options)
|
42
|
+
end
|
43
|
+
|
44
|
+
private def fetch_option(option, options)
|
45
|
+
options.delete(option) || options[:data].delete(option)
|
46
|
+
end
|
47
|
+
|
48
|
+
private def options_have_confirm?(options)
|
49
|
+
(options[:confirm] || options.dig(:data, :confirm)).present?
|
50
|
+
end
|
51
|
+
|
52
|
+
private def options_have_remote?(options)
|
53
|
+
(options[:remote] || options.dig(:data, :remote)).present?
|
57
54
|
end
|
58
55
|
end
|
59
56
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails-sweetalert2-confirm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joe Woodward
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-03-
|
11
|
+
date: 2019-03-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|