##// END OF EJS Templates
Speeds up rendering of the project list for users who belong to hundreds of projects....
Speeds up rendering of the project list for users who belong to hundreds of projects. git-svn-id: http://svn.redmine.org/redmine/trunk@16123 e93f8b46-1217-0410-a6f0-8f06a7374b81

File last commit:

r14856:cda9c63d9c21
r15741:f8df935dcada
Show More
versions_helper.rb
76 lines | 2.6 KiB | text/x-ruby | RubyLexer
/ app / helpers / versions_helper.rb
Jean-Philippe Lang
Added encoding comment to helpers (#9792)....
r8090 # encoding: utf-8
#
Jean-Philippe Lang
Adds an option to view issues count by status on the version page (#7921)....
r5059 # Redmine - project management software
Jean-Philippe Lang
Updates copyright for 2016....
r14856 # Copyright (C) 2006-2016 Jean-Philippe Lang
Jean-Philippe Lang
added svn:eol-style native property on /app files...
r330 #
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
Toshi MARUYAMA
remove trailing white-spaces from app/helpers/versions_helper.rb....
r6801 #
Jean-Philippe Lang
added svn:eol-style native property on /app files...
r330 # This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
Toshi MARUYAMA
remove trailing white-spaces from app/helpers/versions_helper.rb....
r6801 #
Jean-Philippe Lang
added svn:eol-style native property on /app files...
r330 # You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
Jean-Philippe Lang
Initial commit...
r2 module VersionsHelper
Jean-Philippe Lang
Added version details view accessible from the roadmap....
r942
Jean-Philippe Lang
Fixed that roadmap anchor links can be ambigous (#11540)....
r10017 def version_anchor(version)
if @project == version.project
anchor version.name
else
anchor "#{version.project.try(:identifier)}-#{version.name}"
end
end
Jean-Philippe Lang
Fixed: Issues counters in roadmap only link to issues in the same project (#9660)....
r13035 def version_filtered_issues_path(version, options = {})
options = {:fixed_version_id => version, :set_filter => 1}.merge(options)
project = case version.sharing
when 'hierarchy', 'tree'
if version.project && version.project.root.visible?
version.project.root
else
version.project
end
when 'system'
nil
else
version.project
end
if project
project_issues_path(project, options)
else
issues_path(options)
end
end
Jean-Philippe Lang
Ability to disable standard fields on a per tracker basis (#1091)....
r9729 STATUS_BY_CRITERIAS = %w(tracker status priority author assigned_to category)
Toshi MARUYAMA
remove trailing white-spaces from app/helpers/versions_helper.rb....
r6801
Jean-Philippe Lang
Added version details view accessible from the roadmap....
r942 def render_issue_status_by(version, criteria)
Jean-Philippe Lang
Ability to disable standard fields on a per tracker basis (#1091)....
r9729 criteria = 'tracker' unless STATUS_BY_CRITERIAS.include?(criteria)
Toshi MARUYAMA
remove trailing white-spaces from app/helpers/versions_helper.rb....
r6801
Jean-Philippe Lang
Added version details view accessible from the roadmap....
r942 h = Hash.new {|k,v| k[v] = [0, 0]}
begin
# Total issue count
Jean-Philippe Lang
Use #fixed_issues association (#19455)....
r13881 version.fixed_issues.group(criteria).count.each {|c,s| h[c][0] = s}
Jean-Philippe Lang
Added version details view accessible from the roadmap....
r942 # Open issues count
Jean-Philippe Lang
Use #fixed_issues association (#19455)....
r13881 version.fixed_issues.open.group(criteria).count.each {|c,s| h[c][1] = s}
Jean-Philippe Lang
Added version details view accessible from the roadmap....
r942 rescue ActiveRecord::RecordNotFound
# When grouping by an association, Rails throws this exception if there's no result (bug)
end
Jean-Philippe Lang
Issues by Category should show tasks without category (#8106)....
r10549 # 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])}}
Jean-Philippe Lang
Added version details view accessible from the roadmap....
r942 max = counts.collect {|c| c[:total]}.max
Toshi MARUYAMA
remove trailing white-spaces from app/helpers/versions_helper.rb....
r6801
Jean-Philippe Lang
Added version details view accessible from the roadmap....
r942 render :partial => 'issue_counts', :locals => {:version => version, :criteria => criteria, :counts => counts, :max => max}
end
Toshi MARUYAMA
remove trailing white-spaces from app/helpers/versions_helper.rb....
r6801
Jean-Philippe Lang
Added version details view accessible from the roadmap....
r942 def status_by_options_for_select(value)
options_for_select(STATUS_BY_CRITERIAS.collect {|criteria| [l("field_#{criteria}".to_sym), criteria]}, value)
end
Jean-Philippe Lang
Initial commit...
r2 end