call the own project method from a content object of an agenda item

This commit is contained in:
FinnStutzenstein 2017-06-21 15:09:38 +02:00
parent 573fc4da57
commit ef60f5ea44

View File

@ -153,19 +153,26 @@ angular.module('OpenSlidesApp.agenda', ['OpenSlidesApp.users'])
}, },
// override project function of jsDataModel factory // override project function of jsDataModel factory
project: function (projectorId, tree) { project: function (projectorId, tree) {
if (tree) {
var isProjectedIds = this.isProjected(tree); var isProjectedIds = this.isProjected(tree);
_.forEach(isProjectedIds, function (id) { _.forEach(isProjectedIds, function (id) {
$http.post('/rest/core/projector/' + id + '/clear_elements/'); $http.post('/rest/core/projector/' + id + '/clear_elements/');
}); });
// Activate, if the projector_id is a new projector. // Activate, if the projector_id is a new projector.
if (_.indexOf(isProjectedIds, projectorId) == -1) { if (_.indexOf(isProjectedIds, projectorId) == -1) {
var name = tree ? 'agenda/item-list' : this.content_object.collection;
var id = tree ? this.id : this.content_object.id;
return $http.post( return $http.post(
'/rest/core/projector/' + projectorId + '/prune_elements/', '/rest/core/projector/' + projectorId + '/prune_elements/',
[{name: name, tree: tree, id: id}] [{
name: 'agenda/item-list',
tree: true,
id: this.id
}]
); );
} }
} else { // Project the content object
var contentObject = DS.get(this.content_object.collection, this.content_object.id);
contentObject.project(projectorId);
}
}, },
// override isProjected function of jsDataModel factory // override isProjected function of jsDataModel factory
isProjected: function (tree) { isProjected: function (tree) {