you are in: codestackercodes [RSS]new flash helper with prototype effects

new flash helper with prototype effects Delicious Email

create an application helper to manage your rails messages
concept by nando vieira [simplesideias.com.br]

show/hide lines
   1    # paste application_helper.rb
   2    def flash_message 
   3      messages = ""
   4      [:notice, :info, :warning, :error].each {|type|
   5        if flash[type]
   6          messages += "<p class=\"#{type}\" id=\"alert\">#{flash[type]}</p>"
   7        end
   8      }    
   9      messages
  10    end
  11  
  12    ####################################
  13  
  14    # your layout 
  15    <%= flash_message %>
  16  	
  17    <% content_tag :script, :type => "text/javascript" do %>
  18      $('alert').style.display = 'none';
  19      new Effect.Appear('alert', {duration: 3});
  20      setTimeout("new Effect.Fade('alert');", 10000);
  21    <% end %>
created by leozera — 05 July 2008 — get a short url — tags: helper rails ruby script.aculo.us embed

Comments



We dont send spam :)

If checked, it's highlights your comment
simple_captcha.jpg
Are you a human? Type the code from the image