Project related object (Fixes #1704)
- Override generic project and isProjected function in agenda. - Fix project and isProjected function for list of speakers and move to jsDataModel of Agenda.
This commit is contained in:
parent
5e3ff74575
commit
7bffeba93e
@ -22,12 +22,13 @@ angular.module('OpenSlidesApp.agenda', ['OpenSlidesApp.users'])
|
|||||||
])
|
])
|
||||||
|
|
||||||
.factory('Agenda', [
|
.factory('Agenda', [
|
||||||
|
'$http',
|
||||||
'DS',
|
'DS',
|
||||||
'Speaker',
|
'Speaker',
|
||||||
'jsDataModel',
|
'jsDataModel',
|
||||||
'Projector',
|
'Projector',
|
||||||
'gettextCatalog',
|
'gettextCatalog',
|
||||||
function(DS, Speaker, jsDataModel, Projector, gettextCatalog) {
|
function($http, DS, Speaker, jsDataModel, Projector, gettextCatalog) {
|
||||||
var name = 'agenda/item';
|
var name = 'agenda/item';
|
||||||
return DS.defineResource({
|
return DS.defineResource({
|
||||||
name: name,
|
name: name,
|
||||||
@ -56,6 +57,14 @@ angular.module('OpenSlidesApp.agenda', ['OpenSlidesApp.users'])
|
|||||||
}
|
}
|
||||||
return title;
|
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 () {
|
isProjected: function () {
|
||||||
var projector = Projector.get(1);
|
var projector = Projector.get(1);
|
||||||
if (typeof projector === 'undefined') return false;
|
if (typeof projector === 'undefined') return false;
|
||||||
@ -66,6 +75,27 @@ angular.module('OpenSlidesApp.agenda', ['OpenSlidesApp.users'])
|
|||||||
element.id == self.content_object.id;
|
element.id == self.content_object.id;
|
||||||
};
|
};
|
||||||
return typeof _.findKey(projector.elements, predicate) === 'string';
|
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: {
|
relations: {
|
||||||
|
@ -86,15 +86,6 @@ angular.module('OpenSlidesApp.agenda.site', ['OpenSlidesApp.agenda'])
|
|||||||
$scope.alert = {};
|
$scope.alert = {};
|
||||||
$scope.isFilter = true;
|
$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
|
// open new dialog
|
||||||
$scope.newDialog = function () {
|
$scope.newDialog = function () {
|
||||||
ngDialog.open({
|
ngDialog.open({
|
||||||
@ -244,11 +235,6 @@ angular.module('OpenSlidesApp.agenda.site', ['OpenSlidesApp.agenda'])
|
|||||||
$scope.alert = { type: 'danger', msg: data.detail, show: true };
|
$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}]);
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
])
|
])
|
||||||
|
|
||||||
|
@ -5,10 +5,10 @@
|
|||||||
<i class="fa fa-angle-double-left fa-lg"></i>
|
<i class="fa fa-angle-double-left fa-lg"></i>
|
||||||
<translate>Back to agenda</translate>
|
<translate>Back to agenda</translate>
|
||||||
</a>
|
</a>
|
||||||
<!-- TODO: project list
|
<!-- project list of speakers -->
|
||||||
ng-class="{ 'btn-primary': item.isListOfSpeakersProjected() }"-->
|
|
||||||
<a os-perms="core.can_manage_projector" class="btn btn-default btn-sm"
|
<a os-perms="core.can_manage_projector" class="btn btn-default btn-sm"
|
||||||
ng-click="projectListOfSpeakers()">
|
ng-class="{ 'btn-primary': item.isListOfSpeakersProjected() }"
|
||||||
|
ng-click="item.projectListOfSpeakers()">
|
||||||
<i class="fa fa-video-camera"></i>
|
<i class="fa fa-video-camera"></i>
|
||||||
<translate>List of speakers</translate>
|
<translate>List of speakers</translate>
|
||||||
</a>
|
</a>
|
||||||
|
@ -123,7 +123,7 @@
|
|||||||
<td ng-show="!isDeleteMode" os-perms="core.can_manage_projector">
|
<td ng-show="!isDeleteMode" os-perms="core.can_manage_projector">
|
||||||
<a class="btn btn-default btn-sm"
|
<a class="btn btn-default btn-sm"
|
||||||
ng-class="{ 'btn-primary': item.isProjected() }"
|
ng-class="{ 'btn-primary': item.isProjected() }"
|
||||||
ng-click="project(item)"
|
ng-click="item.project()"
|
||||||
title="{{ 'Project item' | translate }}">
|
title="{{ 'Project item' | translate }}">
|
||||||
<i class="fa fa-video-camera"></i>
|
<i class="fa fa-video-camera"></i>
|
||||||
</a>
|
</a>
|
||||||
|
Loading…
Reference in New Issue
Block a user