summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2017-01-14 11:30:00 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2017-01-14 11:30:00 +0000
commit9206d077d4603c6ffc2d01ae152f129c6e88df6d (patch)
treeaeacf29a8da1dafda86516a598f6f82482762206 /lib
parent91f39dea8f6250e01acf5fce3c1540f558044585 (diff)
downloadredmine-9206d077d4603c6ffc2d01ae152f129c6e88df6d.tar.gz
redmine-9206d077d4603c6ffc2d01ae152f129c6e88df6d.zip
Group versions by status in version custom field filter (#23265).
git-svn-id: http://svn.redmine.org/redmine/trunk@16194 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib')
-rw-r--r--lib/redmine/field_format.rb11
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/redmine/field_format.rb b/lib/redmine/field_format.rb
index 01ac75946..fee2c978c 100644
--- a/lib/redmine/field_format.rb
+++ b/lib/redmine/field_format.rb
@@ -826,7 +826,7 @@ module Redmine
field_attributes :version_status
def possible_values_options(custom_field, object=nil)
- versions_options(custom_field, object)
+ possible_values_records(custom_field, object).sort.collect{|v| [v.to_s, v.id.to_s] }
end
def before_custom_field_save(custom_field)
@@ -839,13 +839,14 @@ module Redmine
protected
def query_filter_values(custom_field, query)
- versions_options(custom_field, query.project, true)
+ versions = possible_values_records(custom_field, query.project, true)
+ Version.sort_by_status(versions).collect{|s| ["#{s.project.name} - #{s.name}", s.id.to_s, l("version_status_#{s.status}")] }
end
- def versions_options(custom_field, object, all_statuses=false)
+ def possible_values_records(custom_field, object=nil, all_statuses=false)
if object.is_a?(Array)
projects = object.map {|o| o.respond_to?(:project) ? o.project : nil}.compact.uniq
- projects.map {|project| possible_values_options(custom_field, project)}.reduce(:&) || []
+ projects.map {|project| possible_values_records(custom_field, project)}.reduce(:&) || []
elsif object.respond_to?(:project) && object.project
scope = object.project.shared_versions
filtered_versions_options(custom_field, scope, all_statuses)
@@ -864,7 +865,7 @@ module Redmine
scope = scope.where(:status => statuses.map(&:to_s))
end
end
- scope.sort.collect{|u| [u.to_s, u.id.to_s] }
+ scope
end
end