# HG changeset patch # User luisf # Date 1321897225 0 # Node ID 95b78e19e586ab2365bf025dd8c3cf4dd99e4134 # Parent 9f2bc483b7ecd2aef4c849c2eea5482b1f1b11ce Addresses (closes?) Feature #336 diff -r 9f2bc483b7ec -r 95b78e19e586 vendor/plugins/redmine_tags/app/views/projects/_my_projects.rhtml --- a/vendor/plugins/redmine_tags/app/views/projects/_my_projects.rhtml Mon Nov 21 17:17:25 2011 +0000 +++ b/vendor/plugins/redmine_tags/app/views/projects/_my_projects.rhtml Mon Nov 21 17:40:25 2011 +0000 @@ -8,7 +8,7 @@ <% end%> <% if @user_projects %>
- <%= render_my_project_hierarchy(@user_projects)%> + <%= render_my_project_hierarchy_with_tags(@user_projects)%>
<% end %> diff -r 9f2bc483b7ec -r 95b78e19e586 vendor/plugins/redmine_tags/lib/redmine_tags/patches/projects_helper_patch.rb --- a/vendor/plugins/redmine_tags/lib/redmine_tags/patches/projects_helper_patch.rb Mon Nov 21 17:17:25 2011 +0000 +++ b/vendor/plugins/redmine_tags/lib/redmine_tags/patches/projects_helper_patch.rb Mon Nov 21 17:40:25 2011 +0000 @@ -160,6 +160,81 @@ s.join "\n" end + # Renders a tree of projects where the current user belongs + # as a nested set of unordered lists + # The given collection may be a subset of the whole project tree + # (eg. some intermediate nodes are private and can not be seen) + def render_my_project_hierarchy_with_tags(projects) + + s = '' + + original_project = @project + + projects.each do |project| + if project.root? || !projects.include?(project.parent) + s << render_my_project_in_hierarchy_with_tags(project) + end + end + + @project = original_project + + if s != '' + a = '' + a << "\n" + s = a + end + + s + + end + + + + + def render_my_project_in_hierarchy_with_tags(project) + + s = '' + + if User.current.member_of?(project) + + # set the project environment to please macros. + @project = project + + classes = (project.root? ? 'root' : 'child') + + s << "
  • " + + link_to_project(project, {}, :class => "project my-project") + if project.is_public? + s << " " << l("field_is_public") << "" + else + s << " " << l("field_is_private") << "" + end + s << render_project_short_description(project) + + s << l(:tags) << ": " + s << project.tag_counts.collect{ |t| render_project_tag_link(t) }.join(', ') + + s << "
    \n" + + cs = '' + project.children.each do |child| + cs << render_my_project_in_hierarchy(child) + end + + if cs != '' + s << "\n"; + end + + end + + s + + end + + + private # copied from search_helper. This one doesn't escape html or limit the text length