scintillation 1.0.5 → 1.0.6
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.
- data/VERSION +1 -1
- data/lib/scintillation.rb +8 -8
- data/scintillation.gemspec +1 -1
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.6
|
data/lib/scintillation.rb
CHANGED
@@ -14,6 +14,8 @@ module Scintillation
|
|
14
14
|
include InstanceMethods
|
15
15
|
ActionView::Base.send(:include, Scintillation::View)
|
16
16
|
|
17
|
+
options.reverse_merge!(:scope => :messages)
|
18
|
+
|
17
19
|
# import flash messages
|
18
20
|
before_filter { |c| c.send(:flash).each { |t, m| c.messages.add(m, t) } }
|
19
21
|
|
@@ -27,12 +29,10 @@ module Scintillation
|
|
27
29
|
|
28
30
|
module InstanceMethods
|
29
31
|
def method_missing(method, *args, &block)
|
30
|
-
|
31
|
-
messages.add(args[0], $2, $4)
|
32
|
-
|
33
|
-
|
34
|
-
else
|
35
|
-
super
|
32
|
+
case method.to_s
|
33
|
+
when /^((\w+)_)?msg(_for_(\w+))?$/ then messages.add(args[0], $2, $4)
|
34
|
+
when /^((\w+)_)?msgs$/ then messages.get($2)
|
35
|
+
else super
|
36
36
|
end
|
37
37
|
end
|
38
38
|
end
|
@@ -47,7 +47,7 @@ module Scintillation
|
|
47
47
|
|
48
48
|
module InstanceMethods
|
49
49
|
def method_missing(method, *args, &block)
|
50
|
-
if /^((\w+)_)?msgs
|
50
|
+
if method.to_s =~ /^((\w+)_)?msgs$/
|
51
51
|
messages.get($2)
|
52
52
|
else
|
53
53
|
super
|
@@ -56,7 +56,7 @@ module Scintillation
|
|
56
56
|
|
57
57
|
def display_messages(msgs)
|
58
58
|
unless msgs.empty?
|
59
|
-
"<ul>\n " + msgs.map { |m| "<li class=\"#{m.tone}\">#{m}</li>" }.join("\n ") + "\n</ul>"
|
59
|
+
"<ul>\n " + msgs.map { |m| "<li class=\"#{m.tone}\">#{m}</li>" }.join("\n ") + "\n</ul>".html_safe
|
60
60
|
end
|
61
61
|
end
|
62
62
|
end
|
data/scintillation.gemspec
CHANGED