toastrjs-rails 2.1.3.0 → 2.1.3.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
  SHA1:
3
- metadata.gz: e8daf84808fb3bccce744c34fd349dd8b5b78fd8
4
- data.tar.gz: 977f69974b2b6972168f7857a6481c1d6c921503
3
+ metadata.gz: d566a31c983d065540548be5e35ca33514628c1e
4
+ data.tar.gz: e94e7ce31a338cc5e9a607a65f9f0d239854883d
5
5
  SHA512:
6
- metadata.gz: 677407f6d2ecfaef2d26b07ffdf02de5bb519d10baceae533a226d8c7f0f1f157617901146d0adf11d47752674b8d851323d4ac9afeba9d8f979e5076fa68ded
7
- data.tar.gz: 298794bce5a37ee559d65dab8d3197fdb6302c2296a43f26d281fe78fbf5724e953f25975cfa2dd27f7db67c6c510260fd3241ed13fc88337ff01fe5f5cc4691
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
@@ -1,4 +1,5 @@
1
1
  require "toastrjs/rails/version"
2
+ require "toastrjs/rails/railtie" if defined?(Rails)
2
3
 
3
4
  module Toastrjs
4
5
  module Rails
@@ -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
@@ -1,5 +1,5 @@
1
1
  module Toastrjs
2
2
  module Rails
3
- VERSION = "2.1.3.0"
3
+ VERSION = "2.1.3.1"
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.0
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-03-22 00:00:00.000000000 Z
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