]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-2795 Paging at filters page
authorFabrice Bellingard <bellingard@gmail.com>
Thu, 8 Dec 2011 11:29:34 +0000 (12:29 +0100)
committerFabrice Bellingard <bellingard@gmail.com>
Thu, 8 Dec 2011 11:29:34 +0000 (12:29 +0100)
Display a maximum of 20 page links, which will prevent UI side
effects (no need to have more than 20 links, people never go that
far in pagination).

sonar-server/src/main/webapp/WEB-INF/app/views/filters/_list.html.erb

index 44468d9516f8888452f5471f32d5d4e6ae1cd1bd..c164cfbadea9e186e774e43fc29127078c873fd4 100644 (file)
       <td colspan="<%= filter.columns.size + 1 -%>">
         <span id="results_count"><%= pluralize(@filter_context.size, message('result').downcase) %></span>
 
-        <% if @filter_context.page_count>1 %>
+        <% 
+          if @filter_context.page_count>1
+            max_pages = @filter_context.page_count
+            max_pages = 20 if @filter_context.page_count > 20 
+        %>
           |
           <%= link_to_if @filter_context.page_id>1, message('paging_previous'), {:overwrite_params => {:page_id => @filter_context.page_id-1}} %>
-          <% for index in 1..@filter_context.page_count %>
+          <% for index in 1..max_pages %>
             <%= link_to_unless index==@filter_context.page_id, index.to_s, {:overwrite_params => {:page_id => index}} %>
           <% end %>
+          <%= '...' if @filter_context.page_count > 20 -%>
           <%= link_to_if @filter_context.page_id<@filter_context.page_count, message('paging_next'), {:overwrite_params => {:page_id => 1+@filter_context.page_id}} %>
         <% end %>