gantt_helper.rb 1.52 KB
Newer Older
1 2
# encoding: utf-8
#
3
# Redmine - project management software
jplang's avatar
jplang committed
4
# Copyright (C) 2006-2017  Jean-Philippe Lang
edavis10's avatar
edavis10 committed
5 6 7 8 9
#
# 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.
10
#
edavis10's avatar
edavis10 committed
11 12 13 14
# 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.
15
#
edavis10's avatar
edavis10 committed
16 17 18 19 20
# 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.

module GanttHelper
21 22 23 24 25

  def gantt_zoom_link(gantt, in_or_out)
    case in_or_out
    when :in
      if gantt.zoom < 4
jplang's avatar
jplang committed
26
        link_to l(:text_zoom_in),
jplang's avatar
jplang committed
27
          {:params => request.query_parameters.merge(gantt.params.merge(:zoom => (gantt.zoom + 1)))},
28
          :class => 'icon icon-zoom-in'
29
      else
tmaruyama's avatar
tmaruyama committed
30
        content_tag(:span, l(:text_zoom_in), :class => 'icon icon-zoom-in').html_safe
31
      end
32

33 34
    when :out
      if gantt.zoom > 1
jplang's avatar
jplang committed
35
        link_to l(:text_zoom_out),
jplang's avatar
jplang committed
36
          {:params => request.query_parameters.merge(gantt.params.merge(:zoom => (gantt.zoom - 1)))},
37
          :class => 'icon icon-zoom-out'
38
      else
tmaruyama's avatar
tmaruyama committed
39
        content_tag(:span, l(:text_zoom_out), :class => 'icon icon-zoom-out').html_safe
40 41 42
      end
    end
  end
edavis10's avatar
edavis10 committed
43
end