rails-sweetalert2-confirm 0.9.5 → 0.9.6
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bb1cb50891fbc5806dcc01b28961938e6c657001
|
4
|
+
data.tar.gz: fed487b24022ceca7e05cd404c1319d479307c86
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 84c73951440193557eb66a650496210d49e520fe093435b4ee020e462f276ff457fa8d826397f3900a2b6aff2432b30701172c8725bbca295f940639a11e6b44
|
7
|
+
data.tar.gz: 249596f89c47626903cabba4e56151661822e4d2915a1c022e7630e3883d373287dbb29af49d93ffd2e95e5d87ff86497bd705e1b8aec8c444cfcd397bcc4ebc
|
@@ -1,7 +1,8 @@
|
|
1
1
|
module RailsSweetAlert2Confirm
|
2
2
|
SWAL_OPTIONS_MAPPINGS = {
|
3
3
|
confirm: :title,
|
4
|
-
remote: :remote
|
4
|
+
remote: :remote,
|
5
|
+
method: :method
|
5
6
|
}
|
6
7
|
|
7
8
|
module ViewHelpers
|
@@ -26,7 +27,8 @@ module RailsSweetAlert2Confirm
|
|
26
27
|
|
27
28
|
def merge_options_into_swal(options)
|
28
29
|
options = merge_confirm_into_swal(options)
|
29
|
-
merge_remote_into_swal(options)
|
30
|
+
options = merge_remote_into_swal(options)
|
31
|
+
merge_method_into_swal(options)
|
30
32
|
end
|
31
33
|
|
32
34
|
%w(confirm remote method).each do |option|
|
@@ -36,20 +38,17 @@ module RailsSweetAlert2Confirm
|
|
36
38
|
options[:data][:swal] ||= {}
|
37
39
|
option = option.to_sym
|
38
40
|
options[:data][:swal][SWAL_OPTIONS_MAPPINGS[option]] =
|
39
|
-
|
41
|
+
if option == :method
|
42
|
+
options[option] ||
|
43
|
+
options[:data][option]
|
44
|
+
else
|
45
|
+
options.delete(option) ||
|
46
|
+
options[:data].delete(option)
|
47
|
+
end
|
40
48
|
end
|
41
49
|
options
|
42
50
|
end
|
43
51
|
|
44
|
-
define_method("retrieve_#{option}_from") do |options|
|
45
|
-
case option
|
46
|
-
when "method"
|
47
|
-
options[option] || options[:data][option]
|
48
|
-
else
|
49
|
-
options.delete(option) || options[:data].delete(option)
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
52
|
define_method("options_has_#{option}?") do |options|
|
54
53
|
option = option.to_sym
|
55
54
|
(options[option] || options[:data].try(:[], option)).present?
|