annotate app/helpers/gantt_helper.rb @ 861:b8105f717bf7 bug_182

Close obsolete branch bug_182
author Chris Cannam
date Fri, 10 Jun 2011 16:49:58 +0100
parents 94944d00e43c
children cbce1fd3b1b7
rev   line source
chris@22 1 # redMine - project management software
chris@22 2 # Copyright (C) 2006 Jean-Philippe Lang
chris@22 3 #
chris@22 4 # This program is free software; you can redistribute it and/or
chris@22 5 # modify it under the terms of the GNU General Public License
chris@22 6 # as published by the Free Software Foundation; either version 2
chris@22 7 # of the License, or (at your option) any later version.
chris@22 8 #
chris@22 9 # This program is distributed in the hope that it will be useful,
chris@22 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
chris@22 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
chris@22 12 # GNU General Public License for more details.
chris@22 13 #
chris@22 14 # You should have received a copy of the GNU General Public License
chris@22 15 # along with this program; if not, write to the Free Software
chris@22 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
chris@22 17
chris@22 18 module GanttHelper
chris@37 19
chris@37 20 def gantt_zoom_link(gantt, in_or_out)
chris@37 21 case in_or_out
chris@37 22 when :in
chris@37 23 if gantt.zoom < 4
chris@37 24 link_to_remote(l(:text_zoom_in),
chris@37 25 {:url => gantt.params.merge(:zoom => (gantt.zoom+1)), :method => :get, :update => 'content'},
chris@37 26 {:href => url_for(gantt.params.merge(:zoom => (gantt.zoom+1))),
chris@37 27 :class => 'icon icon-zoom-in'})
chris@37 28 else
chris@37 29 content_tag('span', l(:text_zoom_in), :class => 'icon icon-zoom-in')
chris@37 30 end
chris@37 31
chris@37 32 when :out
chris@37 33 if gantt.zoom > 1
chris@37 34 link_to_remote(l(:text_zoom_out),
chris@37 35 {:url => gantt.params.merge(:zoom => (gantt.zoom-1)), :method => :get, :update => 'content'},
chris@37 36 {:href => url_for(gantt.params.merge(:zoom => (gantt.zoom-1))),
chris@37 37 :class => 'icon icon-zoom-out'})
chris@37 38 else
chris@37 39 content_tag('span', l(:text_zoom_out), :class => 'icon icon-zoom-out')
chris@37 40 end
chris@37 41 end
chris@37 42 end
chris@37 43
chris@22 44 def number_of_issues_on_versions(gantt)
chris@22 45 versions = gantt.events.collect {|event| (event.is_a? Version) ? event : nil}.compact
chris@22 46
chris@22 47 versions.sum {|v| v.fixed_issues.for_gantt.with_query(@query).count}
chris@22 48 end
chris@22 49 end