the helper is fully functional as shown. i just want to make my html
source look pretty. the rest of my views are generated by haml and
this helper messes up the nice, clean, easily readable indentation.
the helper outputs nested lists when given an object that uses
acts_as_tree. right now it outputs one long string with no line breaks
or indentation. when i add \n and \t the output is nicer, but not as
nice as what i think haml will provide.
this is how i would like the output to look
<ul>
<li>
stuff from block...
<ul>
<li>
stuff from block...
more unordered lists...
</li>
more list items...
</ul>
</li>
more list items...
</ul>
this is how it currently looks
<ul><li>stuff from block...<ul><li>stuff from block..., more unordered
lists...</li>more list items...</ul></li>more list items...</ul>
On Dec 24, 12:43 am, Nathan Weizenbaum <[email protected]> wrote:
> What output are you looking for and what are you getting?
>
> scott wrote:
> > haml is installed as a plugin and *.haml files render correctly. rails
> > version is 2.2.2
>
> > i have this in my application helper and would like to convert the
> > concat("<ul>") and concat("<li>") to work nicely with haml. i have
> > tried "open", "haml_concat", and "haml_tag". i couldn't get anything
> > to work, they all raised errors probably because i couldn't figure out
> > the correct syntax or something. anyone have any suggestions?
>
> > def display_tree(tree, parent_id=nil, &block)
> > concat("<ul>")
> > tree.each do |node|
> > if node.parent_id == parent_id
> > concat("<li>")
> > yield node
> > display_tree(tree, node.id) { |n| yield n } unless
> > node.children.empty?
> > concat("</li>")
> > end
> > end
> > concat("</ul>")
> > end
>
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---