rubyonrailsin

A Ruby and Rails talk

Thursday, March 25, 2010


Re: [Rails] flash error & fade away

by rubyonrailsin 0 comments

Tag


Share this post:
Design Float
StumbleUpon
Reddit

Hey,

Not quite understood – could you explain further?

Thanks,
/Lasse

2010/3/24 tom <tomabroad@gmail.com>
this is my current code:

#notice {
border: solid 1px #99cc99;
background-color: #e2f9e3;
color: #006600;
padding: 5px;
margin-bottom: 5px;
}
 
#notice.error {
border-color: #e2f9e3;
background-color: #eeaaaa;
color: #cc0000;
}


<% flash.each do |key, msg| %>
   <%= content_tag :div, flash[:error] || flash[:notice], :id => 'notice', :class => ('error' if flash[:error]) %>
  <% content_tag :script, :type => "text/javascript" do %>
    $('<%= key %>').style.display = 'none';
    new Effect.Appear('<%= key %>', {duration: 3});
  <% end %>

  <% content_tag :script, :type => "text/javascript" do %>
    setTimeout("new Effect.Fade('<%= key %>');", 10000);
  <% end %>
<% end %>

but how can i achieve to css the rails standard way of showing errors liek that one:

1 error prohibited this comment from being saved

There were problems with the following fields:

  • Title can't be blank


only if i return something like that:
  flash[:error] = 'Error'

it actually shows up in "my" div.

hope u guys know what i mean ;-)

thx



--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment

Subscribe feeds via e-mail

Blog Archive