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: 1426b7aba09cf180dfc97ea0ab32f685c9a3b56f9ca86a8f50b1184cae74c38a
4
- data.tar.gz: 67aff9d7c8abe089bb54a1b97e1350e4e28a2d97e36ce600e51a3e826f09226b
3
+ metadata.gz: 9e701bb2d6bfd26a8e51e688c051448bb68f6b09d5b0edd60e047e1c3609000f
4
+ data.tar.gz: f43ef70a87f3b816c5deeab1e9ad8969d800c3ea429c9aea797539c71bfaa788
5
5
  SHA512:
6
- metadata.gz: 8cb4bf38f4460fdd488f5a068d37ccb8295bcc67f2a6d99ad008a7dcf8a942941266730170d8c2c466a1e48e389f72c8fe236474eab57149c9fac9f1830b3331
7
- data.tar.gz: 04bbc058a1c816233907d8c8160b9c25d77acd0cf36470826df636934fdc7cbd8b4406305582246d2447eff946946710887ef9c1e1dbbb9766874a5eadf912c4
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
- var config = #{RailsToastify.configuration.to_json};
13
- options = options || {};
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-bottom-right'
3
- configuration.animation = 'zoom'
2
+ configuration.position = 'toast-container-top-right'
3
+ configuration.animation = 'bounce'
4
4
  configuration.duration = 5000
5
- configuration.theme = 'dark'
6
- configuration.type = 'success'
5
+ configuration.theme = 'light'
6
+ configuration.type = 'default'
7
7
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RailsToastify
4
- VERSION = "1.1.0"
4
+ VERSION = "1.1.1"
5
5
  end
@@ -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-bottom-right'
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 to_json
27
+ def to_h
28
28
  {
29
29
  position: @position,
30
30
  animation: @animation,
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_toastify
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elton Santos