.message
- if flash[:notice]
%p= flash[:notice]
The hyphen means "run this code, but don't output the
result." If
there's an indented section of code after the hyphen, it
automatically
adds an "end" at the end, so you can do blocks
elegantly. It's also
smart enough not to add an end if you don't need one, so you
can do
stuff like
.message
- if flash[:notice]
%p= flash[:notice]
- elsif flash[:error]
%p.error= flash[:error]
- Nathan
Zeljko wrote:
> Hi,
>
> I just started using haml and quickly ran into problem.
I am trying to
> write equivalent of following in haml:
> <% if flash[:notice] -%>
> <p style="color: green;"><%=
flash[:notice] %></p>
> <% end -%>
>
> I thought that something like
> .message
> = if flash[:notice]
> %p= flash[:notice]
> = end
>
> I tried few variations but nothing helps. From errors I
can conclude
> that it doesn't pick up 'end' . Can you show/explain
what should I do
> here.
>
> Thanks.
>
>
> >
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Haml" group.
To post to this group, send email to haml googlegroups.com
To unsubscribe from this group, send email to
haml-unsubscribe googlegroups.com
For more options, visit this group at http://grou
ps.google.com/group/haml?hl=en
-~----------~----~----~----~------~----~------~--~---
|