Merge pull request #1827 from ostcar/fix_list_of_speaker_error_message

Remove item id from error message "{user} is already on the list of speakers."
This commit is contained in:
Oskar Hahn 2016-01-10 09:32:48 +01:00
commit f3fcb74aec
2 changed files with 41 additions and 33 deletions

View File

@ -302,8 +302,7 @@ class SpeakerManager(models.Manager):
"""
if self.filter(user=user, item=item, begin_time=None).exists():
raise OpenSlidesError(
_('%(user)s is already on the list of speakers of %(id)s.')
% {'user': user, 'id': item.id})
_('{user} is already on the list of speakers.').format(user=user)
if isinstance(user, AnonymousUser):
raise OpenSlidesError(
_('An anonymous user can not be on lists of speakers.'))

View File

@ -197,55 +197,63 @@ angular.module('OpenSlidesApp.agenda.site', ['OpenSlidesApp.agenda'])
}, function () {
$scope.speakers = $filter('orderBy')(item.speakers, 'weight');
});
// close/open list of speakers of current item
$scope.closeList = function (listClosed) {
item.speaker_list_closed = listClosed;
Agenda.save(item);
};
// add user to list of speakers
$scope.addSpeaker = function (userId) {
$http.post('/rest/agenda/item/' + item.id + '/manage_speaker/', {'user': userId})
.success(function(data){
$scope.alert.show = false;
$scope.speakers = item.speakers;
$scope.speakerSelectBox = {};
})
.error(function(data){
$scope.alert = { type: 'danger', msg: data.detail, show: true };
$scope.speakerSelectBox = {};
});
.success(function (data){
$scope.alert.show = false;
$scope.speakers = item.speakers;
$scope.speakerSelectBox = {};
})
.error(function (data){
$scope.alert = {type: 'danger', msg: data.detail, show: true};
$scope.speakerSelectBox = {};
});
};
// delete speaker(!) from list of speakers
$scope.removeSpeaker = function (speakerId) {
$http.delete('/rest/agenda/item/' + item.id + '/manage_speaker/',
{headers: {'Content-Type': 'application/json'},
data: JSON.stringify({speaker: speakerId})})
.success(function(data){
$scope.speakers = item.speakers;
})
.error(function(data){
$scope.alert = { type: 'danger', msg: data.detail, show: true };
});
$http.delete(
'/rest/agenda/item/' + item.id + '/manage_speaker/',
{headers: {'Content-Type': 'application/json'},
data: JSON.stringify({speaker: speakerId})}
)
.success(function(data){
$scope.speakers = item.speakers;
})
.error(function(data){
$scope.alert = { type: 'danger', msg: data.detail, show: true };
});
$scope.speakers = item.speakers;
};
// begin speech of selected/next speaker
$scope.beginSpeech = function (speakerId) {
$http.put('/rest/agenda/item/' + item.id + '/speak/', {'speaker': speakerId})
.success(function(data){
$scope.alert.show = false;
})
.error(function(data){
$scope.alert = { type: 'danger', msg: data.detail, show: true };
});
.success(function(data){
$scope.alert.show = false;
})
.error(function(data){
$scope.alert = { type: 'danger', msg: data.detail, show: true };
});
};
// end speech of current speaker
$scope.endSpeech = function () {
$http.delete('/rest/agenda/item/' + item.id + '/speak/',
{headers: {'Content-Type': 'application/json'},
data: JSON.stringify()})
.error(function(data){
$scope.alert = { type: 'danger', msg: data.detail, show: true };
});
$http.delete(
'/rest/agenda/item/' + item.id + '/speak/',
{headers: {'Content-Type': 'application/json'}, data: JSON.stringify()}
)
.error(function(data){
$scope.alert = { type: 'danger', msg: data.detail, show: true };
});
};
// save reordered list of speakers
$scope.treeOptions = {
@ -256,7 +264,8 @@ angular.module('OpenSlidesApp.agenda.site', ['OpenSlidesApp.agenda'])
sortedSpeakers.push(speaker.id);
});
$http.post('/rest/agenda/item/' + item.id + '/sort_speakers/',
{speakers: sortedSpeakers});
{speakers: sortedSpeakers}
);
}
};
}