From 446cab3b449a455d514ac4205e4f89dcb902007b Mon Sep 17 00:00:00 2001 From: FinnStutzenstein Date: Tue, 7 Nov 2017 09:15:07 +0100 Subject: [PATCH] Added pagination for mediafiles (fixes #3448) --- .../mediafiles/static/js/mediafiles/list.js | 9 ++++++ .../templates/mediafiles/mediafile-list.html | 31 ++++++++++++++++--- 2 files changed, 35 insertions(+), 5 deletions(-) diff --git a/openslides/mediafiles/static/js/mediafiles/list.js b/openslides/mediafiles/static/js/mediafiles/list.js index 363f67c34..8d3200c8b 100644 --- a/openslides/mediafiles/static/js/mediafiles/list.js +++ b/openslides/mediafiles/static/js/mediafiles/list.js @@ -106,6 +106,15 @@ angular.module('OpenSlidesApp.mediafiles.list', [ display_name: gettext('Uploaded by')}, ]; + // pagination + $scope.currentPage = 1; + $scope.itemsPerPage = 25; + $scope.limitBegin = 0; + $scope.pageChanged = function() { + $scope.limitBegin = ($scope.currentPage - 1) * $scope.itemsPerPage; + $scope.gotoTop(); + }; + // open new/edit dialog $scope.openDialog = function (mediafile) { ngDialog.open(MediafileForm.getDialog(mediafile)); diff --git a/openslides/mediafiles/static/templates/mediafiles/mediafile-list.html b/openslides/mediafiles/static/templates/mediafiles/mediafile-list.html index a9262b510..f79f2fadb 100644 --- a/openslides/mediafiles/static/templates/mediafiles/mediafile-list.html +++ b/openslides/mediafiles/static/templates/mediafiles/mediafile-list.html @@ -138,10 +138,17 @@ -
- {{ mediafilesFiltered.length }} / - {{ mediafiles.length }} {{ "files" | translate }}, - {{(mediafiles|filter:{selected:true}).length}} {{ "selected" | translate }} +
+
+ {{ mediafilesFiltered.length }} / + {{ mediafiles.length }} {{ "files" | translate }}, + {{(mediafiles|filter:{selected:true}).length}} {{ "selected" | translate }} +
+
+ + Page {{ currentPage }} / {{ Math.ceil(mediafilesFiltered.length/itemsPerPage) }} + +
@@ -240,7 +247,8 @@ | osFilter: filter.filterString : filter.getObjectQueryString | filter: {filetype: (filter.booleanFilters.isPdf.value ? 'application/pdf' : (filter.booleanFilters.isPdf.value === false ? '!application/pdf' : ''))} | filter: {hidden: filter.booleanFilters.isHidden.value} - | orderByEmptyLast: sort.column : sort.reverse )"> + | orderByEmptyLast: sort.column : sort.reverse) + | limitTo: itemsPerPage : limitBegin">
@@ -358,4 +366,17 @@
+ +