Commit 80cc3864 authored by jplang's avatar jplang

Adds a link to remove a subtask from its parent task (#23392).

Patch by Mizuki ISHIKAWA.

git-svn-id: https://svn.redmine.org/redmine/trunk@17747 e93f8b46-1217-0410-a6f0-8f06a7374b81
parent e2e29cf3
...@@ -177,7 +177,7 @@ class IssuesController < ApplicationController ...@@ -177,7 +177,7 @@ class IssuesController < ApplicationController
if saved if saved
render_attachment_warning_if_needed(@issue) render_attachment_warning_if_needed(@issue)
flash[:notice] = l(:notice_successful_update) unless @issue.current_journal.new_record? flash[:notice] = l(:notice_successful_update) unless @issue.current_journal.new_record? || params[:no_flash]
respond_to do |format| respond_to do |format|
format.html { redirect_back_or_default issue_path(@issue, previous_and_next_issue_ids_params) } format.html { redirect_back_or_default issue_path(@issue, previous_and_next_issue_ids_params) }
......
...@@ -90,17 +90,27 @@ module IssuesHelper ...@@ -90,17 +90,27 @@ module IssuesHelper
end end
def render_descendants_tree(issue) def render_descendants_tree(issue)
manage_relations = User.current.allowed_to?(:manage_subtasks, issue.project)
s = '<table class="list issues odd-even">' s = '<table class="list issues odd-even">'
issue_list(issue.descendants.visible.preload(:status, :priority, :tracker, :assigned_to).sort_by(&:lft)) do |child, level| issue_list(issue.descendants.visible.preload(:status, :priority, :tracker, :assigned_to).sort_by(&:lft)) do |child, level|
css = "issue issue-#{child.id} hascontextmenu #{child.css_classes}" css = "issue issue-#{child.id} hascontextmenu #{child.css_classes}"
css << " idnt idnt-#{level}" if level > 0 css << " idnt idnt-#{level}" if level > 0
buttons = manage_relations ? link_to(l(:label_delete_link_to_subtask),
issue_path({:id => child.id, :issue => {:parent_issue_id => ''}, :back_url => issue_path(issue.id), :no_flash => '1'}),
:method => :put,
:data => {:confirm => l(:text_are_you_sure)},
:title => l(:label_delete_link_to_subtask),
:class => 'icon-only icon-link-break'
) : "".html_safe
buttons << link_to_context_menu
s << content_tag('tr', s << content_tag('tr',
content_tag('td', check_box_tag("ids[]", child.id, false, :id => nil), :class => 'checkbox') + content_tag('td', check_box_tag("ids[]", child.id, false, :id => nil), :class => 'checkbox') +
content_tag('td', link_to_issue(child, :project => (issue.project_id != child.project_id)), :class => 'subject', :style => 'width: 50%') + content_tag('td', link_to_issue(child, :project => (issue.project_id != child.project_id)), :class => 'subject', :style => 'width: 50%') +
content_tag('td', h(child.status), :class => 'status') + content_tag('td', h(child.status), :class => 'status') +
content_tag('td', link_to_user(child.assigned_to), :class => 'assigned_to') + content_tag('td', link_to_user(child.assigned_to), :class => 'assigned_to') +
content_tag('td', child.disabled_core_fields.include?('done_ratio') ? '' : progress_bar(child.done_ratio), :class=> 'done_ratio') + content_tag('td', child.disabled_core_fields.include?('done_ratio') ? '' : progress_bar(child.done_ratio), :class=> 'done_ratio') +
content_tag('td', link_to_context_menu, :class => 'buttons'), content_tag('td', buttons, :class => 'buttons'),
:class => css) :class => css)
end end
s << '</table>' s << '</table>'
......
...@@ -830,6 +830,7 @@ en: ...@@ -830,6 +830,7 @@ en:
label_relation_new: New relation label_relation_new: New relation
label_relation_delete: Delete relation label_relation_delete: Delete relation
label_relates_to: Related to label_relates_to: Related to
label_delete_link_to_subtask: Delete link to subtask
label_duplicates: Is duplicate of label_duplicates: Is duplicate of
label_duplicated_by: Has duplicate label_duplicated_by: Has duplicate
label_blocks: Blocks label_blocks: Blocks
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment