Rails: how can I display flash [: notification]

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

If this is not clear, I’m talking about how site updates appear at the top of the browser window and fold there until the user presses the X button, although I will not mind if the messages disappear when the user refreshes the page.

I know that this is not technically “modal”.

Does anyone have any experience with this on rails?

+3
source share
1 answer

use it in your view

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

_my_custom_flash.html.erb

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

CSS, # flash-notice , , top: 0 width: 100%, .

, .

+3

Source: https://habr.com/ru/post/1748624/


All Articles