diff options
author | Go MAEDA <maeda@farend.jp> | 2023-04-14 01:05:02 +0000 |
---|---|---|
committer | Go MAEDA <maeda@farend.jp> | 2023-04-14 01:05:02 +0000 |
commit | 55408c480b64f1af10aaf6e264b214d9d757cb84 (patch) | |
tree | d8fcfb9729fe83f5ce5bfcda6cf35b12288135b2 /app | |
parent | 73bc735accb059bf1239ba08fa43920ca2a13341 (diff) | |
download | redmine-55408c480b64f1af10aaf6e264b214d9d757cb84.tar.gz redmine-55408c480b64f1af10aaf6e264b214d9d757cb84.zip |
Ability to disable the priority field (#38416).
Patch by Go MAEDA.
git-svn-id: https://svn.redmine.org/redmine/trunk@22185 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app')
-rw-r--r-- | app/models/issue.rb | 1 | ||||
-rw-r--r-- | app/models/tracker.rb | 4 | ||||
-rw-r--r-- | app/views/issues/show.html.erb | 4 |
3 files changed, 6 insertions, 3 deletions
diff --git a/app/models/issue.rb b/app/models/issue.rb index f267f3f48..d6d6c7c8b 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -2050,6 +2050,7 @@ class Issue < ActiveRecord::Base tracker.disabled_core_fields.each do |attribute| send "#{attribute}=", nil end + self.priority_id ||= IssuePriority.default&.id || IssuePriority.active.first.id self.done_ratio ||= 0 end end diff --git a/app/models/tracker.rb b/app/models/tracker.rb index da39ae934..ce476092d 100644 --- a/app/models/tracker.rb +++ b/app/models/tracker.rb @@ -20,11 +20,11 @@ class Tracker < ActiveRecord::Base include Redmine::SafeAttributes - CORE_FIELDS_UNDISABLABLE = %w(project_id tracker_id subject priority_id is_private).freeze + CORE_FIELDS_UNDISABLABLE = %w(project_id tracker_id subject is_private).freeze # Fields that can be disabled # Other (future) fields should be appended, not inserted! CORE_FIELDS = - %w(assigned_to_id category_id fixed_version_id parent_issue_id + %w(priority_id assigned_to_id category_id fixed_version_id parent_issue_id start_date due_date estimated_hours done_ratio description).freeze CORE_FIELDS_ALL = (CORE_FIELDS_UNDISABLABLE + CORE_FIELDS).freeze diff --git a/app/views/issues/show.html.erb b/app/views/issues/show.html.erb index c7cd5689c..6f0a0a984 100644 --- a/app/views/issues/show.html.erb +++ b/app/views/issues/show.html.erb @@ -47,8 +47,10 @@ <div class="attributes"> <%= issue_fields_rows do |rows| rows.left l(:field_status), @issue.status.name, :class => 'status' - rows.left l(:field_priority), @issue.priority.name, :class => 'priority' + unless @issue.disabled_core_fields.include?('priority_id') + rows.left l(:field_priority), @issue.priority.name, :class => 'priority' + end unless @issue.disabled_core_fields.include?('assigned_to_id') rows.left l(:field_assigned_to), (@issue.assigned_to ? link_to_principal(@issue.assigned_to) : "-"), :class => 'assigned-to' end |