From a365127a1cfb78a28e5dd9635a0789bf30959cfe Mon Sep 17 00:00:00 2001 From: FinnStutzenstein Date: Fri, 11 Aug 2017 10:18:50 +0200 Subject: [PATCH] default sorting for users, mediafiles and assignments (fixes #3344) --- CHANGELOG | 2 ++ openslides/assignments/static/js/assignments/site.js | 6 +++++- openslides/mediafiles/static/js/mediafiles/list.js | 10 +++++----- openslides/motions/static/js/motions/site.js | 3 +-- openslides/users/static/js/users/site.js | 6 +++++- 5 files changed, 18 insertions(+), 9 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 5d047bdd0..c807db87f 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -65,6 +65,8 @@ Core: - Delay the 'could not load projector' error 3 seconds to not irritate users with a slow internet connection [#3323]. - Added config value for standard font size in PDF [#3332]. +- Added default sorting for agenda, motions, elections, mediafiles and + users [#3334, 3348]. Mediafiles: - Fixed reloading of PDF on page change [#3274]. diff --git a/openslides/assignments/static/js/assignments/site.js b/openslides/assignments/static/js/assignments/site.js index 6a639ce3f..82a95b8e2 100644 --- a/openslides/assignments/static/js/assignments/site.js +++ b/openslides/assignments/static/js/assignments/site.js @@ -273,7 +273,11 @@ angular.module('OpenSlidesApp.assignments.site', [ 'AssignmentPdfExport', function($scope, ngDialog, AssignmentForm, Assignment, Tag, Agenda, Projector, ProjectionDefault, gettextCatalog, User, osTableFilter, osTableSort, gettext, AssignmentPhases, AssignmentPdfExport) { - Assignment.bindAll({}, $scope, 'assignments'); + $scope.$watch(function () { + return Assignment.lastModified(); + }, function () { + $scope.assignments = _.orderBy(Assignment.getAll(), ['title']); + }); Tag.bindAll({}, $scope, 'tags'); $scope.$watch(function () { return Projector.lastModified(); diff --git a/openslides/mediafiles/static/js/mediafiles/list.js b/openslides/mediafiles/static/js/mediafiles/list.js index 57233eef7..c74af76c3 100644 --- a/openslides/mediafiles/static/js/mediafiles/list.js +++ b/openslides/mediafiles/static/js/mediafiles/list.js @@ -25,17 +25,17 @@ angular.module('OpenSlidesApp.mediafiles.list', [ 'Logos', function ($http, $scope, gettext, ngDialog, osTableFilter, osTableSort, ProjectionDefault, Projector, User, Mediafile, MediafileForm, Logos) { - Mediafile.bindAll({}, $scope, 'mediafiles'); + $scope.$watch(function () { + return Mediafile.lastModified(); + }, function () { + $scope.mediafiles = _.orderBy(Mediafile.getAll(), ['title']); + }); User.bindAll({}, $scope, 'users'); $scope.$watch(function() { return Projector.lastModified(); }, function() { $scope.projectors = Projector.getAll(); updatePresentedMediafiles(); - }); - $scope.$watch(function () { - return Projector.lastModified(); - }, function () { var projectiondefault = ProjectionDefault.filter({name: 'mediafiles'})[0]; if (projectiondefault) { $scope.defaultProjectorId = projectiondefault.projector_id; diff --git a/openslides/motions/static/js/motions/site.js b/openslides/motions/static/js/motions/site.js index 08896390c..effaac316 100644 --- a/openslides/motions/static/js/motions/site.js +++ b/openslides/motions/static/js/motions/site.js @@ -895,9 +895,8 @@ angular.module('OpenSlidesApp.motions.site', [ $scope.$watch(function () { return Motion.lastModified(); }, function () { - $scope.motions = Motion.getAll(); // always order by identifier (after custom ordering) - $scope.motions = _.orderBy($scope.motions, ['identifier']); + $scope.motions = _.orderBy(Motion.getAll(), ['identifier']); _.forEach($scope.motions, function (motion) { motion.personalNote = PersonalNoteManager.getNote(motion); // For filtering, we cannot filter for .personalNote.star diff --git a/openslides/users/static/js/users/site.js b/openslides/users/static/js/users/site.js index 0ab0bcdcc..5951bc8e2 100644 --- a/openslides/users/static/js/users/site.js +++ b/openslides/users/static/js/users/site.js @@ -537,7 +537,11 @@ angular.module('OpenSlidesApp.users.site', [ 'ErrorMessage', function($scope, $state, $http, $q, ngDialog, UserForm, User, Group, PasswordGenerator, Projector, ProjectionDefault, Config, gettextCatalog, UserCsvExport, osTableFilter, osTableSort, gettext, UserPdfExport, ErrorMessage) { - User.bindAll({}, $scope, 'users'); + $scope.$watch(function () { + return User.lastModified(); + }, function () { + $scope.users = _.orderBy(User.getAll(), ['first_name']); + }); Group.bindAll({where: {id: {'>': 1}}}, $scope, 'groups'); $scope.$watch(function () { return Projector.lastModified();