Merge pull request #1724 from emanuelschuetze/project-item-fix

Added own isProjected function for Agenda factory (Fixes #1704)
This commit is contained in:
Oskar Hahn 2015-11-30 14:49:17 +01:00
commit aab8b28393

View File

@ -25,7 +25,8 @@ angular.module('OpenSlidesApp.agenda', ['OpenSlidesApp.users'])
'DS', 'DS',
'Speaker', 'Speaker',
'jsDataModel', 'jsDataModel',
function(DS, Speaker, jsDataModel) { 'Projector',
function(DS, Speaker, jsDataModel, Projector) {
var name = 'agenda/item'; var name = 'agenda/item';
return DS.defineResource({ return DS.defineResource({
name: name, name: name,
@ -54,6 +55,17 @@ angular.module('OpenSlidesApp.agenda', ['OpenSlidesApp.users'])
this.getContentResource().agendaSupplement || '' 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: { relations: {