Issue hierarchy on issue show view #906

This commit is contained in:
Felix Schäfer 2012-03-17 15:23:14 +01:00
parent 68efc3de32
commit 565aeabc79
6 changed files with 34 additions and 11 deletions

View File

@ -79,6 +79,22 @@ module IssuesHelper
s
end
def render_parents_and_subtree(issue)
return if issue.leaf? && !issue.parent
s = '<form><table id="issue_tree" class="list">'
issue_list(issue.self_and_ancestors.sort_by(&:lft) + issue.descendants.sort_by(&:lft)) do |el, level|
s << content_tag('tr',
content_tag('td', check_box_tag("ids[]", el.id, false, :id => nil), :class => 'checkbox') +
content_tag('td', link_to_issue(el, :truncate => 60), :class => 'subject') +
content_tag('td', h(el.status)) +
content_tag('td', link_to_user(el.assigned_to)) +
content_tag('td', progress_bar(el.done_ratio, :width => '80px')),
:class => "issue issue-#{el.id} #{"self" if el == issue} hascontextmenu #{level > 0 ? "idnt idnt-#{level}" : nil}")
end
s << '</form></table>'
s
end
def render_custom_fields_rows(issue)
return if issue.custom_field_values.empty?
ordered_values = []

View File

@ -0,0 +1,11 @@
<% if !@issue.leaf? || @issue.parent || User.current.allowed_to?(:manage_subtasks, @project) %>
<hr />
<p>
<strong><%= l(:label_issue_hierarchy) %></strong>
<% if User.current.allowed_to?(:manage_subtasks, @project) %>
(<%= link_to(l(:label_subtask_add), {:controller => 'issues', :action => 'new', :project_id => @project, :issue => {:parent_issue_id => @issue}}) %>)
<% end %>
</p>
<% end %>
<%= render_parents_and_subtree @issue %>

View File

@ -74,17 +74,7 @@
<%= call_hook(:view_issues_show_description_bottom, :issue => @issue) %>
<% if !@issue.leaf? || User.current.allowed_to?(:manage_subtasks, @project) %>
<hr />
<div id="issue_tree">
<p>
<strong><%=l(:label_subtask_plural)%></strong>
(<%= link_to(l(:button_add), {:controller => 'issues', :action => 'new', :project_id => @project, :issue => {:parent_issue_id => @issue}}) if User.current.allowed_to?(:manage_subtasks, @project) %>)
</p>
<%= render_descendants_tree(@issue) unless @issue.leaf? %>
</div>
<% end %>
<%= render :partial => 'tree_simple' %>
<% if authorize_for('issue_relations', 'new') || @issue.relations.present? %>
<hr />

View File

@ -796,6 +796,8 @@ de:
label_api_access_key_created_on: Der API-Zugriffsschlüssel wurde vor %{value} erstellt
label_profile: Profil
label_subtask_plural: Unteraufgaben
label_subtask_add: Unteraufgabe hinzufügen
label_issue_hierarchy: Tickethierarchie
label_project_copy_notifications: Sende Mailbenachrichtigungen beim Kopieren des Projekts.
label_principal_search: "Nach Benutzer oder Gruppe suchen:"
label_user_search: "Nach Benutzer suchen:"

View File

@ -808,6 +808,8 @@ en:
label_api_access_key_created_on: "API access key created %{value} ago"
label_profile: Profile
label_subtask_plural: Subtasks
label_subtask_add: Add a subtask
label_issue_hierarchy: Issue hierarchy
label_project_copy_notifications: Send email notifications during the project copy
label_principal_search: "Search for user or group:"
label_user_search: "Search for user:"

View File

@ -264,8 +264,10 @@ div.issue div.subject p {margin: 0; margin-bottom: 0.1em; font-size: 90%; color:
div.issue div.subject>div>p { margin-top: 0.5em; }
div.issue div.subject h3 {margin: 0; margin-bottom: 0.1em;}
#issue_tree {border: none;}
#issue_tree table.issues { border: 0; }
#issue_tree td.checkbox {display:none;}
#issue_tree tr.self a.issue {color: inherit;}
#content fieldset#filters {
padding-bottom:10px;