From 589137ece73ec3d9c045504659ecbb61ad24454e Mon Sep 17 00:00:00 2001 From: Maximilian Krambach Date: Thu, 7 Jul 2016 13:33:18 +0200 Subject: [PATCH] add "delete all speakers" button (fixes #2210) --- CHANGELOG | 3 ++ openslides/agenda/static/js/agenda/site.js | 20 ++++++++++++ .../static/templates/agenda/item-detail.html | 6 ++++ openslides/agenda/views.py | 31 +++++++++++-------- 4 files changed, 47 insertions(+), 13 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 5cec85e26..261a8cfdd 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -8,6 +8,9 @@ Version 2.1 (unreleased) ======================== [https://github.com/OpenSlides/OpenSlides/milestones/2.1] +Agenda: +- Added button to remove all speakers from a list of speakers. + Core: - Used Django Channels instead of Tornado. - Added support for big assemblies with lots of users. diff --git a/openslides/agenda/static/js/agenda/site.js b/openslides/agenda/static/js/agenda/site.js index facc1341e..9e1794895 100644 --- a/openslides/agenda/static/js/agenda/site.js +++ b/openslides/agenda/static/js/agenda/site.js @@ -290,6 +290,26 @@ angular.module('OpenSlidesApp.agenda.site', ['OpenSlidesApp.agenda']) $scope.speakers = item.speakers; }; + //delete all speakers from list of speakers + $scope.removeAllSpeakers = function () { + var speakersOnList = []; + angular.forEach(item.speakers, function (speaker) { + speakersOnList.push(speaker.id); + }); + $http.delete( + '/rest/agenda/item/' + item.id + '/manage_speaker/', + {headers: {'Content-Type': 'application/json'}, + data: JSON.stringify({speaker: speakersOnList})} + ) + .success(function(data){ + $scope.speakers = item.speakers; + }) + .error(function(data){ + $scope.alert = { type: 'danger', msg: data.detail, show: true }; + }); + $scope.speakers = item.speakers; + }; + // check if user is allowed to see 'add me' / 'remove me' button $scope.isAllowed = function (action) { var nextUsers = []; diff --git a/openslides/agenda/static/templates/agenda/item-detail.html b/openslides/agenda/static/templates/agenda/item-detail.html index cbc1c4753..8af8ce460 100644 --- a/openslides/agenda/static/templates/agenda/item-detail.html +++ b/openslides/agenda/static/templates/agenda/item-detail.html @@ -37,6 +37,12 @@
+