Feature #15914 » RM_15914_projects_hide_subprojects_RM_V2.3.2.diff
| redmine/trunk/app/helpers/projects_helper.rb (revision 3004) | ||
|---|---|---|
|
# Renders the projects index
|
||
|
def render_project_hierarchy(projects)
|
||
|
render_project_nested_lists(projects) do |project|
|
||
|
s = link_to_project(project, {}, :class => "#{project.css_classes} #{User.current.member_of?(project) ? 'my-project' : nil}")
|
||
|
# Smile specific #229028 Projects list : button to hide / show sub-projects
|
||
|
s_script = (
|
||
|
"<script language=\"javascript\">\n" +
|
||
|
" function toggleDivGroup(el) {\n" +
|
||
|
" var div = $(el).parents('div').first();\n" +
|
||
|
" var n = div.next();\n" +
|
||
|
" div.toggleClass('closed');\n" +
|
||
|
" while (n.length && !n.hasClass('group')) {\n" +
|
||
|
" n.toggle();\n" +
|
||
|
" n = n.next('div');\n" +
|
||
|
" }\n" +
|
||
|
" }\n" +
|
||
|
"</script>\n"
|
||
|
).html_safe
|
||
|
# END -- Smile specific #229028 Projects list : button to hide / show sub-projects
|
||
|
s_script << render_project_nested_lists(projects) do |project|
|
||
|
# Smile specific #229028 Projects list : button to hide / show sub-projects
|
||
|
s = ''.html_safe
|
||
|
s << '<span class="expander" onclick="toggleDivGroup(this);"> </span> '.html_safe unless project.leaf?
|
||
|
# END -- Smile specific #229028 Projects list : button to hide / show sub-projects
|
||
|
s << link_to_project(project, {}, :class => "#{project.css_classes} #{User.current.member_of?(project) ? 'my-project' : nil}")
|
||
|
if project.description.present?
|
||
|
s << content_tag('div', textilizable(project.short_description, :project => project), :class => 'wiki description')
|
||
|
end
|
||
|
s
|
||
|
end
|
||
|
# Smile specific #229028 Projects list : button to hide / show sub-projects
|
||
|
s_script
|
||
|
end
|
||
|
# Returns a set of options for a select field, grouped by project.
|
||