diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2016-07-02 09:44:53 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2016-07-02 09:44:53 +0000 |
commit | 0b16423104f761beef651904855b8a37d0f2cd26 (patch) | |
tree | d50d1e6567415ea3d1d71bad8aadf8c3be30e9a9 /app/models/version.rb | |
parent | d9a0084b764026af4c07de469810bbbedad08456 (diff) | |
download | redmine-0b16423104f761beef651904855b8a37d0f2cd26.tar.gz redmine-0b16423104f761beef651904855b8a37d0f2cd26.zip |
Group versions by status in issue filters (#10412).
git-svn-id: http://svn.redmine.org/redmine/trunk@15601 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/version.rb')
-rw-r--r-- | app/models/version.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/app/models/version.rb b/app/models/version.rb index bc71b72e9..86c4cb018 100644 --- a/app/models/version.rb +++ b/app/models/version.rb @@ -197,6 +197,17 @@ class Version < ActiveRecord::Base end end + # Sort versions by status (open, locked then closed versions) + def self.sort_by_status(versions) + versions.sort do |a, b| + if a.status == b.status + a <=> b + else + b.status <=> a.status + end + end + end + def css_classes [ completed? ? 'version-completed' : 'version-incompleted', |