Return to Snippet

Revision: 29201
at July 23, 2010 11:43 by insanedreamer


Initial Code
def show_flash(options={})
    options = {:fade => 1, :display => 2, :highlight => 3}.merge(options)
    html = content_tag(:div, flash.collect{ |key,msg| content_tag(:div, msg, :class => key, :attributes => "style = display: none;") }, :id => 'flash-message')
    html << content_tag(:script, "new Effect.Highlight('flash-message', {duration: #{options[:highlight]}});") if options[:highlight]
    html << content_tag(:script, "setTimeout(\"$('flash-message').fade({duration: #{options[:fade]}});\", #{options[:display]*1000}); return false;")
  end

Initial URL

                                

Initial Description
put in application_helper

Initial Title
Nice flash messages that fade out.

Initial Tags

                                

Initial Language
Rails