From: Julien Lancelot Date: Wed, 21 Nov 2012 13:23:11 +0000 (+0100) Subject: SONAR-3936 Add a pagination mechanism to the Quality Profile page X-Git-Tag: 3.4~312 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=ee99848a3ba200e3b93d632534c58a9bc822218f;p=sonarqube.git SONAR-3936 Add a pagination mechanism to the Quality Profile page --- 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} %> +