Project

General

Profile

Feature #15914 » RM_15914_projects_hide_subprojects_RM_V2.3.2.diff

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

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
    # Smile specific #229028 Projects list : button to hide / show sub-projects
57
    s_script = (
58
      "<script language=\"javascript\">\n" +
59
      "  function toggleDivGroup(el) {\n" +
60
      "    var div = $(el).parents('div').first();\n" +
61
      "    var n = div.next();\n" +
62
      "    div.toggleClass('closed');\n" +
63
      "    while (n.length && !n.hasClass('group')) {\n" +
64
      "      n.toggle();\n" +
65
      "      n = n.next('div');\n" +
66
      "     }\n" +
67
      "  }\n" +
68
      "</script>\n"
69
    ).html_safe
70
    # END -- Smile specific #229028 Projects list : button to hide / show sub-projects
71

  
72
    s_script << render_project_nested_lists(projects) do |project|
73
      # Smile specific #229028 Projects list : button to hide / show sub-projects
74
      s = ''.html_safe
75
      s << '<span class="expander" onclick="toggleDivGroup(this);">&nbsp;</span>&nbsp;'.html_safe unless project.leaf?
76
      # END -- Smile specific #229028 Projects list : button to hide / show sub-projects
77

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

  
85
    # Smile specific #229028 Projects list : button to hide / show sub-projects
86
    s_script
63 87
  end
64 88

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