Refactor: extract gantt zoom links to a helper.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3756 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
c3c3460e0d
commit
ab4bdc379e
|
@ -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
|
||||
|
|
|
@ -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">
|
||||
|
|
Loading…
Reference in New Issue