diff --git a/app/helpers/issues_helper.rb b/app/helpers/issues_helper.rb index 206bafb26ee4f62b3b6909c447aad195f701363a..7023d22dc4e64a1013e74c00ef3f387f17c9ee16 100644 --- a/app/helpers/issues_helper.rb +++ b/app/helpers/issues_helper.rb @@ -233,4 +233,26 @@ module IssuesHelper end export end + + def gantt_zoom_link(gantt, in_or_out) + case in_or_out + when :in + if gantt.zoom < 4 + link_to_remote(image_tag('zoom_in.png'), + {:url => gantt.params.merge(:zoom => (gantt.zoom+1)), :update => 'content'}, + {:href => url_for(gantt.params.merge(:zoom => (gantt.zoom+1)))}) + else + image_tag('zoom_in_g.png') + end + + when :out + if gantt.zoom > 1 + link_to_remote(image_tag('zoom_out.png'), + {:url => gantt.params.merge(:zoom => (gantt.zoom-1)), :update => 'content'}, + {:href => url_for(gantt.params.merge(:zoom => (gantt.zoom-1)))}) + else + image_tag('zoom_out_g.png') + end + end + end end diff --git a/app/views/gantts/show.html.erb b/app/views/gantts/show.html.erb index f0c6f462261c29ae0c6f237a638f4fb22369a6da..653a41d41ba65588acb8fe9e2f8e064659dee53d 100644 --- a/app/views/gantts/show.html.erb +++ b/app/views/gantts/show.html.erb @@ -9,16 +9,8 @@ </fieldset> <p style="float:right;"> -<%= if @gantt.zoom < 4 - link_to_remote image_tag('zoom_in.png'), {:url => @gantt.params.merge(:zoom => (@gantt.zoom+1)), :update => 'content'}, {:href => url_for(@gantt.params.merge(:zoom => (@gantt.zoom+1)))} - else - image_tag 'zoom_in_g.png' - end %> -<%= if @gantt.zoom > 1 - link_to_remote image_tag('zoom_out.png'), {:url => @gantt.params.merge(:zoom => (@gantt.zoom-1)), :update => 'content'}, {:href => url_for(@gantt.params.merge(:zoom => (@gantt.zoom-1)))} - else - image_tag 'zoom_out_g.png' - end %> + <%= gantt_zoom_link(@gantt, :in) %> + <%= gantt_zoom_link(@gantt, :out) %> </p> <p class="buttons">