diff --git a/openslides/agenda/static/js/agenda/base.js b/openslides/agenda/static/js/agenda/base.js
index 12da9bc59..40053d9e7 100644
--- a/openslides/agenda/static/js/agenda/base.js
+++ b/openslides/agenda/static/js/agenda/base.js
@@ -22,12 +22,13 @@ angular.module('OpenSlidesApp.agenda', ['OpenSlidesApp.users'])
])
.factory('Agenda', [
+ '$http',
'DS',
'Speaker',
'jsDataModel',
'Projector',
'gettextCatalog',
- function(DS, Speaker, jsDataModel, Projector, gettextCatalog) {
+ function($http, DS, Speaker, jsDataModel, Projector, gettextCatalog) {
var name = 'agenda/item';
return DS.defineResource({
name: name,
@@ -56,6 +57,14 @@ angular.module('OpenSlidesApp.agenda', ['OpenSlidesApp.users'])
}
return title;
},
+ // override project function of jsDataModel factory
+ project: function() {
+ return $http.post(
+ '/rest/core/projector/1/prune_elements/',
+ [{name: this.content_object.collection, id: this.content_object.id}]
+ );
+ },
+ // override isProjected function of jsDataModel factory
isProjected: function () {
var projector = Projector.get(1);
if (typeof projector === 'undefined') return false;
@@ -66,6 +75,27 @@ angular.module('OpenSlidesApp.agenda', ['OpenSlidesApp.users'])
element.id == self.content_object.id;
};
return typeof _.findKey(projector.elements, predicate) === 'string';
+ },
+ // project list of speakers
+ projectListOfSpeakers: function() {
+ return $http.post(
+ '/rest/core/projector/1/prune_elements/',
+ [{name: 'agenda/item', id: this.id, list_of_speakers: true}]
+ );
+ },
+ // check if list of speakers is projected
+ isListOfSpeakersProjected: function () {
+ // Returns true if there is a projector element with the same
+ // name and agenda is active.
+ var projector = Projector.get(1);
+ if (typeof projector === 'undefined') return false;
+ var self = this;
+ var predicate = function (element) {
+ return element.name == 'agenda/item' &&
+ element.id == self.id &&
+ element.list_of_speakers;
+ };
+ return typeof _.findKey(projector.elements, predicate) === 'string';
}
},
relations: {
diff --git a/openslides/agenda/static/js/agenda/site.js b/openslides/agenda/static/js/agenda/site.js
index 42f6766d4..075c55d1c 100644
--- a/openslides/agenda/static/js/agenda/site.js
+++ b/openslides/agenda/static/js/agenda/site.js
@@ -86,15 +86,6 @@ angular.module('OpenSlidesApp.agenda.site', ['OpenSlidesApp.agenda'])
$scope.alert = {};
$scope.isFilter = true;
- // project related item (content object)
- $scope.project = function (item) {
- item.getContentResource().find(item.content_object.id).then(
- function(object) {
- object.project();
- }
- );
- };
-
// open new dialog
$scope.newDialog = function () {
ngDialog.open({
@@ -244,11 +235,6 @@ angular.module('OpenSlidesApp.agenda.site', ['OpenSlidesApp.agenda'])
$scope.alert = { type: 'danger', msg: data.detail, show: true };
});
};
- // project list of speakers
- $scope.projectListOfSpeakers = function () {
- $http.post('/rest/core/projector/1/prune_elements/',
- [{name: 'agenda/item', id: item.id, list_of_speakers: true}]);
- };
}
])
diff --git a/openslides/agenda/static/templates/agenda/item-detail.html b/openslides/agenda/static/templates/agenda/item-detail.html
index 213896fcb..876dd642e 100644
--- a/openslides/agenda/static/templates/agenda/item-detail.html
+++ b/openslides/agenda/static/templates/agenda/item-detail.html
@@ -5,10 +5,10 @@