From 094fa4da8495b451e9d5dbe2227f38bd85e91095 Mon Sep 17 00:00:00 2001 From: FinnStutzenstein Date: Wed, 11 Apr 2018 12:47:25 +0200 Subject: [PATCH] Added pagination on top of lists (Fixed #3667). --- CHANGELOG | 1 + openslides/agenda/static/js/agenda/site.js | 2 +- .../static/templates/agenda/item-list.html | 10 +++++++- .../assignments/assignment-list.html | 10 +++++++- openslides/core/static/css/_helper.scss | 10 ++++++++ openslides/core/static/js/core/site.js | 25 +++++++++++++++++++ .../templates/mediafiles/mediafile-list.html | 10 +++++++- .../static/templates/motions/motion-list.html | 10 +++++++- .../static/templates/users/user-list.html | 10 +++++++- 9 files changed, 82 insertions(+), 6 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index c74dfd0ee..7bbc4d969 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -127,6 +127,7 @@ Core: easier development [#3566]. - Reset scroll level for each new projection [#3686]. - Scroll to top on every state change [#3689]. +- Added pagination on top of lists [#3698]. Mediafiles: - New form for uploading multiple files [#3650]. diff --git a/openslides/agenda/static/js/agenda/site.js b/openslides/agenda/static/js/agenda/site.js index 0c2ccdb35..6313ab91c 100644 --- a/openslides/agenda/static/js/agenda/site.js +++ b/openslides/agenda/static/js/agenda/site.js @@ -173,7 +173,7 @@ angular.module('OpenSlidesApp.agenda.site', [ }; // pagination - $scope.pagination = osTablePagination.createInstance('AgendaTablePagination'); + $scope.pagination = osTablePagination.createInstance('AgendaTablePagination', 50); // parse duration for inline editing $scope.generateDurationText = function (item) { diff --git a/openslides/agenda/static/templates/agenda/item-list.html b/openslides/agenda/static/templates/agenda/item-list.html index 67a1e41d8..3b1834814 100644 --- a/openslides/agenda/static/templates/agenda/item-list.html +++ b/openslides/agenda/static/templates/agenda/item-list.html @@ -170,8 +170,16 @@
+ + « + Page {{ pagination.currentPage }} / - {{ Math.ceil(itemsFiltered.length/pagination.itemsPerPage) }} + {{ pagination.getPageCount(itemsFiltered) }} + + » +
diff --git a/openslides/assignments/static/templates/assignments/assignment-list.html b/openslides/assignments/static/templates/assignments/assignment-list.html index 4a762553e..77e4e1dc5 100644 --- a/openslides/assignments/static/templates/assignments/assignment-list.html +++ b/openslides/assignments/static/templates/assignments/assignment-list.html @@ -67,8 +67,16 @@
+ + « + Page {{ pagination.currentPage }} / - {{ Math.ceil(assignmentsFiltered.length/pagination.itemsPerPage) }} + {{ pagination.getPageCount(assignmentsFiltered) }} + + » +
diff --git a/openslides/core/static/css/_helper.scss b/openslides/core/static/css/_helper.scss index 503b54066..401412745 100644 --- a/openslides/core/static/css/_helper.scss +++ b/openslides/core/static/css/_helper.scss @@ -209,6 +209,16 @@ tr.selected td { margin-left: 2px; } +.pagination-arrow { + font-size: 150%; + padding: 3px; + text-decoration: none; + + &:hover, &:focus { + text-decoration: none; + } +} + .grey { color: #9a9898; } diff --git a/openslides/core/static/js/core/site.js b/openslides/core/static/js/core/site.js index f4536cc37..c918b18e2 100644 --- a/openslides/core/static/js/core/site.js +++ b/openslides/core/static/js/core/site.js @@ -650,6 +650,31 @@ angular.module('OpenSlidesApp.core.site', [ self.save(); $rootScope.gotoTop(); }; + self.getPageCount = function (objs) { + if (objs) { + return Math.ceil(objs.length/self.itemsPerPage); + } + }; + self.showNextPageArrow = function (objs) { + if (objs) { + return self.currentPage != self.getPageCount(objs); + } + }; + self.showPrevPageArrow = function () { + return self.currentPage != 1; + }; + self.nextPage = function (objs) { + if (objs && self.currentPage < self.getPageCount(objs)) { + self.currentPage++; + self.pageChanged(); + } + }; + self.prevPage = function () { + if (self.currentPage > 1) { + self.currentPage--; + self.pageChanged(); + } + }; return self; }; diff --git a/openslides/mediafiles/static/templates/mediafiles/mediafile-list.html b/openslides/mediafiles/static/templates/mediafiles/mediafile-list.html index 314fb59f5..c9021f28f 100644 --- a/openslides/mediafiles/static/templates/mediafiles/mediafile-list.html +++ b/openslides/mediafiles/static/templates/mediafiles/mediafile-list.html @@ -146,8 +146,16 @@
+ + « + Page {{ pagination.currentPage }} / - {{ Math.ceil(mediafilesFiltered.length/pagination.itemsPerPage) }} + {{ pagination.getPageCount(mediafilesFiltered) }} + + » +
diff --git a/openslides/motions/static/templates/motions/motion-list.html b/openslides/motions/static/templates/motions/motion-list.html index eaf157070..576c0f8c7 100644 --- a/openslides/motions/static/templates/motions/motion-list.html +++ b/openslides/motions/static/templates/motions/motion-list.html @@ -128,8 +128,16 @@
+ + « + Page {{ pagination.currentPage }} / - {{ Math.ceil(motionsFiltered.length/pagination.itemsPerPage) }} + {{ pagination.getPageCount(motionsFiltered) }} + + » +
diff --git a/openslides/users/static/templates/users/user-list.html b/openslides/users/static/templates/users/user-list.html index d31d81791..5f1949206 100644 --- a/openslides/users/static/templates/users/user-list.html +++ b/openslides/users/static/templates/users/user-list.html @@ -149,8 +149,16 @@
+ + « + Page {{ pagination.currentPage }} / - {{ Math.ceil(usersFiltered.length/pagination.itemsPerPage) }} + {{ pagination.getPageCount(usersFiltered) }} + + » +