From df3e6917342d2a18bb9556937e3e8b10fcaa45b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emanuel=20Sch=C3=BCtze?= Date: Wed, 25 Jan 2017 16:19:02 +0100 Subject: [PATCH] Used better pagination for agenda, motions and users. to increase the browser performance while switching between apps. --- openslides/agenda/static/js/agenda/site.js | 2 +- .../static/templates/agenda/item-list.html | 4 ++-- openslides/motions/static/js/motions/csv.js | 2 +- openslides/motions/static/js/motions/site.js | 11 ++++++++++- .../static/templates/motions/motion-list.html | 16 +++++++++++++++- openslides/users/static/js/users/site.js | 2 +- .../users/static/templates/users/user-list.html | 1 + 7 files changed, 31 insertions(+), 7 deletions(-) diff --git a/openslides/agenda/static/js/agenda/site.js b/openslides/agenda/static/js/agenda/site.js index 1985f3b0d..6433d3c56 100644 --- a/openslides/agenda/static/js/agenda/site.js +++ b/openslides/agenda/static/js/agenda/site.js @@ -140,7 +140,7 @@ angular.module('OpenSlidesApp.agenda.site', [ // pagination $scope.currentPage = 1; - $scope.itemsPerPage = 100; + $scope.itemsPerPage = 25; $scope.limitBegin = 0; $scope.pageChanged = function() { $scope.limitBegin = ($scope.currentPage - 1) * $scope.itemsPerPage; diff --git a/openslides/agenda/static/templates/agenda/item-list.html b/openslides/agenda/static/templates/agenda/item-list.html index 5e2f7fb4d..674cda7ca 100644 --- a/openslides/agenda/static/templates/agenda/item-list.html +++ b/openslides/agenda/static/templates/agenda/item-list.html @@ -215,8 +215,8 @@ ng-repeat="item in itemsFiltered = (items | osFilter: filter.filterString : filter.getObjectQueryString | filter: {closed: filter.booleanFilters.closed.value} - | filter: {is_hidden: filter.booleanFilters.is_hidden.value} - | limitTo : itemsPerPage : limitBegin)"> + | filter: {is_hidden: filter.booleanFilters.is_hidden.value}) + | limitTo : itemsPerPage : limitBegin">
diff --git a/openslides/motions/static/js/motions/csv.js b/openslides/motions/static/js/motions/csv.js index b5ffdc16d..b722e999b 100644 --- a/openslides/motions/static/js/motions/csv.js +++ b/openslides/motions/static/js/motions/csv.js @@ -21,7 +21,7 @@ angular.module('OpenSlidesApp.motions.csv', []) ]; _.forEach(motions, function (motion) { var row = []; - row.push('"' + motion.identifier + '"'); + row.push('"' + motion.identifier !== null ? motion.identifier : '' + '"'); row.push('"' + motion.getTitle() + '"'); row.push('"' + motion.getText() + '"'); row.push('"' + motion.getReason() + '"'); diff --git a/openslides/motions/static/js/motions/site.js b/openslides/motions/static/js/motions/site.js index f3b56a01b..ef7c3a85a 100644 --- a/openslides/motions/static/js/motions/site.js +++ b/openslides/motions/static/js/motions/site.js @@ -770,6 +770,15 @@ angular.module('OpenSlidesApp.motions.site', [ 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 $scope.updateState = function (motion, state_id) { $http.put('/rest/motions/motion/' + motion.id + '/set_state/', {'state': state_id}); @@ -1564,7 +1573,7 @@ angular.module('OpenSlidesApp.motions.site', [ // All user objects are already loaded via the resolve statement from ui-router. var users = User.getAll(); angular.forEach(users, function (user) { - if (user.short_name == motion.submitter) { + if (user.short_name == motion.submitter.trim()) { motion.submitters_id = [user.id]; motion.submitter = User.get(user.id).full_name; } diff --git a/openslides/motions/static/templates/motions/motion-list.html b/openslides/motions/static/templates/motions/motion-list.html index 7a7ebae32..f64e025d6 100644 --- a/openslides/motions/static/templates/motions/motion-list.html +++ b/openslides/motions/static/templates/motions/motion-list.html @@ -419,7 +419,8 @@ | MultiselectFilter: filter.multiselectFilters.recommendation : getItemId.recommendation | MultiselectFilter: filter.multiselectFilters.tag : getItemId.tag | toArray - | orderBy: sort.column : sort.reverse)"> + | orderBy: sort.column : sort.reverse) + | limitTo : itemsPerPage : limitBegin">
@@ -659,5 +660,18 @@
+ + diff --git a/openslides/users/static/js/users/site.js b/openslides/users/static/js/users/site.js index 8a6fa2bac..9af64c250 100644 --- a/openslides/users/static/js/users/site.js +++ b/openslides/users/static/js/users/site.js @@ -503,7 +503,7 @@ angular.module('OpenSlidesApp.users.site', [ // pagination $scope.currentPage = 1; - $scope.itemsPerPage = 100; + $scope.itemsPerPage = 25; $scope.limitBegin = 0; $scope.pageChanged = function() { $scope.limitBegin = ($scope.currentPage - 1) * $scope.itemsPerPage; diff --git a/openslides/users/static/templates/users/user-list.html b/openslides/users/static/templates/users/user-list.html index eccb313b7..f20ca790e 100644 --- a/openslides/users/static/templates/users/user-list.html +++ b/openslides/users/static/templates/users/user-list.html @@ -419,6 +419,7 @@