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,11 +197,13 @@ 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})
@ -215,11 +217,14 @@ angular.module('OpenSlidesApp.agenda.site', ['OpenSlidesApp.agenda'])
$scope.speakerSelectBox = {};
});
};
// delete speaker(!) from list of speakers
$scope.removeSpeaker = function (speakerId) {
$http.delete('/rest/agenda/item/' + item.id + '/manage_speaker/',
$http.delete(
'/rest/agenda/item/' + item.id + '/manage_speaker/',
{headers: {'Content-Type': 'application/json'},
data: JSON.stringify({speaker: speakerId})})
data: JSON.stringify({speaker: speakerId})}
)
.success(function(data){
$scope.speakers = item.speakers;
})
@ -228,6 +233,7 @@ angular.module('OpenSlidesApp.agenda.site', ['OpenSlidesApp.agenda'])
});
$scope.speakers = item.speakers;
};
// begin speech of selected/next speaker
$scope.beginSpeech = function (speakerId) {
$http.put('/rest/agenda/item/' + item.id + '/speak/', {'speaker': speakerId})
@ -238,11 +244,13 @@ angular.module('OpenSlidesApp.agenda.site', ['OpenSlidesApp.agenda'])
$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()})
$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 };
});
@ -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}
);
}
};
}