bootstrap_flash_messages 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# bootstrap_flash_messages
|
2
2
|
|
3
|
-
version 0.0.
|
3
|
+
version 0.0.4
|
4
4
|
Robin Brouwer
|
5
5
|
45north
|
6
6
|
|
@@ -22,6 +22,19 @@ And that's it!
|
|
22
22
|
|
23
23
|
## Changes
|
24
24
|
|
25
|
+
Version 0.0.4 changes (03/09/2012):
|
26
|
+
|
27
|
+
- Namespaced Controllers can be accessed by nesting your locales.
|
28
|
+
|
29
|
+
# Old
|
30
|
+
"admin/products":
|
31
|
+
...
|
32
|
+
|
33
|
+
# New:
|
34
|
+
admin:
|
35
|
+
products:
|
36
|
+
...
|
37
|
+
|
25
38
|
Version 0.0.3 changes (14/08/2012):
|
26
39
|
|
27
40
|
- Added interpolation to the flash messages
|
@@ -4,13 +4,13 @@ module BootstrapFlashMessages
|
|
4
4
|
messages = response_status_and_flash[:flash]
|
5
5
|
if messages && (messages.is_a?(Symbol) || messages.is_a?(Array))
|
6
6
|
flashes = {}
|
7
|
-
|
7
|
+
locals = response_status_and_flash[:locals]
|
8
8
|
if messages.is_a?(Array)
|
9
9
|
messages.each do |key|
|
10
|
-
flashes[key] = flash_messages(
|
10
|
+
flashes[key] = flash_messages(key, locals)
|
11
11
|
end
|
12
12
|
else
|
13
|
-
flashes[messages] = flash_messages(
|
13
|
+
flashes[messages] = flash_messages(messages, locals)
|
14
14
|
end
|
15
15
|
response_status_and_flash.delete(:locals)
|
16
16
|
response_status_and_flash[:flash] = flashes
|
@@ -23,21 +23,22 @@ module BootstrapFlashMessages
|
|
23
23
|
def flash!(*args)
|
24
24
|
options = args.extract_options!
|
25
25
|
args.each do |key|
|
26
|
-
flash[key] = flash_messages(
|
26
|
+
flash[key] = flash_messages(key, options[:locals])
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
30
30
|
def flash_now!(*args)
|
31
31
|
options = args.extract_options!
|
32
32
|
args.each do |key|
|
33
|
-
|
34
|
-
flash.now[key] = flash_messages(params[:controller], params[:action], key, options[:locals])
|
33
|
+
flash.now[key] = flash_messages(key, options[:locals])
|
35
34
|
end
|
36
35
|
end
|
37
36
|
|
38
|
-
def flash_messages(*args)
|
37
|
+
def flash_messages(key, *args)
|
38
|
+
i18n_key = "flash_messages.#{params[:controller]}.#{params[:action]}.#{key}"
|
39
39
|
options = args.extract_options!
|
40
|
-
|
40
|
+
options[:default] = i18n_key.to_sym
|
41
|
+
I18n.t(i18n_key.gsub(/\//, "."), options)
|
41
42
|
end
|
42
43
|
end
|
43
44
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bootstrap_flash_messages
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 4
|
10
|
+
version: 0.0.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Robin Brouwer
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-
|
18
|
+
date: 2012-09-03 00:00:00 +02:00
|
19
19
|
default_executable:
|
20
20
|
dependencies: []
|
21
21
|
|