views:

115

answers:

3

I want to make a notification like this :

alt text

it is only a flash[:notice] with some CSS trick in RoR? or it there any other trick on this?

+2  A: 

It does not really have to do with RoR. If you only want the notice without animation, it's just some CSS. Else it requires Javascript, and is easily done with libraries like jQuery. But even without a library, this would not be very hard.

Ikke
+2  A: 

Yes, in Rails the way to handle this is by using the flash and styling to suit.

John Topley
+4  A: 

You can use this jQuery plugin to simulate the effect. Just wrap the JS in a conditional which checks the flash (or session/db if you want a persistent message)

<% if flash[:notice] or session[:notice] or current_user.notifications %>
  $(function () {
    $.notifyBar({
      html: "<%= flash[:notice] %>",
      delay: 2000,
      animationSpeed: "normal"
    });  
  });
<% end %>

You will have to style it, obviously.

floyd