Mercurial > hg > soundsoftware-site
diff app/helpers/versions_helper.rb @ 1115:433d4f72a19b redmine-2.2
Update to Redmine SVN revision 11137 on 2.2-stable branch
author | Chris Cannam |
---|---|
date | Mon, 07 Jan 2013 12:01:42 +0000 |
parents | cbb26bc654de |
children | 622f24f53b42 261b3d9a4903 |
line wrap: on
line diff
--- a/app/helpers/versions_helper.rb Wed Jun 27 14:54:18 2012 +0100 +++ b/app/helpers/versions_helper.rb Mon Jan 07 12:01:42 2013 +0000 @@ -1,7 +1,7 @@ # encoding: utf-8 # # Redmine - project management software -# Copyright (C) 2006-2011 Jean-Philippe Lang +# Copyright (C) 2006-2012 Jean-Philippe Lang # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -19,10 +19,18 @@ module VersionsHelper - STATUS_BY_CRITERIAS = %w(category tracker status priority author assigned_to) + def version_anchor(version) + if @project == version.project + anchor version.name + else + anchor "#{version.project.try(:identifier)}-#{version.name}" + end + end + + STATUS_BY_CRITERIAS = %w(tracker status priority author assigned_to category) def render_issue_status_by(version, criteria) - criteria = 'category' unless STATUS_BY_CRITERIAS.include?(criteria) + criteria = 'tracker' unless STATUS_BY_CRITERIAS.include?(criteria) h = Hash.new {|k,v| k[v] = [0, 0]} begin @@ -36,7 +44,8 @@ rescue ActiveRecord::RecordNotFound # When grouping by an association, Rails throws this exception if there's no result (bug) end - counts = h.keys.compact.sort.collect {|k| {:group => k, :total => h[k][0], :open => h[k][1], :closed => (h[k][0] - h[k][1])}} + # Sort with nil keys in last position + counts = h.keys.sort {|a,b| a.nil? ? 1 : (b.nil? ? -1 : a <=> b)}.collect {|k| {:group => k, :total => h[k][0], :open => h[k][1], :closed => (h[k][0] - h[k][1])}} max = counts.collect {|c| c[:total]}.max render :partial => 'issue_counts', :locals => {:version => version, :criteria => criteria, :counts => counts, :max => max}