Hi Nathan,

For some reason, I thought that the pipes only worked with strings.
Anyway, I can see your point about using helpers, though I never
thought of using them quite that extensively. I'll give it a try.
Thanks!

--Alison

On May 14, 4:16 am, Nathan Weizenbaum <[EMAIL PROTECTED]> wrote:
> There is a way to do this, but it's nasty. It's nasty on purpose: Haml
> thinks you shouldn't have multiline Ruby calls in your templates. It
> tries to discourage you from doing it. What it's trying to say is, that
> sort of thing works a lot better in a helper. I mean, compare your code
> to this:
>
> = delete_item(item)
>
> Or, heck, with a little abstraction and introspection, it could become
> general-purpose:
>
> = delete_link(item)
>
> But if you really, /really/ want to put it all in the template, you've
> got to put a pipe at the end of each line. Like so:
>
> = link_to(icon_tag('delete'), item_path(item),              |
>   :confirm => 'Are you sure you want to delete this item?', |
>   :method => :delete,                                       |
>   :class => 'icon')                                         |
>
> You don't actually have to line them up, but it looks nicer that way.
>
> - Nathan
>
> Alison Rowland wrote:
> > I'm loving Haml, but missing the ability to use the formatting style
> > which I often use for hashes or arrays in Ruby or ERb. For instance, I
> > have a line which wraps on my screen, and I would like it not to do
> > so:
>
> > = link_to(icon_tag('delete'), favorite_path(favorite), :confirm =>
> > 'Are you sure you want to delete this favorite?', :method
> > => :delete, :class => 'icon')
>
> > It would be marvellous if I could format it as such:
>
> > = link_to(icon_tag('delete'), item_path(item),
> >   :confirm => 'Are you sure you want to delete this item?',
> >   :method => :delete,
> >   :class => 'icon')
>
> > If it were necessary to include the curly braces around the hash items
> > to signal Haml to keep looking for more code on the next line, that
> > would be no inconvenience. But alas, after searching the docs, I
> > haven't found that there is any way to do this in Haml. Thanks in
> > advance for your response!
>
> > --Alison


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Haml" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/haml?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to