Project

General

Profile

Feature #12521 » 12521.patch

Go MAEDA, 2024-02-01 08:06

View differences:

app/controllers/trackers_controller.rb
89 89
  def destroy
90 90
    @tracker = Tracker.find(params[:id])
91 91
    unless @tracker.issues.empty?
92
      flash[:error] = l(:error_can_not_delete_tracker)
92
      projects = Project.joins(:issues).where(issues: { tracker_id: 1 }).distinct
93
      links = projects.map do |p|
94
        view_context.link_to(p, project_issues_path(p, set_filter: 1, tracker_id: @tracker.id))
95
      end.join(', ')
96
      flash[:error] = l(:error_can_not_delete_tracker_html, projects: links.html_safe)
93 97
    else
94 98
      @tracker.destroy
95 99
    end
config/locales/en.yml
204 204
  error_no_tracker_in_project: 'No tracker is associated to this project. Please check the Project settings.'
205 205
  error_no_default_issue_status: 'No default issue status is defined. Please check your configuration (Go to "Administration -> Issue statuses").'
206 206
  error_can_not_delete_custom_field: Unable to delete custom field
207
  error_can_not_delete_tracker: "This tracker contains issues and cannot be deleted."
207
  error_can_not_delete_tracker_html: "This tracker contains issues and cannot be deleted. <p>The following projects have issues with this tracker:<br>%{projects}</p>"
208 208
  error_can_not_remove_role: "This role is in use and cannot be deleted."
209 209
  error_can_not_reopen_issue_on_closed_version: 'An issue assigned to a closed version cannot be reopened'
210 210
  error_can_not_archive_project: This project cannot be archived
(1-1/5)