On Feb 21, 2008, at 10:14 AM, Arlen C. wrote:
Thanks a lot, that was a really quick reply.
fun read.
Cheers,
Arlen.
Or put one of these in your application_helper (not both, or combine
them yourself) (Apologies for the inevitable email wrapping 
module ApplicationHelper
COLORS = Hash.new(‘#ff0000’).merge!({ :notice => ‘#00ff00’,
:warning => ‘#ff9900’,
:error => ‘#ff0000’,
}) unless const_defined? ‘COLORS’
Shows the flash message(s) with a highlight effect
def flash_div(*keys)
keys.collect { |key|
content_tag(:div, flash[key],
:id => “#{key}”,
:class => “flash”) if flash[key]
}.join +
keys.collect { |key|
javascript_tag(visual_effect(:highlight, “#{key}”,
:startcolor => “‘#{COLORS[key]}’”,
:endcolor => “‘#ffffff’”)) if
flash[key]
}.join
end
Shows the flash message(s), but they go away when clicked. An
options hash will be applied to a surrounding div tag.
def flash_div(*keys)
return ‘’ if keys.blank?
options = { :id => ‘flash’ }
options.update(keys.pop) if keys.last.is_a? Hash
content_tag(:div,
keys.collect { |key|
content_tag(:div,
flash[key], :id => “#{key}-
flash”, :class => “#{key} section”,
:onClick => “new Effect.Fade(this);”)
if flash[key]
}.join,
options)
end
end
And then in your views (or layout):
<%= flash_div :notice, :warning, :error -%>
Then toss in some CSS to taste and serve warm.
-Rob
Rob B. http://agileconsultingllc.com
[email protected]