Task hierarchy displayed in roadmap
Added by Peter Harding over 11 years ago
A few years ago I made a small change to my Redmine release which I found really valuable. I just had to reproduce it because it got lost during an upgrade, so I thought I would share it here in case anyone else liked it.
This display the hierarchy of tasks in the Roadmap. As a side effect, it also displays some other details of the sub-tasks.
Note that it only shows each task once under each version in the roadmap. The same task may therefore be shown multiple times in different versions.
The changes were very simple. I'm not a Ruby programmer so someone else might be able to clean this up significantly. Eg prepend current issue onto list of descendants.
Firstly, I coped and modified some functions from app/helpers/issues_helper.rb into app/helpers/versions_helper.rb. The new functions are:
def issue_ancestor_member_of_version(issue, version) myresult = false issue.ancestors.each_with_index do |ancestor,idx| if (ancestor.fixed_version == version) return true else if(issue_ancestor_member_of_version(ancestor,version)) myresult = true end end end myresult end def render_descendants_tree(issue) #s = '<form><table class="list related-issues">' s = '' s << content_tag('tr', content_tag('td', check_box_tag("ids[]", issue.id, false, :id => nil), :class => 'checkbox') + content_tag('td', link_to_issue(issue, :truncate => 60), :class => 'subject') + content_tag('td', h(issue.status)) + content_tag('td', link_to_user(issue.assigned_to)) + content_tag('td', progress_bar(issue.done_ratio, :width => '80px')), :class => "issue issue-#{issue.id}") issue_list(issue.descendants.visible.sort_by(&:lft)) do |child, level| s << content_tag('tr', content_tag('td', check_box_tag("ids[]", child.id, false, :id => nil), :class => 'checkbox') + content_tag('td', link_to_issue(child, :truncate => 60), :class => 'subject') + content_tag('td', h(child.status)) + content_tag('td', link_to_user(child.assigned_to)) + content_tag('td', progress_bar(child.done_ratio, :width => '80px')), :class => "issue issue-#{child.id} hascontextmenu idnt idnt-#{level+1}") end #s << '</form></table>' s.html_safe end
Secondly, I modified the roadmap view (app/views/issues/show.html.erb:) to use these new functions. This is a partial extract:
<% if @issues.present? %>
<% form_tag({}) do -%>
<table class="list related-issues">
<caption><%= l(:label_related_issues) %></caption>
<%- @issues.each do |issue| -%>
<tr class="hascontextmenu">
<td class="checkbox"><%= check_box_tag 'ids[]', issue.id %></td>
<td><%= link_to_issue(issue, :project => (@project != issue.project)) %></td>
</tr>
<% end %>
</table>
<% end %>
<%= context_menu issues_context_menu_path %>
<% end %>
</div>
</code
Replies (1)
RE: Task hierarchy displayed in roadmap - Added by Denis Ned almost 11 years ago
Hi!
I didn unstarstand the last part with file - app/views/issues/show.html.erb ! Maybe its another file - app/views/versions/show.html.erb ?
Please be more specific - what is "partial extract" - what I have to do with this function?
Thank you!