Use a global variable for the limiting number of users in select fields. (Fixed #1989)

This commit is contained in:
Emanuel Schuetze 2016-02-22 22:38:28 +01:00
parent 70dc8443fd
commit 16fd87cc93
8 changed files with 22 additions and 12 deletions

View File

@ -209,8 +209,9 @@ angular.module('OpenSlidesApp.agenda.site', ['OpenSlidesApp.agenda'])
'operator', 'operator',
'Agenda', 'Agenda',
'User', 'User',
'LimitUsers',
'item', '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'); Agenda.bindOne(item.id, $scope, 'item');
User.bindAll({}, $scope, 'users'); User.bindAll({}, $scope, 'users');
$scope.speakerSelectBox = {}; $scope.speakerSelectBox = {};
@ -218,7 +219,7 @@ angular.module('OpenSlidesApp.agenda.site', ['OpenSlidesApp.agenda'])
$scope.speakers = $filter('orderBy')(item.speakers, 'weight'); $scope.speakers = $filter('orderBy')(item.speakers, 'weight');
// limit the number of users in ui-select field // limit the number of users in ui-select field
$scope.limitUsers = 50; $scope.LimitUsers = LimitUsers;
$scope.$watch(function () { $scope.$watch(function () {
return Agenda.lastModified(); return Agenda.lastModified();

View File

@ -135,7 +135,7 @@
<ui-select-match placeholder="{{ 'Select or search a participant ...' | translate }}"> <ui-select-match placeholder="{{ 'Select or search a participant ...' | translate }}">
{{ $select.selected.get_full_name() }} {{ $select.selected.get_full_name() }}
</ui-select-match> </ui-select-match>
<ui-select-choices repeat="user in users | filter: $select.search | limitTo: limitUsers"> <ui-select-choices repeat="user in users | filter: $select.search | limitTo: LimitUsers">
<div ng-bind-html="user.get_full_name() | highlight: $select.search"></div> <div ng-bind-html="user.get_full_name() | highlight: $select.search"></div>
</ui-select-choices> </ui-select-choices>
</ui-select> </ui-select>

View File

@ -268,9 +268,10 @@ angular.module('OpenSlidesApp.assignments.site', ['OpenSlidesApp.assignments'])
'operator', 'operator',
'Assignment', 'Assignment',
'User', 'User',
'LimitUsers',
'assignment', 'assignment',
'phases', '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'); User.bindAll({}, $scope, 'users');
Assignment.bindOne(assignment.id, $scope, 'assignment'); Assignment.bindOne(assignment.id, $scope, 'assignment');
Assignment.loadRelations(assignment, 'agenda_item'); Assignment.loadRelations(assignment, 'agenda_item');
@ -279,7 +280,7 @@ angular.module('OpenSlidesApp.assignments.site', ['OpenSlidesApp.assignments'])
$scope.alert = {}; $scope.alert = {};
// limit the number of users in ui-select field // limit the number of users in ui-select field
$scope.limitUsers = 50; $scope.LimitUsers = LimitUsers;
// open edit dialog // open edit dialog
$scope.openDialog = function (assignment) { $scope.openDialog = function (assignment) {

View File

@ -95,7 +95,7 @@
<ui-select-match placeholder="{{ 'Select or search a participant ...' | translate }}"> <ui-select-match placeholder="{{ 'Select or search a participant ...' | translate }}">
{{ $select.selected.get_full_name() }} {{ $select.selected.get_full_name() }}
</ui-select-match> </ui-select-match>
<ui-select-choices repeat="user in users | filter: $select.search | limitTo: limitUsers"> <ui-select-choices repeat="user in users | filter: $select.search | limitTo: LimitUsers">
<div ng-bind-html="user.get_full_name() | highlight: $select.search"></div> <div ng-bind-html="user.get_full_name() | highlight: $select.search"></div>
</ui-select-choices> </ui-select-choices>
</ui-select> </ui-select>

View File

@ -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', [ .directive('osFocusMe', [
'$timeout', '$timeout',
function ($timeout) { function ($timeout) {

View File

@ -222,11 +222,13 @@ angular.module('OpenSlidesApp.mediafiles.site', ['ngFileUpload', 'OpenSlidesApp.
'$scope', '$scope',
'MediafileForm', 'MediafileForm',
'User', 'User',
function($scope, MediafileForm, User) { 'LimitUsers',
function($scope, MediafileForm, User, LimitUsers) {
User.bindAll({}, $scope, 'users'); User.bindAll({}, $scope, 'users');
$scope.mediafile = {}; $scope.mediafile = {};
$scope.alert = {}; $scope.alert = {};
$scope.users = User.getAll(); $scope.users = User.getAll();
$scope.LimitUsers = LimitUsers;
// upload and save mediafile // upload and save mediafile
$scope.save = function (mediafile) { $scope.save = function (mediafile) {
@ -251,11 +253,13 @@ angular.module('OpenSlidesApp.mediafiles.site', ['ngFileUpload', 'OpenSlidesApp.
'operator', 'operator',
'Mediafile', 'Mediafile',
'User', 'User',
'LimitUsers',
'mediafile', 'mediafile',
function($scope, operator, Mediafile, User, mediafile) { function($scope, operator, Mediafile, User, LimitUsers, mediafile) {
User.bindAll({}, $scope, 'users'); User.bindAll({}, $scope, 'users');
$scope.alert = {}; $scope.alert = {};
$scope.users = User.getAll(); $scope.users = User.getAll();
$scope.LimitUsers = LimitUsers;
// set initial values for form model by create deep copy of motion object // set initial values for form model by create deep copy of motion object
// so list/detail view is not updated while editing // so list/detail view is not updated while editing

View File

@ -28,7 +28,7 @@
<ui-select-match placeholder="{{ 'Select or search a participant ...' | translate }}" data-allow-clear="true"> <ui-select-match placeholder="{{ 'Select or search a participant ...' | translate }}" data-allow-clear="true">
{{ $select.selected.get_full_name() }} {{ $select.selected.get_full_name() }}
</ui-select-match> </ui-select-match>
<ui-select-choices repeat="user.id as user in users | filter: $select.search | limitTo: 50"> <ui-select-choices repeat="user.id as user in users | filter: $select.search | limitTo: LimitUsers">
<div ng-bind-html="user.get_full_name() | highlight: $select.search"></div> <div ng-bind-html="user.get_full_name() | highlight: $select.search"></div>
</ui-select-choices> </ui-select-choices>
</ui-select> </ui-select>

View File

@ -159,7 +159,8 @@ angular.module('OpenSlidesApp.motions.site', ['OpenSlidesApp.motions'])
'Tag', 'Tag',
'User', 'User',
'Workflow', 'Workflow',
function (gettextCatalog, operator, Editor, Category, Config, Mediafile, Tag, User, Workflow) { 'LimitUsers',
function (gettextCatalog, operator, Editor, Category, Config, Mediafile, Tag, User, Workflow, LimitUsers) {
return { return {
// ngDialog for motion form // ngDialog for motion form
getDialog: function (motion) { getDialog: function (motion) {
@ -207,7 +208,7 @@ angular.module('OpenSlidesApp.motions.site', ['OpenSlidesApp.motions'])
label: gettextCatalog.getString('Submitters'), label: gettextCatalog.getString('Submitters'),
optionsAttr: 'bs-options', optionsAttr: 'bs-options',
options: User.getAll(), 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', valueProp: 'id',
labelProp: 'full_name', labelProp: 'full_name',
placeholder: gettextCatalog.getString('Select or search a submitter ...') placeholder: gettextCatalog.getString('Select or search a submitter ...')
@ -318,7 +319,7 @@ angular.module('OpenSlidesApp.motions.site', ['OpenSlidesApp.motions'])
label: gettextCatalog.getString('Supporters'), label: gettextCatalog.getString('Supporters'),
optionsAttr: 'bs-options', optionsAttr: 'bs-options',
options: User.getAll(), 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', valueProp: 'id',
labelProp: 'full_name', labelProp: 'full_name',
placeholder: gettextCatalog.getString('Select or search a supporter ...') placeholder: gettextCatalog.getString('Select or search a supporter ...')