diff --git a/bower.json b/bower.json index 44c77e312..796dad8bc 100644 --- a/bower.json +++ b/bower.json @@ -13,7 +13,7 @@ "angular-csv-import": "~0.0.15", "angular-loading-bar": "~0.7.1", "angular-ui-router": "~0.2.13", - "angular-ui-select": "~0.11.2", + "angular-ui-select": "~0.12", "angular-ui-tree": "~2.2.0", "angular-gettext": "~2.0.2", "angular-sanitize": "~1.3.15", diff --git a/openslides/agenda/static/js/agenda/agenda.js b/openslides/agenda/static/js/agenda/agenda.js index 414bbcc84..b35c2750a 100644 --- a/openslides/agenda/static/js/agenda/agenda.js +++ b/openslides/agenda/static/js/agenda/agenda.js @@ -116,9 +116,33 @@ angular.module('OpenSlidesApp.agenda.site', ['OpenSlidesApp.agenda']) }; }) -.controller('ItemDetailCtrl', function($scope, Agenda, User, item) { +.controller('ItemDetailCtrl', function($scope, $http, Agenda, User, item) { Agenda.bindOne(item.id, $scope, 'item'); User.bindAll({}, $scope, 'users'); + $scope.speaker = {}; + $scope.alert = {}; + + // close/open list of speakers of current item + $scope.closeList = function (listClosed) { + item.speakerListClosed = 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; + }) + .error(function(data){ + $scope.alert = { type: 'danger', msg: data.detail, show: true }; + }); + }; + // 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})}); + }; }) .controller('ItemCreateCtrl', function($scope, $state, Agenda, types) { diff --git a/openslides/agenda/static/templates/agenda/item-detail.html b/openslides/agenda/static/templates/agenda/item-detail.html index a7267d2f5..1d7ed4ea1 100644 --- a/openslides/agenda/static/templates/agenda/item-detail.html +++ b/openslides/agenda/static/templates/agenda/item-detail.html @@ -31,26 +31,52 @@ -