flash-messenger 0.1.4 → 0.1.5
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/CHANGELOG.md +4 -0
- data/README.md +4 -0
- data/lib/flash-messenger.rb +1 -0
- data/lib/flash-messenger/version.rb +1 -1
- data/lib/flash-messenger/view_helper.rb +4 -3
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b0307c0c664bd5a1edfba35ab4ec713f9fb74ec6
|
4
|
+
data.tar.gz: daed41d9787cd6ef1a090998ccfb0b6282908c01
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 42b340da102be9cfeef40ff839727fa45b253089e937483ec7bea21226ceca5a0779c4964258c2de3550b255b934b789f6add7fb0da4e834ce94dffa0e69e9f7
|
7
|
+
data.tar.gz: 7d6524d2ecb52409d15f8eabedc5096481ad18eb5156fdcd69212f666a7ca0b7f0ecf720c1fb1c5eb4d1e45c4497da4f818c5e5825f83f8b86315dfb0b96dbaf
|
data/CHANGELOG.md
CHANGED
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:
|
data/lib/flash-messenger.rb
CHANGED
@@ -4,9 +4,10 @@ module FlashMessenger
|
|
4
4
|
module ViewHelper
|
5
5
|
include FlashMessenger::Helper
|
6
6
|
|
7
|
-
def show_flash
|
8
|
-
|
9
|
-
|
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
|