I need some advice on how to best solve this problem without repeating myself too much and not writing hacked-up HTML in my helper (unless that''s acceptable). Here''s what I''ve got so far: My controller @project = Project.find(params[''id''] My view <%=display_recursive_tasks(@project) %> (my helper) def display_recursive_tasks(project) ret = "<blockquote>" ret += display_tasks_for_project(project) for child in project.children ret += display_recursive_tasks(child) end ret += "</blockquote>" return ret end def display_tasks_for_project(project) ret = "" for task in project.tasks link = link_to task.name, :controller=>''task'', :action=>''show'', :pid=>project.id, :id=>task.id ret += "#{link}<br />" end return ret end What I would like to do is actually display a table of information (the name, esthorus, due_on, priority, status) for each task. I could just render the html code right there, but is there a better way to do that, like with a partial or component? Thanks in advance to anyone who can help. Brian Hogan Web Development Learning & Technology Services Schofield 3-B University of Wisconsin-Eau Claire 715 836 3585 hoganbp-VnAisaAFmHY@public.gmane.org _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
Hi Brian, I was looking for help with recursion, so thanks for putting this out there... my only comment per your message, though, is not to use <blockquote> for indentation. Use it for blockquotes. If you want to show hierarchy using indentation, use nested lists or something and apply margins to them using CSS. If you had nested ULs, for instance, the following: ul ul {margin: 0 0 0 2em} Would put a 2em left margin on each successive level, and since each would already be within one that is indented, the hierarchy should show. :)
Yeah.... I know that the blockquote was a bad thing to do and being a standards-guy, I know it was a cop-out, but I was running into some validation issues with nested lists in my recursive loop and I needed to post the question (which never got answered by the way!) -----Original Message----- From: rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org [mailto:rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On Behalf Of Seth Rasmussen Sent: Friday, October 14, 2005 1:54 PM To: rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org Subject: Re: [Rails] Helpers, recursion Hi Brian, I was looking for help with recursion, so thanks for putting this out there... my only comment per your message, though, is not to use <blockquote> for indentation. Use it for blockquotes. If you want to show hierarchy using indentation, use nested lists or something and apply margins to them using CSS. If you had nested ULs, for instance, the following: ul ul {margin: 0 0 0 2em} Would put a 2em left margin on each successive level, and since each would already be within one that is indented, the hierarchy should show. :) _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails