From ee99848a3ba200e3b93d632534c58a9bc822218f Mon Sep 17 00:00:00 2001 From: Julien Lancelot Date: Wed, 21 Nov 2012 14:23:11 +0100 Subject: [PATCH] SONAR-3936 Add a pagination mechanism to the Quality Profile page --- .../controllers/rules_configuration_controller.rb | 3 +++ .../app/views/rules_configuration/index.html.erb | 12 +++++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/rules_configuration_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/rules_configuration_controller.rb index e633cbc1ffe..0b6f838924c 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/rules_configuration_controller.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/rules_configuration_controller.rb @@ -71,6 +71,9 @@ class RulesConfigurationController < ApplicationController end end + @pagination = Api::Pagination.new(params) + @pagination.count = @rules.size + @current_rules = @rules[@pagination.offset, @pagination.limit] end diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/rules_configuration/index.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/rules_configuration/index.html.erb index 0ed9901a709..043a859d694 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/rules_configuration/index.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/rules_configuration/index.html.erb @@ -90,9 +90,9 @@ <% end %> -

<%= @rules.size %> <%= message('results').downcase -%> - <% if @hidden_actives && @hidden_actives>0 %>[+<%= message('rules_configuration.x_found_in_active_rules', :params => @hidden_actives) -%>]<% end %> - <% if @hidden_inactives && @hidden_inactives>0 %>[+<%= message('rules_configuration.x_found_in_inactive_rules', :params => @hidden_inactives) -%>]<% end %> +

+ <% if @hidden_actives && @hidden_actives>0 %>+<%= message('rules_configuration.x_found_in_active_rules', :params => @hidden_actives) -%><% end %> + <% if @hidden_inactives && @hidden_inactives>0 %>+<%= message('rules_configuration.x_found_in_inactive_rules', :params => @hidden_inactives) -%><% end %>

@@ -103,13 +103,13 @@ -<% if @rules.empty? %> +<% if @current_rules.empty? %> <% end %> <% # avoid executing several times the method is_admin?() is_admin=is_admin?() - @rules.each do |rule| + @current_rules.each do |rule| active_rule = @profile.active_by_rule_id(rule.id) %> @@ -118,6 +118,8 @@ <% end %>
<%= message('no_results') -%>.
+<%= render :partial => 'utils/tfoot_pagination', :locals => {:pagination => @pagination, :colspan => 2} %> +