toastrjs-rails 2.1.3.0 → 2.1.3.1
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 +4 -4
- data/README.md +7 -3
- data/lib/toastrjs/rails.rb +1 -0
- data/lib/toastrjs/rails/helper.rb +16 -0
- data/lib/toastrjs/rails/railtie.rb +14 -0
- data/lib/toastrjs/rails/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d566a31c983d065540548be5e35ca33514628c1e
|
4
|
+
data.tar.gz: e94e7ce31a338cc5e9a607a65f9f0d239854883d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 50409dfea6ed2630dc7cc711360da0c2df7a5caa74c960739f7b05090a37301097a4b69c1e058051909588bc80625786e943c5b0730459268b5d279d052b571f
|
7
|
+
data.tar.gz: 05e2eb530979bea402c7eb4fd7e8d1edf726b90203b34f027bee327bdfe138a7018b8d139ed19ed17d6b26af8e84ba86e6189888ffacde642bb7191525b5d958
|
data/README.md
CHANGED
@@ -10,22 +10,26 @@ Demo can be found at http://CodeSeven.github.com/toastr
|
|
10
10
|
|
11
11
|
## Quick start
|
12
12
|
|
13
|
-
###3 Easy Steps
|
13
|
+
### 3 Easy Steps
|
14
14
|
For other API calls, see the [demo](http://CodeSeven.github.com/toastr).
|
15
15
|
|
16
16
|
1. update gemfile: gem 'toastrjs-rails'
|
17
17
|
|
18
18
|
2. Add toastr to application.css and application.js:
|
19
19
|
|
20
|
-
*= require toastr
|
20
|
+
*= require toastr.min
|
21
21
|
|
22
|
-
//= require toastr
|
22
|
+
//= require toastr.min
|
23
23
|
|
24
24
|
3. use toastr to display a toast for info, success, warning or error
|
25
25
|
|
26
26
|
// Display an info toast with no title
|
27
27
|
toastr.info('Are you the 6 fingered man?')
|
28
28
|
|
29
|
+
4. You can insert the following helper method in the view template where the flash messages are shown:
|
30
|
+
|
31
|
+
<%= flash_toastr %>
|
32
|
+
|
29
33
|
### Other Options
|
30
34
|
|
31
35
|
// Display a warning toast, with no title
|
data/lib/toastrjs/rails.rb
CHANGED
@@ -0,0 +1,16 @@
|
|
1
|
+
module Toastrjs
|
2
|
+
module Rails
|
3
|
+
module Helper
|
4
|
+
def flash_toastr
|
5
|
+
flash_messages = []
|
6
|
+
flash.each do |type, message|
|
7
|
+
type = 'success' if type == 'notice'
|
8
|
+
type = 'error' if type == 'alert'
|
9
|
+
text = "<script>toastr.#{type}('#{message}','',{ 'closeButton': true });</script>"
|
10
|
+
flash_messages << text.html_safe if message
|
11
|
+
end
|
12
|
+
flash_messages.join("\n").html_safe
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'rails'
|
2
|
+
require 'toastrjs/rails/helper'
|
3
|
+
|
4
|
+
module Toastrjs
|
5
|
+
module Rails
|
6
|
+
class Railtie < ::Rails::Railtie
|
7
|
+
initializer "toastrjs.action_view" do
|
8
|
+
ActiveSupport.on_load(:action_view) do
|
9
|
+
include Toastrjs::Rails::Helper
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
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.
|
4
|
+
version: 2.1.3.1
|
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-
|
11
|
+
date: 2017-04-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -48,6 +48,8 @@ files:
|
|
48
48
|
- LICENSE.txt
|
49
49
|
- README.md
|
50
50
|
- lib/toastrjs/rails.rb
|
51
|
+
- lib/toastrjs/rails/helper.rb
|
52
|
+
- lib/toastrjs/rails/railtie.rb
|
51
53
|
- lib/toastrjs/rails/version.rb
|
52
54
|
- vendor/assets/javascripts/toastr.js.map
|
53
55
|
- vendor/assets/javascripts/toastr.min.js
|