From 16fd87cc93a1ede9a717976289c785a62b084c9b Mon Sep 17 00:00:00 2001 From: Emanuel Schuetze Date: Mon, 22 Feb 2016 22:38:28 +0100 Subject: [PATCH] Use a global variable for the limiting number of users in select fields. (Fixed #1989) --- openslides/agenda/static/js/agenda/site.js | 5 +++-- .../agenda/static/templates/agenda/item-detail.html | 2 +- openslides/assignments/static/js/assignments/site.js | 5 +++-- .../static/templates/assignments/assignment-detail.html | 2 +- openslides/core/static/js/core/site.js | 3 +++ openslides/mediafiles/static/js/mediafiles/site.js | 8 ++++++-- .../static/templates/mediafiles/mediafile-form.html | 2 +- openslides/motions/static/js/motions/site.js | 7 ++++--- 8 files changed, 22 insertions(+), 12 deletions(-) diff --git a/openslides/agenda/static/js/agenda/site.js b/openslides/agenda/static/js/agenda/site.js index bf279cf53..490677f9a 100644 --- a/openslides/agenda/static/js/agenda/site.js +++ b/openslides/agenda/static/js/agenda/site.js @@ -209,8 +209,9 @@ angular.module('OpenSlidesApp.agenda.site', ['OpenSlidesApp.agenda']) 'operator', 'Agenda', 'User', + 'LimitUsers', 'item', - function ($scope, $filter, $http, $state, operator, Agenda, User, item) { + function ($scope, $filter, $http, $state, operator, Agenda, User, LimitUsers, item) { Agenda.bindOne(item.id, $scope, 'item'); User.bindAll({}, $scope, 'users'); $scope.speakerSelectBox = {}; @@ -218,7 +219,7 @@ angular.module('OpenSlidesApp.agenda.site', ['OpenSlidesApp.agenda']) $scope.speakers = $filter('orderBy')(item.speakers, 'weight'); // limit the number of users in ui-select field - $scope.limitUsers = 50; + $scope.LimitUsers = LimitUsers; $scope.$watch(function () { return Agenda.lastModified(); diff --git a/openslides/agenda/static/templates/agenda/item-detail.html b/openslides/agenda/static/templates/agenda/item-detail.html index 12ffaafca..0d81a4ee4 100644 --- a/openslides/agenda/static/templates/agenda/item-detail.html +++ b/openslides/agenda/static/templates/agenda/item-detail.html @@ -135,7 +135,7 @@ {{ $select.selected.get_full_name() }} - +
diff --git a/openslides/assignments/static/js/assignments/site.js b/openslides/assignments/static/js/assignments/site.js index 82f7e2a31..322cfc42a 100644 --- a/openslides/assignments/static/js/assignments/site.js +++ b/openslides/assignments/static/js/assignments/site.js @@ -268,9 +268,10 @@ angular.module('OpenSlidesApp.assignments.site', ['OpenSlidesApp.assignments']) 'operator', 'Assignment', 'User', + 'LimitUsers', 'assignment', 'phases', - function($scope, $http, filterFilter, gettext, ngDialog, AssignmentForm, operator, Assignment, User, assignment, phases) { + function($scope, $http, filterFilter, gettext, ngDialog, AssignmentForm, operator, Assignment, User, LimitUsers, assignment, phases) { User.bindAll({}, $scope, 'users'); Assignment.bindOne(assignment.id, $scope, 'assignment'); Assignment.loadRelations(assignment, 'agenda_item'); @@ -279,7 +280,7 @@ angular.module('OpenSlidesApp.assignments.site', ['OpenSlidesApp.assignments']) $scope.alert = {}; // limit the number of users in ui-select field - $scope.limitUsers = 50; + $scope.LimitUsers = LimitUsers; // open edit dialog $scope.openDialog = function (assignment) { diff --git a/openslides/assignments/static/templates/assignments/assignment-detail.html b/openslides/assignments/static/templates/assignments/assignment-detail.html index 747fb35eb..8063ebb89 100644 --- a/openslides/assignments/static/templates/assignments/assignment-detail.html +++ b/openslides/assignments/static/templates/assignments/assignment-detail.html @@ -95,7 +95,7 @@ {{ $select.selected.get_full_name() }} - +
diff --git a/openslides/core/static/js/core/site.js b/openslides/core/static/js/core/site.js index 5313cff86..53be79942 100644 --- a/openslides/core/static/js/core/site.js +++ b/openslides/core/static/js/core/site.js @@ -1040,6 +1040,9 @@ angular.module('OpenSlidesApp.core.site', [ } ]) +// define maximum number of users shown in users select fields (e.g. in motion or speakers forms) +.value('LimitUsers', 50) + .directive('osFocusMe', [ '$timeout', function ($timeout) { diff --git a/openslides/mediafiles/static/js/mediafiles/site.js b/openslides/mediafiles/static/js/mediafiles/site.js index 7e3578b86..f366bcf6d 100644 --- a/openslides/mediafiles/static/js/mediafiles/site.js +++ b/openslides/mediafiles/static/js/mediafiles/site.js @@ -222,11 +222,13 @@ angular.module('OpenSlidesApp.mediafiles.site', ['ngFileUpload', 'OpenSlidesApp. '$scope', 'MediafileForm', 'User', - function($scope, MediafileForm, User) { + 'LimitUsers', + function($scope, MediafileForm, User, LimitUsers) { User.bindAll({}, $scope, 'users'); $scope.mediafile = {}; $scope.alert = {}; $scope.users = User.getAll(); + $scope.LimitUsers = LimitUsers; // upload and save mediafile $scope.save = function (mediafile) { @@ -251,11 +253,13 @@ angular.module('OpenSlidesApp.mediafiles.site', ['ngFileUpload', 'OpenSlidesApp. 'operator', 'Mediafile', 'User', + 'LimitUsers', 'mediafile', - function($scope, operator, Mediafile, User, mediafile) { + function($scope, operator, Mediafile, User, LimitUsers, mediafile) { User.bindAll({}, $scope, 'users'); $scope.alert = {}; $scope.users = User.getAll(); + $scope.LimitUsers = LimitUsers; // set initial values for form model by create deep copy of motion object // so list/detail view is not updated while editing diff --git a/openslides/mediafiles/static/templates/mediafiles/mediafile-form.html b/openslides/mediafiles/static/templates/mediafiles/mediafile-form.html index 4b36aceeb..ee53f62ac 100644 --- a/openslides/mediafiles/static/templates/mediafiles/mediafile-form.html +++ b/openslides/mediafiles/static/templates/mediafiles/mediafile-form.html @@ -28,7 +28,7 @@ {{ $select.selected.get_full_name() }} - +
diff --git a/openslides/motions/static/js/motions/site.js b/openslides/motions/static/js/motions/site.js index 52ec79b43..3aada474c 100644 --- a/openslides/motions/static/js/motions/site.js +++ b/openslides/motions/static/js/motions/site.js @@ -159,7 +159,8 @@ angular.module('OpenSlidesApp.motions.site', ['OpenSlidesApp.motions']) 'Tag', 'User', 'Workflow', - function (gettextCatalog, operator, Editor, Category, Config, Mediafile, Tag, User, Workflow) { + 'LimitUsers', + function (gettextCatalog, operator, Editor, Category, Config, Mediafile, Tag, User, Workflow, LimitUsers) { return { // ngDialog for motion form getDialog: function (motion) { @@ -207,7 +208,7 @@ angular.module('OpenSlidesApp.motions.site', ['OpenSlidesApp.motions']) label: gettextCatalog.getString('Submitters'), optionsAttr: 'bs-options', options: User.getAll(), - ngOptions: 'option[to.valueProp] as option in to.options | filter: $select.search | limitTo: 50', + ngOptions: 'option[to.valueProp] as option in to.options | filter: $select.search | limitTo: ' + LimitUsers, valueProp: 'id', labelProp: 'full_name', placeholder: gettextCatalog.getString('Select or search a submitter ...') @@ -318,7 +319,7 @@ angular.module('OpenSlidesApp.motions.site', ['OpenSlidesApp.motions']) label: gettextCatalog.getString('Supporters'), optionsAttr: 'bs-options', options: User.getAll(), - ngOptions: 'option[to.valueProp] as option in to.options | filter: $select.search | limitTo: 50', + ngOptions: 'option[to.valueProp] as option in to.options | filter: $select.search | limitTo: ' + LimitUsers, valueProp: 'id', labelProp: 'full_name', placeholder: gettextCatalog.getString('Select or search a supporter ...')