From 565aeabc79ccc5d13c66c30a504d5f5f4277e8d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=A4fer?= Date: Sat, 17 Mar 2012 15:23:14 +0100 Subject: [PATCH] Issue hierarchy on issue show view #906 --- app/helpers/issues_helper.rb | 16 ++++++++++++++++ app/views/issues/_tree_simple.html.erb | 11 +++++++++++ app/views/issues/show.rhtml | 12 +----------- config/locales/de.yml | 2 ++ config/locales/en.yml | 2 ++ public/stylesheets/application.css | 2 ++ 6 files changed, 34 insertions(+), 11 deletions(-) create mode 100644 app/views/issues/_tree_simple.html.erb diff --git a/app/helpers/issues_helper.rb b/app/helpers/issues_helper.rb index d8d6cd00..a26cb615 100644 --- a/app/helpers/issues_helper.rb +++ b/app/helpers/issues_helper.rb @@ -79,6 +79,22 @@ module IssuesHelper s end + def render_parents_and_subtree(issue) + return if issue.leaf? && !issue.parent + s = '
' + 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 << '
' + s + end + def render_custom_fields_rows(issue) return if issue.custom_field_values.empty? ordered_values = [] diff --git a/app/views/issues/_tree_simple.html.erb b/app/views/issues/_tree_simple.html.erb new file mode 100644 index 00000000..9ad973c7 --- /dev/null +++ b/app/views/issues/_tree_simple.html.erb @@ -0,0 +1,11 @@ +<% if !@issue.leaf? || @issue.parent || User.current.allowed_to?(:manage_subtasks, @project) %> +
+

+ <%= l(:label_issue_hierarchy) %> + <% 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 %> +

+<% end %> + +<%= render_parents_and_subtree @issue %> diff --git a/app/views/issues/show.rhtml b/app/views/issues/show.rhtml index 8c4ad67b..a358201f 100644 --- a/app/views/issues/show.rhtml +++ b/app/views/issues/show.rhtml @@ -74,17 +74,7 @@ <%= call_hook(:view_issues_show_description_bottom, :issue => @issue) %> -<% if !@issue.leaf? || User.current.allowed_to?(:manage_subtasks, @project) %> -
-
-

- <%=l(:label_subtask_plural)%> - (<%= 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) %>) -

- -<%= render_descendants_tree(@issue) unless @issue.leaf? %> -
-<% end %> +<%= render :partial => 'tree_simple' %> <% if authorize_for('issue_relations', 'new') || @issue.relations.present? %>
diff --git a/config/locales/de.yml b/config/locales/de.yml index 3654836a..0448b4fd 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -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:" diff --git a/config/locales/en.yml b/config/locales/en.yml index a879da48..fb48c1db 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -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:" diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css index c5b1d35c..2c1be07a 100644 --- a/public/stylesheets/application.css +++ b/public/stylesheets/application.css @@ -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;