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',
'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();

View File

@ -135,7 +135,7 @@
<ui-select-match placeholder="{{ 'Select or search a participant ...' | translate }}">
{{ $select.selected.get_full_name() }}
</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>
</ui-select-choices>
</ui-select>

View File

@ -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) {

View File

@ -95,7 +95,7 @@
<ui-select-match placeholder="{{ 'Select or search a participant ...' | translate }}">
{{ $select.selected.get_full_name() }}
</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>
</ui-select-choices>
</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', [
'$timeout',
function ($timeout) {

View File

@ -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

View File

@ -28,7 +28,7 @@
<ui-select-match placeholder="{{ 'Select or search a participant ...' | translate }}" data-allow-clear="true">
{{ $select.selected.get_full_name() }}
</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>
</ui-select-choices>
</ui-select>

View File

@ -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 ...')