]> source.dussan.org Git - redmine.git/commitdiff
Makes all pagination-like links use #link_to_content_update (#5138).
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 3 Apr 2011 14:01:32 +0000 (14:01 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 3 Apr 2011 14:01:32 +0000 (14:01 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@5301 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/helpers/application_helper.rb
app/helpers/calendars_helper.rb
app/helpers/gantt_helper.rb
app/helpers/sort_helper.rb
app/views/activities/index.html.erb
app/views/gantts/show.html.erb
app/views/search/index.rhtml

index 25c71aefe2093d360a3fb516c07577e932aaa270..dc90578c1cd55364c4a2415527c198a154baa74f 100644 (file)
@@ -338,15 +338,15 @@ module ApplicationHelper
 
     html = ''
     if paginator.current.previous
-      html << link_to_remote_content_update('&#171; ' + l(:label_previous), url_param.merge(page_param => paginator.current.previous)) + ' '
+      html << link_to_content_update('&#171; ' + l(:label_previous), url_param.merge(page_param => paginator.current.previous)) + ' '
     end
 
     html << (pagination_links_each(paginator, options) do |n|
-      link_to_remote_content_update(n.to_s, url_param.merge(page_param => n))
+      link_to_content_update(n.to_s, url_param.merge(page_param => n))
     end || '')
     
     if paginator.current.next
-      html << ' ' + link_to_remote_content_update((l(:label_next) + ' &#187;'), url_param.merge(page_param => paginator.current.next))
+      html << ' ' + link_to_content_update((l(:label_next) + ' &#187;'), url_param.merge(page_param => paginator.current.next))
     end
 
     unless count.nil?
@@ -361,10 +361,7 @@ module ApplicationHelper
   
   def per_page_links(selected=nil)
     links = Setting.per_page_options_array.collect do |n|
-      n == selected ? n : link_to_remote(n, {:update => "content",
-                                             :url => params.merge(:per_page => n),
-                                             :method => :get},
-                                            {:href => url_for(params.merge(:per_page => n))})
+      n == selected ? n : link_to_content_update(n, params.merge(:per_page => n))
     end
     links.size > 1 ? l(:label_display_per_page, links.join(', ')) : nil
   end
@@ -934,11 +931,10 @@ module ApplicationHelper
     return self
   end
   
-  def link_to_remote_content_update(text, url_params)
+  def link_to_content_update(text, url_params = {}, html_options = {})
     link_to_remote(text,
       {:url => url_params, :method => :get, :update => 'content', :complete => 'window.scrollTo(0,0)'},
-      {:href => url_for(:params => url_params)}
+      {:href => url_for(:params => url_params)}.merge(html_options)
     )
   end
-  
 end
index d898df3e901e207ccd422749ae53e595d0d49939..82f3905e7cf2492e2d31761ef77c88d59b16000f 100644 (file)
@@ -32,12 +32,6 @@ module CalendarsHelper
   end
 
   def link_to_month(link_name, year, month, options={})
-    link_target = url_for(params.merge(:year => year, :month => month))
-
-    link_to_remote(link_name,
-                   {:update => "content", :url => link_target, :method => :get},
-                   {:href => link_target})
-
+    link_to_content_update(link_name, params.merge(:year => year, :month => month))
   end
-  
 end
index 03a48c4f3c4527e8a4c82cc4a1504f074030c10d..699852ffce2f1ad46e0d9c8dabaeb50139573bf1 100644 (file)
@@ -21,20 +21,18 @@ module GanttHelper
     case in_or_out
     when :in
       if gantt.zoom < 4
-        link_to_remote(l(:text_zoom_in),
-                       {:url => params.merge(gantt.params.merge(:zoom => (gantt.zoom+1))), :method => :get, :update => 'content'},
-                       {:href => url_for(params.merge(gantt.params.merge(:zoom => (gantt.zoom+1)))),
-                        :class => 'icon icon-zoom-in'})
+        link_to_content_update l(:text_zoom_in),
+          params.merge(gantt.params.merge(:zoom => (gantt.zoom+1))),
+          :class => 'icon icon-zoom-in'
       else
         content_tag('span', l(:text_zoom_in), :class => 'icon icon-zoom-in')
       end
       
     when :out
       if gantt.zoom > 1
-        link_to_remote(l(:text_zoom_out),
-                       {:url => params.merge(gantt.params.merge(:zoom => (gantt.zoom-1))), :method => :get, :update => 'content'},
-                       {:href => url_for(params.merge(gantt.params.merge(:zoom => (gantt.zoom-1)))),
-                        :class => 'icon icon-zoom-out'})
+        link_to_content_update l(:text_zoom_out),
+          params.merge(gantt.params.merge(:zoom => (gantt.zoom-1))),
+          :class => 'icon icon-zoom-out'
       else
         content_tag('span', l(:text_zoom_out), :class => 'icon icon-zoom-out')
       end
index c1a89db5ab29c4ace5a738dccda771b018bb6093..2dc245348b37e7bbcdee4e317b1d7e3bbb36b1d5 100644 (file)
@@ -206,10 +206,7 @@ module SortHelper
      # Add project_id to url_options
     url_options = url_options.merge(:project_id => params[:project_id]) if params.has_key?(:project_id)
 
-    link_to_remote(caption,
-                  {:update => "content", :url => url_options, :method => :get},
-                  {:href => url_for(url_options),
-                   :class => css})
+    link_to_content_update(caption, url_options, :class => css)
   end
 
   # Returns a table header <th> tag with a sort link for the named column
index 03cc8c6817d2b08c004fbcbb9b0ea1be781d947a..a2748cc9c9d7b45a0c1e3ea674dec575bcbdfa85 100644 (file)
 <%= content_tag('p', l(:label_no_data), :class => 'nodata') if @events_by_day.empty? %>
 
 <div style="float:left;">
-<%= link_to_remote(('&#171; ' + l(:label_previous)), 
-                   {:update => "content", :url => params.merge(:from => @date_to - @days - 1), :method => :get, :complete => 'window.scrollTo(0,0)'},
-                   {:href => url_for(params.merge(:from => @date_to - @days - 1)),
-                    :title => l(:label_date_from_to, :start => format_date(@date_to - 2*@days), :end => format_date(@date_to - @days - 1))}) %>
+<%= link_to_content_update('&#171; ' + l(:label_previous), 
+                   params.merge(:from => @date_to - @days - 1),
+                   :title => l(:label_date_from_to, :start => format_date(@date_to - 2*@days), :end => format_date(@date_to - @days - 1))) %>
 </div>
 <div style="float:right;">
-<%= link_to_remote((l(:label_next) + ' &#187;'), 
-                   {:update => "content", :url => params.merge(:from => @date_to + @days - 1), :method => :get, :complete => 'window.scrollTo(0,0)'},
-                   {:href => url_for(params.merge(:from => @date_to + @days - 1)),
-                    :title => l(:label_date_from_to, :start => format_date(@date_to), :end => format_date(@date_to + @days - 1))}) unless @date_to >= Date.today %>
+<%= link_to_content_update(l(:label_next) + ' &#187;', 
+                   params.merge(:from => @date_to + @days - 1),
+                   :title => l(:label_date_from_to, :start => format_date(@date_to), :end => format_date(@date_to + @days - 1))) unless @date_to >= Date.today %>
 </div>
 &nbsp;
 <% other_formats_links do |f| %>
index c43c6639ebf5f8d5afc4f06c1b6f99e216099097..ddff80d869b0220f067e2e319abf93560c343e2d 100644 (file)
@@ -169,8 +169,8 @@ if Date.today >= @gantt.date_from and Date.today <= @gantt.date_to %>
 
 <table width="100%">
 <tr>
-<td align="left"><%= link_to_remote ('&#171; ' + l(:label_previous)), {:url => params.merge(@gantt.params_previous), :method => :get, :update => 'content', :complete => 'window.scrollTo(0,0)'}, {:href => url_for(params.merge(@gantt.params_previous))} %></td>
-<td align="right"><%= link_to_remote (l(:label_next) + ' &#187;'), {:url => params.merge(@gantt.params_next), :method => :get, :update => 'content', :complete => 'window.scrollTo(0,0)'}, {:href => url_for(params.merge(@gantt.params_next))} %></td>
+<td align="left"><%= link_to_content_update('&#171; ' + l(:label_previous), params.merge(@gantt.params_previous)) %></td>
+<td align="right"><%= link_to_content_update(l(:label_next) + ' &#187;', params.merge(@gantt.params_next)) %></td>
 </tr>
 </table>
 
index 348421d3f6a871ebc2539a1a10696212c630b232..13ec567d978770e07da803c42338afbb24969de2 100644 (file)
 
 <p><center>
 <% if @pagination_previous_date %>
-<%= link_to_remote ('&#171; ' + l(:label_previous)),
-                   {:update => :content,
-                    :url => params.merge(:previous => 1, :offset => @pagination_previous_date.strftime("%Y%m%d%H%M%S"))
-                   }, :href => url_for(params.merge(:previous => 1, :offset => @pagination_previous_date.strftime("%Y%m%d%H%M%S"))) %>&nbsp;
+<%= link_to_content_update('&#171; ' + l(:label_previous),
+      params.merge(:previous => 1, :offset => @pagination_previous_date.strftime("%Y%m%d%H%M%S"))) %>&nbsp;
 <% end %>
 <% if @pagination_next_date %>
-<%= link_to_remote (l(:label_next) + ' &#187;'),
-                   {:update => :content,
-                    :url => params.merge(:previous => nil, :offset => @pagination_next_date.strftime("%Y%m%d%H%M%S"))
-                   }, :href => url_for(params.merge(:previous => nil, :offset => @pagination_next_date.strftime("%Y%m%d%H%M%S"))) %>
+<%= link_to_content_update(l(:label_next) + ' &#187;',
+      params.merge(:previous => nil, :offset => @pagination_next_date.strftime("%Y%m%d%H%M%S"))) %>
 <% end %>
 </center></p>