mirror of
https://github.com/meineerde/redmine.git
synced 2026-02-06 09:03:25 +00:00
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
This commit is contained in:
parent
73bc735acc
commit
55408c480b
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
@ -209,6 +209,9 @@ class TrackersControllerTest < Redmine::ControllerTest
|
||||
assert_select 'input[name=?][value=category_id]', 'tracker[core_fields][]'
|
||||
assert_select 'input[name=?][value=category_id][checked=checked]', 'tracker[core_fields][]', 0
|
||||
|
||||
assert_select 'input[name=?][value=priority_id]', 'tracker[core_fields][]'
|
||||
assert_select 'input[name=?][value=priority_id][checked=checked]', 'tracker[core_fields][]', 0
|
||||
|
||||
assert_select 'input[name=?][value=""][type=hidden]', 'tracker[core_fields][]'
|
||||
end
|
||||
|
||||
|
||||
@ -83,6 +83,16 @@ class IssueTest < ActiveSupport::TestCase
|
||||
assert_save issue
|
||||
end
|
||||
|
||||
def test_default_priority_should_be_set_when_priority_field_is_disabled
|
||||
tracker = Tracker.find(1)
|
||||
tracker.core_fields = tracker.core_fields - ['priority_id']
|
||||
tracker.save!
|
||||
|
||||
issue = Issue.new(:project_id => 1, :tracker_id => tracker.id, :author_id => 1, :subject => 'priority_id is disabled')
|
||||
issue.save!
|
||||
assert_equal IssuePriority.default, issue.priority
|
||||
end
|
||||
|
||||
def test_start_date_format_should_be_validated
|
||||
set_language_if_valid 'en'
|
||||
['2012', 'ABC', '2012-15-20'].each do |invalid_date|
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user