rails_toastify 1.1.0 → 1.1.1
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9e701bb2d6bfd26a8e51e688c051448bb68f6b09d5b0edd60e047e1c3609000f
|
4
|
+
data.tar.gz: f43ef70a87f3b816c5deeab1e9ad8969d800c3ea429c9aea797539c71bfaa788
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6237ad77aea9dc367aa4a21590cbcd95b01680cef1370d6db7914d9f257499c2d13cc299f958a2f722a5db9d71969d321799a680b3530f63b686c9828d779399
|
7
|
+
data.tar.gz: 2c05603ad580b88f8be579fa649a8f1a1d67c8090291a7cf5e9496844fc7b2690e94447da39e535d57cdcf7eb972304547ef40e3992cea54009cf3e08dbeaae3
|
@@ -8,14 +8,22 @@ module RailsToastifyHelper
|
|
8
8
|
<<-JS.html_safe
|
9
9
|
document.addEventListener('DOMContentLoaded', function() {
|
10
10
|
window.RailsToastify = {
|
11
|
+
config: #{RailsToastify.configuration.to_h.to_json},
|
11
12
|
show: function(message, options) {
|
12
|
-
|
13
|
-
|
14
|
-
showToast(message, Object.assign({}, config, options));
|
13
|
+
options = Object.assign({}, this.config, options || {});
|
14
|
+
showToast(message, options);
|
15
15
|
}
|
16
16
|
};
|
17
17
|
});
|
18
18
|
JS
|
19
19
|
end
|
20
20
|
end
|
21
|
+
|
22
|
+
def show_toast(message, options = {})
|
23
|
+
javascript_tag do
|
24
|
+
<<-JS.html_safe
|
25
|
+
RailsToastify.show(#{message.to_json}, #{options.to_json});
|
26
|
+
JS
|
27
|
+
end
|
28
|
+
end
|
21
29
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
RailsToastify.setup do |configuration|
|
2
|
-
configuration.position = 'toast-container-
|
3
|
-
configuration.animation = '
|
2
|
+
configuration.position = 'toast-container-top-right'
|
3
|
+
configuration.animation = 'bounce'
|
4
4
|
configuration.duration = 5000
|
5
|
-
configuration.theme = '
|
6
|
-
configuration.type = '
|
5
|
+
configuration.theme = 'light'
|
6
|
+
configuration.type = 'default'
|
7
7
|
end
|
data/lib/rails_toastify.rb
CHANGED
@@ -17,14 +17,14 @@ module RailsToastify
|
|
17
17
|
attr_accessor :position, :animation, :duration, :theme, :type
|
18
18
|
|
19
19
|
def initialize
|
20
|
-
@position = 'toast-container-
|
20
|
+
@position = 'toast-container-top-right'
|
21
21
|
@animation = 'bounce'
|
22
22
|
@duration = 5000
|
23
23
|
@theme = 'light'
|
24
24
|
@type = 'default'
|
25
25
|
end
|
26
26
|
|
27
|
-
def
|
27
|
+
def to_h
|
28
28
|
{
|
29
29
|
position: @position,
|
30
30
|
animation: @animation,
|