Project

General

Profile

Feature #23392 » feature-23392.patch

Mizuki ISHIKAWA, 2018-09-28 08:52

View differences:

app/controllers/issues_controller.rb
176 176

  
177 177
    if saved
178 178
      render_attachment_warning_if_needed(@issue)
179
      flash[:notice] = l(:notice_successful_update) unless @issue.current_journal.new_record?
179
      flash[:notice] = l(:notice_successful_update) unless @issue.current_journal.new_record? || params[:no_flash]
180 180

  
181 181
      respond_to do |format|
182 182
        format.html { redirect_back_or_default issue_path(@issue, previous_and_next_issue_ids_params) }
app/helpers/issues_helper.rb
90 90
  end
91 91

  
92 92
  def render_descendants_tree(issue)
93
    manage_relations = User.current.allowed_to?(:manage_subtasks, issue.project)
93 94
    s = '<table class="list issues odd-even">'
94 95
    issue_list(issue.descendants.visible.preload(:status, :priority, :tracker, :assigned_to).sort_by(&:lft)) do |child, level|
95 96
      css = "issue issue-#{child.id} hascontextmenu #{child.css_classes}"
96 97
      css << " idnt idnt-#{level}" if level > 0
98
      buttons = manage_relations ? link_to(l(:label_delete_link_to_subtask),
99
                                  issue_path({:id => child.id, :issue => {:parent_issue_id => ''}, :back_url => issue_path(issue.id), :no_flash => '1'}),
100
                                  :method => :put,
101
                                  :data => {:confirm => l(:text_are_you_sure)},
102
                                  :title => l(:label_delete_link_to_subtask),
103
                                  :class => 'icon-only icon-link-break'
104
                                  ) : "".html_safe
105
      buttons << link_to_context_menu
106

  
97 107
      s << content_tag('tr',
98 108
             content_tag('td', check_box_tag("ids[]", child.id, false, :id => nil), :class => 'checkbox') +
99 109
             content_tag('td', link_to_issue(child, :project => (issue.project_id != child.project_id)), :class => 'subject', :style => 'width: 50%') +
100 110
             content_tag('td', h(child.status), :class => 'status') +
101 111
             content_tag('td', link_to_user(child.assigned_to), :class => 'assigned_to') +
102 112
             content_tag('td', child.disabled_core_fields.include?('done_ratio') ? '' : progress_bar(child.done_ratio), :class=> 'done_ratio') +
103
             content_tag('td', link_to_context_menu, :class => 'buttons'),
113
             content_tag('td', buttons, :class => 'buttons'),
104 114
             :class => css)
105 115
    end
106 116
    s << '</table>'
config/locales/en.yml
827 827
  label_relation_new: New relation
828 828
  label_relation_delete: Delete relation
829 829
  label_relates_to: Related to
830
  label_delete_link_to_subtask: Delete link to subtask
830 831
  label_duplicates: Is duplicate of
831 832
  label_duplicated_by: Has duplicate
832 833
  label_blocks: Blocks
test/functional/issues_controller_test.rb
1804 1804

  
1805 1805
    assert_select 'div#issue_tree' do
1806 1806
      assert_select 'td.subject', :text => /Child Issue/
1807
      assert_select 'td.buttons' do
1808
        assert_select 'a', :text => l(:label_delete_link_to_subtask)
1809
        assert_select 'a.js-contextmenu'
1810
      end
1807 1811
    end
1808 1812
  end
1809 1813

  
(1-1/2)