views:

220

answers:

1

I'm looking for a way to recreate the effect used by stackoverflow to display information about badges awarded etc to users, except I want to use the effect to display my flash messages.

In case it's not clear, I'm talking about the way site updates appear at the top of the browser window and stack there until the user clicks the X button although I won't mind if the messages disappear when the user refreshes the page.

I know this is not technically 'modal'.

Does anyone have any experience of doing this in rails?

+2  A: 

use this in your view

<%= render :partial => 'my_custom_flash', :flash => flash %>

and in _my_custom_flash.html.erb

<div id='flash-notice'><%= flash[:notice] %> <%= link_to_function 'Close', visual_effect(:fade, 'flash-notice' %></div>

and you have to set your CSS to make #flash-notice position absolute, with parameters like top:0 and width:100% to make it appear on the top.

I didn't test this code, but it would be my initial approach to solve this

vrsmn
thanks, your code more or less worked perfectly
stephenmurdoch