Merge pull request #2907 from emanuelschuetze/pagination

Used better pagination for agenda, motions and users.
This commit is contained in:
Emanuel Schütze 2017-01-25 21:23:45 +01:00 committed by GitHub
commit 8897e22df0
7 changed files with 31 additions and 7 deletions

View File

@ -141,7 +141,7 @@ angular.module('OpenSlidesApp.agenda.site', [
// pagination // pagination
$scope.currentPage = 1; $scope.currentPage = 1;
$scope.itemsPerPage = 100; $scope.itemsPerPage = 25;
$scope.limitBegin = 0; $scope.limitBegin = 0;
$scope.pageChanged = function() { $scope.pageChanged = function() {
$scope.limitBegin = ($scope.currentPage - 1) * $scope.itemsPerPage; $scope.limitBegin = ($scope.currentPage - 1) * $scope.itemsPerPage;

View File

@ -215,8 +215,8 @@
ng-repeat="item in itemsFiltered = (items ng-repeat="item in itemsFiltered = (items
| osFilter: filter.filterString : filter.getObjectQueryString | osFilter: filter.filterString : filter.getObjectQueryString
| filter: {closed: filter.booleanFilters.closed.value} | filter: {closed: filter.booleanFilters.closed.value}
| filter: {is_hidden: filter.booleanFilters.is_hidden.value} | filter: {is_hidden: filter.booleanFilters.is_hidden.value})
| limitTo : itemsPerPage : limitBegin)"> | limitTo : itemsPerPage : limitBegin">
<!-- select column --> <!-- select column -->
<div ng-show="isSelectMode" os-perms="agenda.can_manage" class="col-xs-1 centered"> <div ng-show="isSelectMode" os-perms="agenda.can_manage" class="col-xs-1 centered">

View File

@ -21,7 +21,7 @@ angular.module('OpenSlidesApp.motions.csv', [])
]; ];
_.forEach(motions, function (motion) { _.forEach(motions, function (motion) {
var row = []; var row = [];
row.push('"' + motion.identifier + '"'); row.push('"' + motion.identifier !== null ? motion.identifier : '' + '"');
row.push('"' + motion.getTitle() + '"'); row.push('"' + motion.getTitle() + '"');
row.push('"' + motion.getText() + '"'); row.push('"' + motion.getText() + '"');
row.push('"' + motion.getReason() + '"'); row.push('"' + motion.getReason() + '"');

View File

@ -771,6 +771,15 @@ angular.module('OpenSlidesApp.motions.site', [
display_name: gettext('Last modified')}, display_name: gettext('Last modified')},
]; ];
// pagination
$scope.currentPage = 1;
$scope.itemsPerPage = 25;
$scope.limitBegin = 0;
$scope.pageChanged = function() {
$scope.limitBegin = ($scope.currentPage - 1) * $scope.itemsPerPage;
};
// update state // update state
$scope.updateState = function (motion, state_id) { $scope.updateState = function (motion, state_id) {
$http.put('/rest/motions/motion/' + motion.id + '/set_state/', {'state': state_id}); $http.put('/rest/motions/motion/' + motion.id + '/set_state/', {'state': state_id});
@ -1565,7 +1574,7 @@ angular.module('OpenSlidesApp.motions.site', [
// All user objects are already loaded via the resolve statement from ui-router. // All user objects are already loaded via the resolve statement from ui-router.
var users = User.getAll(); var users = User.getAll();
angular.forEach(users, function (user) { angular.forEach(users, function (user) {
if (user.short_name == motion.submitter) { if (user.short_name == motion.submitter.trim()) {
motion.submitters_id = [user.id]; motion.submitters_id = [user.id];
motion.submitter = User.get(user.id).full_name; motion.submitter = User.get(user.id).full_name;
} }

View File

@ -419,7 +419,8 @@
| MultiselectFilter: filter.multiselectFilters.recommendation : getItemId.recommendation | MultiselectFilter: filter.multiselectFilters.recommendation : getItemId.recommendation
| MultiselectFilter: filter.multiselectFilters.tag : getItemId.tag | MultiselectFilter: filter.multiselectFilters.tag : getItemId.tag
| toArray | toArray
| orderBy: sort.column : sort.reverse)"> | orderBy: sort.column : sort.reverse)
| limitTo : itemsPerPage : limitBegin">
<!-- select column --> <!-- select column -->
<div ng-show="isSelectMode" os-perms="motions.can_manage" class="col-xs-1 centered"> <div ng-show="isSelectMode" os-perms="motions.can_manage" class="col-xs-1 centered">
@ -659,5 +660,18 @@
</div> </div>
</div> <!-- data row --> </div> <!-- data row -->
<ul uib-pagination
ng-show="motionsFiltered.length > itemsPerPage"
total-items="motionsFiltered.length"
items-per-page="itemsPerPage"
ng-model="currentPage"
ng-change="pageChanged()"
class="pagination-sm"
direction-links="false"
boundary-links="true"
first-text="&laquo;"
last-text="&raquo;">
</ul>
</div> <!-- container --> </div> <!-- container -->
</div> <!-- details --> </div> <!-- details -->

View File

@ -504,7 +504,7 @@ angular.module('OpenSlidesApp.users.site', [
// pagination // pagination
$scope.currentPage = 1; $scope.currentPage = 1;
$scope.itemsPerPage = 100; $scope.itemsPerPage = 25;
$scope.limitBegin = 0; $scope.limitBegin = 0;
$scope.pageChanged = function() { $scope.pageChanged = function() {
$scope.limitBegin = ($scope.currentPage - 1) * $scope.itemsPerPage; $scope.limitBegin = ($scope.currentPage - 1) * $scope.itemsPerPage;

View File

@ -419,6 +419,7 @@
</div><!-- end os-table --> </div><!-- end os-table -->
<ul uib-pagination <ul uib-pagination
ng-show="usersFiltered.length > itemsPerPage"
total-items="usersFiltered.length" total-items="usersFiltered.length"
items-per-page="itemsPerPage" items-per-page="itemsPerPage"
ng-model="currentPage" ng-model="currentPage"