From 92719f2b31f17bd3759429090d5c001df7530abb Mon Sep 17 00:00:00 2001 From: Emanuel Schuetze Date: Wed, 25 Nov 2015 14:50:23 +0100 Subject: [PATCH] Added own isProjected function for Agenda factory Allow to check if an related content object item is projected. --- openslides/agenda/static/js/agenda/base.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/openslides/agenda/static/js/agenda/base.js b/openslides/agenda/static/js/agenda/base.js index 87e7cf4cc..18c36adb2 100644 --- a/openslides/agenda/static/js/agenda/base.js +++ b/openslides/agenda/static/js/agenda/base.js @@ -25,7 +25,8 @@ angular.module('OpenSlidesApp.agenda', ['OpenSlidesApp.users']) 'DS', 'Speaker', 'jsDataModel', - function(DS, Speaker, jsDataModel) { + 'Projector', + function(DS, Speaker, jsDataModel, Projector) { var name = 'agenda/item'; return DS.defineResource({ name: name, @@ -54,6 +55,17 @@ angular.module('OpenSlidesApp.agenda', ['OpenSlidesApp.users']) this.getContentResource().agendaSupplement || '' ) ); + }, + isProjected: function () { + var projector = Projector.get(1); + if (typeof projector === 'undefined') return false; + var self = this; + var predicate = function (element) { + return element.name == self.content_object.collection && + typeof element.id !== 'undefined' && + element.id == self.content_object.id; + }; + return typeof _.findKey(projector.elements, predicate) === 'string'; } }, relations: {