flash-messenger 0.1.4 → 0.1.5

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: bcfd920b84f707bce9d2d51578983cebcf15c210
4
- data.tar.gz: f0b39dd188271b89bade6d08d333b3efce49e5e6
3
+ metadata.gz: b0307c0c664bd5a1edfba35ab4ec713f9fb74ec6
4
+ data.tar.gz: daed41d9787cd6ef1a090998ccfb0b6282908c01
5
5
  SHA512:
6
- metadata.gz: 94bb6c964708591831ec07ecd49f57fb09237136d0b4cd742db199c9fca98c5df2ead173a132d58f9ea9c81c1ec83c42f03ba4bc8e6f396e7945349175197876
7
- data.tar.gz: 49f4ed67bbbc73fe46bbae8d9eb3a2aef66c68b565dfc6d9b10d94ce52fd26579480300573b6489222c1a570175b770d56f56118aa981912ae93f0a8f3886b5e
6
+ metadata.gz: 42b340da102be9cfeef40ff839727fa45b253089e937483ec7bea21226ceca5a0779c4964258c2de3550b255b934b789f6add7fb0da4e834ce94dffa0e69e9f7
7
+ data.tar.gz: 7d6524d2ecb52409d15f8eabedc5096481ad18eb5156fdcd69212f666a7ca0b7f0ecf720c1fb1c5eb4d1e45c4497da4f818c5e5825f83f8b86315dfb0b96dbaf
@@ -1,3 +1,7 @@
1
+ # v0.1.5 / 2016-05-07
2
+
3
+ Specified show_flash types.
4
+
1
5
  # v0.1.4 / 2016-05-07
2
6
 
3
7
  Enabled I18n to flash_model_error
data/README.md CHANGED
@@ -49,6 +49,10 @@ redirect_to root_path, :flash => {:error => 'Error!'}
49
49
  flash[:error] = 'Error!'
50
50
  redirect_to root_path
51
51
  ```
52
+ In default it only shows `:success, :notice, :alert, :error` in flash. You can specify by this:
53
+ ```
54
+ <%=show_flash :warning &>
55
+ ```
52
56
 
53
57
  ### Helpers
54
58
  In controller, you can use helper methods to output flash messages:
@@ -3,4 +3,5 @@ require "flash-messenger/view_helper"
3
3
  require "flash-messenger/engine"
4
4
 
5
5
  module FlashMessenger
6
+ DefaultTypes = [:success, :notice, :alert, :error]
6
7
  end
@@ -1,3 +1,3 @@
1
1
  module FlashMessenger
2
- VERSION = "0.1.4"
2
+ VERSION = "0.1.5"
3
3
  end
@@ -4,9 +4,10 @@ module FlashMessenger
4
4
  module ViewHelper
5
5
  include FlashMessenger::Helper
6
6
 
7
- def show_flash
8
- flash.map do |type, message|
9
- push_flash(message, :type => type)
7
+ def show_flash(*types)
8
+ types = FlashMessenger::DefaultTypes if types.empty?
9
+ types.each do |type|
10
+ push_flash(flash[type], :type => type) unless flash[type].nil?
10
11
  end
11
12
  javascript_tag "flash.show(#{flash_messenger.to_json});" unless flash_messenger.empty?
12
13
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flash-messenger
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chen, Yi-Cyuan