Project

General

Profile

Feature #34303 » 34303-poc.patch

Go MAEDA, 2020-11-24 15:50

View differences:

app/controllers/context_menus_controller.rb
36 36
      :log_time => (@project && User.current.allowed_to?(:log_time, @project)),
37 37
      :copy => User.current.allowed_to?(:copy_issues, @projects) && Issue.allowed_target_projects.any?,
38 38
      :add_watchers => User.current.allowed_to?(:add_issue_watchers, @projects),
39
      :delete => @issues.all?(&:deletable?)
39
      :delete => @issues.all?(&:deletable?),
40
      :add_subtask => (@project && User.current.allowed_to?(:manage_subtasks, @project))
40 41
    }
41 42

  
42 43
    @assignables = @issues.map(&:assignable_users).reduce(:&)
app/helpers/issues_helper.rb
233 233

  
234 234
  # Returns a link for adding a new subtask to the given issue
235 235
  def link_to_new_subtask(issue)
236
    link_to(l(:button_add), url_for_new_subtask(issue))
237
  end
238

  
239
  def url_for_new_subtask(issue)
236 240
    attrs = {
237 241
      :parent_issue_id => issue
238 242
    }
239 243
    attrs[:tracker_id] = issue.tracker unless issue.tracker.disabled_core_fields.include?('parent_issue_id')
240
    link_to(l(:button_add), new_project_issue_path(issue.project, :issue => attrs, :back_url => issue_path(issue)))
244
    params = {}
245
    params[:issue] = attrs
246
    params[:back_url] = issue_path(issue) if controller_name == 'issues' && action_name == 'show'
247
    new_project_issue_path(issue.project, params)
241 248
  end
242 249

  
243 250
  def trackers_options_for_select(issue)
app/views/context_menus/issues.html.erb
151 151
  <li><%= context_menu_link l(:button_log_time), new_issue_time_entry_path(@issue),
152 152
          :class => 'icon icon-time-add' %></li>
153 153
  <% end %>
154
  <% if @can[:add_subtask] -%>
155
  <li><%= context_menu_link l(:button_add_subtask), url_for_new_subtask(@issue),
156
          :class => 'icon icon-add' %></li>
157
  <% end %>
154 158
  <li><%= context_menu_link l(:button_copy), project_copy_issue_path(@project, @issue),
155 159
          :class => 'icon icon-copy', :disabled => !@can[:copy] %></li>
156 160
<% else %>
config/locales/en.yml
1160 1160
  button_project_bookmark_delete: Remove bookmark
1161 1161
  button_filter: Filter
1162 1162
  button_actions: Actions
1163
  button_add_subtask: Add subtask
1163 1164

  
1164 1165
  status_active: active
1165 1166
  status_registered: registered
(4-4/6)