Fixed candidate button.

This commit is contained in:
Norman Jäckel 2016-01-10 11:27:17 +01:00
parent 896ac28c30
commit e2145f9777
2 changed files with 4 additions and 3 deletions

View File

@ -288,11 +288,12 @@ angular.module('OpenSlidesApp.assignments.site', ['OpenSlidesApp.assignments'])
$scope.alert = { type: 'danger', msg: data.detail, show: true }; $scope.alert = { type: 'danger', msg: data.detail, show: true };
}); });
}; };
// check if current user is already a candidate (status=1) // check if current user is already a candidate (elected==false)
$scope.isCandidate = function () { $scope.isCandidate = function () {
var check = assignment.assignment_related_users.map( function(candidate) { var check = assignment.assignment_related_users.map( function(candidate) {
if ( candidate.status == 1) if ( !candidate.elected ) {
return candidate.user_id; return candidate.user_id;
}
}).indexOf(operator.user.id); }).indexOf(operator.user.id);
if (check > -1) if (check > -1)
return true; return true;

View File

@ -53,7 +53,7 @@
<div class="form-group"> <div class="form-group">
<alert ng-show="alert.show" type="{{ alert.type }}" ng-click="alert={}" close="alert={}"> <alert ng-show="alert.show" type="{{ alert.type }}" ng-click="alert={}" close="alert={}">
{{alert.msg}} {{ alert.msg }}
</alert> </alert>
<div os-perms="assignments.can_nominate_other" class="input-group"> <div os-perms="assignments.can_nominate_other" class="input-group">
<ui-select ng-model="candidateSelectBox.selected" ng-change="addCandidate(candidateSelectBox.selected.id)"> <ui-select ng-model="candidateSelectBox.selected" ng-change="addCandidate(candidateSelectBox.selected.id)">