chris@22: # redMine - project management software chris@22: # Copyright (C) 2006 Jean-Philippe Lang chris@22: # chris@22: # This program is free software; you can redistribute it and/or chris@22: # modify it under the terms of the GNU General Public License chris@22: # as published by the Free Software Foundation; either version 2 chris@22: # of the License, or (at your option) any later version. chris@22: # chris@22: # This program is distributed in the hope that it will be useful, chris@22: # but WITHOUT ANY WARRANTY; without even the implied warranty of chris@22: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the chris@22: # GNU General Public License for more details. chris@22: # chris@22: # You should have received a copy of the GNU General Public License chris@22: # along with this program; if not, write to the Free Software chris@22: # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. chris@22: chris@22: module GanttHelper chris@37: chris@37: def gantt_zoom_link(gantt, in_or_out) chris@37: case in_or_out chris@37: when :in chris@37: if gantt.zoom < 4 chris@37: link_to_remote(l(:text_zoom_in), chris@37: {:url => gantt.params.merge(:zoom => (gantt.zoom+1)), :method => :get, :update => 'content'}, chris@37: {:href => url_for(gantt.params.merge(:zoom => (gantt.zoom+1))), chris@37: :class => 'icon icon-zoom-in'}) chris@37: else chris@37: content_tag('span', l(:text_zoom_in), :class => 'icon icon-zoom-in') chris@37: end chris@37: chris@37: when :out chris@37: if gantt.zoom > 1 chris@37: link_to_remote(l(:text_zoom_out), chris@37: {:url => gantt.params.merge(:zoom => (gantt.zoom-1)), :method => :get, :update => 'content'}, chris@37: {:href => url_for(gantt.params.merge(:zoom => (gantt.zoom-1))), chris@37: :class => 'icon icon-zoom-out'}) chris@37: else chris@37: content_tag('span', l(:text_zoom_out), :class => 'icon icon-zoom-out') chris@37: end chris@37: end chris@37: end chris@37: chris@22: def number_of_issues_on_versions(gantt) chris@22: versions = gantt.events.collect {|event| (event.is_a? Version) ? event : nil}.compact chris@22: chris@22: versions.sum {|v| v.fixed_issues.for_gantt.with_query(@query).count} chris@22: end chris@22: end