Getting per page options from settings, not hard wired.

pull/976/head
Richard 11 years ago committed by Till Breuer
parent 8a9f6f1d56
commit 11299afa8c
  1. 1
      app/assets/javascripts/angular/controllers/work-packages-controller.js
  2. 2
      app/assets/javascripts/angular/directives/components/table_pagination.js
  3. 1
      app/controllers/work_packages_controller.rb
  4. 1
      app/views/work_packages/_list.html.erb
  5. 10
      public/templates/components/table_pagination.html

@ -54,6 +54,7 @@ angular.module('openproject.workPackages.controllers')
$scope.groupSums = json.group_sums; $scope.groupSums = json.group_sums;
$scope.page = json.page; $scope.page = json.page;
$scope.perPage = json.per_page; $scope.perPage = json.per_page;
$scope.perPageOptions = json.per_page_options;
$scope.totalEntries = json.total_entries; $scope.totalEntries = json.total_entries;
}; };

@ -7,6 +7,7 @@ angular.module('openproject.uiComponents')
scope: { scope: {
page: '=', page: '=',
perPage: '=', perPage: '=',
perPageOptions: '=',
totalEntries: '=', totalEntries: '=',
rows: '=' rows: '='
}, },
@ -36,7 +37,6 @@ angular.module('openproject.uiComponents')
return pageNumbers; return pageNumbers;
} }
scope.possiblePerPages = [10, 20, 50, 100, 500, 1000]; // TODO: These need to come from the settings and put into gon/json
scope.currentRange = currentRange(); scope.currentRange = currentRange();
scope.pageNumbers = pageNumbers(); scope.pageNumbers = pageNumbers();
} }

@ -564,6 +564,7 @@ class WorkPackagesController < ApplicationController
group_sums: @query.group_by_column && @query.columns.map { |column| results.grouped_sums(column) }, group_sums: @query.group_by_column && @query.columns.map { |column| results.grouped_sums(column) },
page: page_param, page: page_param,
per_page: per_page_param, per_page: per_page_param,
per_page_options: Setting.per_page_options_array,
total_entries: work_packages.total_entries total_entries: work_packages.total_entries
} }
end end

@ -48,6 +48,7 @@ See doc/COPYRIGHT.rdoc for more details.
</work-packages-table> </work-packages-table>
<table-pagination per-page="perPage" <table-pagination per-page="perPage"
per-page-options="perPageOptions"
page="page" page="page"
total-entries="totalEntries" total-entries="totalEntries"
rows="rows"> rows="rows">

@ -25,12 +25,12 @@
<span class="per_page_options"> <span class="per_page_options">
Per page: <span class="current">{{ currentPerPage }}</span> Per page: <span class="current">{{ currentPerPage }}</span>
<span ng-repeat="perPageSelection in possiblePerPages"> <span ng-repeat="perPageOption in perPageOptions">
<span ng-if="perPageSelection != perPage"> <span ng-if="perPageOption != perPage">
<a href="" ng-click="selectPerPage(perPageSelection)">{{ perPageSelection }}</a> <a href="" ng-click="selectPerPage(perPageOption)">{{ perPageOption }}</a>
</span> </span>
<span ng-if="perPageSelection == perPage" <span ng-if="perPageOption == perPage"
ng-click="selectPerPage(perPageSelection)">{{ perPageSelection }}</span> ng-click="selectPerPage(perPageOption)">{{ perPageOption }}</span>
</span> </span>
</span> </span>
</p> </p>
Loading…
Cancel
Save