Project

General

Profile

Feature #15914 » RM_15914_projects_hide_subprojects_RM_V2.3.2.diff

Jérôme BATAILLE, 2014-01-20 21:10

View differences:

redmine/trunk/app/helpers/projects_helper.rb (revision 3004)
53 53

  
54 54
  # Renders the projects index
55 55
  def render_project_hierarchy(projects)
56
    render_project_nested_lists(projects) do |project|
57
      s = link_to_project(project, {}, :class => "#{project.css_classes} #{User.current.member_of?(project) ? 'my-project' : nil}")
56
    s_script = (
57
      "<script language=\"javascript\">\n" +
58
      "  function toggleDivGroup(el) {\n" +
59
      "    var div = $(el).parents('div').first();\n" +
60
      "    var n = div.next();\n" +
61
      "    div.toggleClass('closed');\n" +
62
      "    while (n.length && !n.hasClass('group')) {\n" +
63
      "      n.toggle();\n" +
64
      "      n = n.next('div');\n" +
65
      "     }\n" +
66
      "  }\n" +
67
      "</script>\n"
68
    ).html_safe
69

  
70
    s_script << render_project_nested_lists(projects) do |project|
71
      s = ''.html_safe
72
      s << '<span class="expander" onclick="toggleDivGroup(this);">&nbsp;</span>&nbsp;'.html_safe unless project.leaf?
73

  
74
      s << link_to_project(project, {}, :class => "#{project.css_classes} #{User.current.member_of?(project) ? 'my-project' : nil}")
58 75
      if project.description.present?
59 76
        s << content_tag('div', textilizable(project.short_description, :project => project), :class => 'wiki description')
60 77
      end
61 78
      s
62 79
    end
80

  
81
    s_script
63 82
  end
64 83

  
65 84
  # Returns a set of options for a select field, grouped by project.
(2-2/2)