toastrjs-rails 2.1.3.1 → 2.1.3.2

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
- SHA1:
3
- metadata.gz: d566a31c983d065540548be5e35ca33514628c1e
4
- data.tar.gz: e94e7ce31a338cc5e9a607a65f9f0d239854883d
2
+ SHA256:
3
+ metadata.gz: bbf89f44bf7ae01b4d712316e1480cd5713c536f7b3abdc3b971e6ed3db3072a
4
+ data.tar.gz: 636dc900b721286441fe754e6aa2817ebec996d6ba42019880b7e38997138940
5
5
  SHA512:
6
- metadata.gz: 50409dfea6ed2630dc7cc711360da0c2df7a5caa74c960739f7b05090a37301097a4b69c1e058051909588bc80625786e943c5b0730459268b5d279d052b571f
7
- data.tar.gz: 05e2eb530979bea402c7eb4fd7e8d1edf726b90203b34f027bee327bdfe138a7018b8d139ed19ed17d6b26af8e84ba86e6189888ffacde642bb7191525b5d958
6
+ metadata.gz: 76d6eb9685b4a391ebc74b935d4ae43b0312e04175b9fdc7509002d1c23d10bcd295bee8deb12fa243a60edab4b03247ed2b1075a2810873800f884c9a9af6fe
7
+ data.tar.gz: fe14b17f69f2909e8a04c8c4c9ce330ac3471e0f56d4bc624868ebd2d6fc6ae256eb7bf0ea300af4b5f966963aa3207f0429d2656ee2403f9b22ac28ce6fdc89
data/README.md CHANGED
@@ -1,36 +1,56 @@
1
- # toastr
1
+ # toastrjs-rails
2
+
2
3
  **toastr** is a Javascript library for Gnome / Growl type non-blocking notifications. jQuery is required. The goal is to create a simple core library that can be customized and extended.
3
4
 
5
+ This gem is wrapped for Rails asset-pipeline
6
+
4
7
  ## Current Version
5
- 2.1.3
8
+ 2.1.3.2
6
9
 
10
+ > **Note** : This version is compatible for toastr version 2.1.3
7
11
 
8
12
  ## Demo
9
13
  Demo can be found at http://CodeSeven.github.com/toastr
10
14
 
11
- ## Quick start
12
-
13
- ### 3 Easy Steps
15
+ ## 3 Easy Steps
14
16
  For other API calls, see the [demo](http://CodeSeven.github.com/toastr).
15
17
 
16
18
  1. update gemfile: gem 'toastrjs-rails'
17
19
 
18
- 2. Add toastr to application.css and application.js:
20
+ 2. Add toastr.min to application.css:
19
21
 
20
- *= require toastr.min
22
+ *= require toastr.min
23
+
24
+ or to application.scss:
25
+
26
+ @import "toastr.min";
21
27
 
22
- //= require toastr.min
28
+ 3. Add toastr.min to application.js:
23
29
 
24
- 3. use toastr to display a toast for info, success, warning or error
30
+ //= require toastr.min
25
31
 
26
- // Display an info toast with no title
27
- toastr.info('Are you the 6 fingered man?')
28
32
 
29
33
  4. You can insert the following helper method in the view template where the flash messages are shown:
30
34
 
31
35
  <%= flash_toastr %>
32
36
 
33
- ### Other Options
37
+ and this erb code is rendered as follows:
38
+
39
+ <script>
40
+ if (!(document.documentElement.hasAttribute(\"data-turbolinks-preview\"))) {
41
+ toastr.#{type}('#{message}', '', { 'closeButton': true });
42
+ }
43
+ </script>
44
+
45
+ > **Note**: `if` confition is for preventing the twice firing of javascript code in body tag due to Turbolinks 5
46
+
47
+ 5. Use toastr to display a toast for info, success, warning or error in javascript file:
48
+
49
+ // Display an info toast with no title
50
+ toastr.info('Are you the 6 fingered man?')
51
+
52
+
53
+ ### Other Options in javascript file
34
54
 
35
55
  // Display a warning toast, with no title
36
56
  toastr.warning('My name is Inigo Montoya. You Killed my father, prepare to die!')
@@ -6,7 +6,10 @@ module Toastrjs
6
6
  flash.each do |type, message|
7
7
  type = 'success' if type == 'notice'
8
8
  type = 'error' if type == 'alert'
9
- text = "<script>toastr.#{type}('#{message}','',{ 'closeButton': true });</script>"
9
+ text = "<script>"
10
+ text += "if (!(document.documentElement.hasAttribute(\"data-turbolinks-preview\"))) {"
11
+ text += "toastr.#{type}('#{message}','',{ 'closeButton': true });"
12
+ text += "}</script>"
10
13
  flash_messages << text.html_safe if message
11
14
  end
12
15
  flash_messages.join("\n").html_safe
@@ -1,5 +1,5 @@
1
1
  module Toastrjs
2
2
  module Rails
3
- VERSION = "2.1.3.1"
3
+ VERSION = "2.1.3.2"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: toastrjs-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.3.1
4
+ version: 2.1.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lucius Choi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-04-10 00:00:00.000000000 Z
11
+ date: 2018-08-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -75,7 +75,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
75
75
  version: '0'
76
76
  requirements: []
77
77
  rubyforge_project:
78
- rubygems_version: 2.4.5
78
+ rubygems_version: 2.7.6
79
79
  signing_key:
80
80
  specification_version: 4
81
81
  summary: A Javascript library for non-blocking notifications