2015-10-22 00:01:51 +02:00
|
|
|
(function () {
|
|
|
|
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
angular.module('OpenSlidesApp.agenda.projector', ['OpenSlidesApp.agenda'])
|
|
|
|
|
|
|
|
.config([
|
|
|
|
'slidesProvider',
|
|
|
|
function(slidesProvider) {
|
2016-01-09 10:53:43 +01:00
|
|
|
slidesProvider.registerSlide('agenda/list-of-speakers', {
|
|
|
|
template: 'static/templates/agenda/slide-list-of-speakers.html',
|
2015-10-22 00:01:51 +02:00
|
|
|
});
|
|
|
|
slidesProvider.registerSlide('agenda/item-list', {
|
|
|
|
template: 'static/templates/agenda/slide-item-list.html',
|
|
|
|
});
|
|
|
|
}
|
|
|
|
])
|
|
|
|
|
2016-01-09 10:53:43 +01:00
|
|
|
.controller('SlideListOfSpeakersCtrl', [
|
2015-10-22 00:01:51 +02:00
|
|
|
'$scope',
|
|
|
|
'Agenda',
|
|
|
|
'User',
|
|
|
|
function($scope, Agenda, User) {
|
|
|
|
// Attention! Each object that is used here has to be dealt on server side.
|
|
|
|
// Add it to the coresponding get_requirements method of the ProjectorElement
|
|
|
|
// class.
|
|
|
|
var id = $scope.element.id;
|
|
|
|
Agenda.find(id);
|
|
|
|
User.findAll();
|
|
|
|
Agenda.bindOne(id, $scope, 'item');
|
|
|
|
}
|
|
|
|
])
|
|
|
|
|
|
|
|
.controller('SlideItemListCtrl', [
|
|
|
|
'$scope',
|
|
|
|
'$http',
|
2016-02-24 21:01:52 +01:00
|
|
|
'$filter',
|
2015-10-22 00:01:51 +02:00
|
|
|
'Agenda',
|
|
|
|
'AgendaTree',
|
2016-02-24 21:01:52 +01:00
|
|
|
function($scope, $http, $filter, Agenda, AgendaTree) {
|
2015-10-22 00:01:51 +02:00
|
|
|
// Attention! Each object that is used here has to be dealt on server side.
|
|
|
|
// Add it to the coresponding get_requirements method of the ProjectorElement
|
|
|
|
// class.
|
|
|
|
Agenda.findAll();
|
|
|
|
// Bind agenda tree to the scope
|
|
|
|
$scope.$watch(function () {
|
|
|
|
return Agenda.lastModified();
|
|
|
|
}, function () {
|
2016-02-24 21:01:52 +01:00
|
|
|
if ($scope.element.id) {
|
|
|
|
$scope.rootItem = Agenda.get($scope.element.id);
|
|
|
|
var tree = AgendaTree.getFlatTree(Agenda.getAll());
|
|
|
|
var startIndex = tree.indexOf($scope.rootItem);
|
|
|
|
tree = tree.slice(startIndex);
|
|
|
|
// define delta to move the whole subtree to level 0
|
2016-03-02 16:51:40 +01:00
|
|
|
var parentCountDelta = 0;
|
2016-02-24 21:01:52 +01:00
|
|
|
if (tree[0]) {
|
2016-03-02 16:51:40 +01:00
|
|
|
parentCountDelta = tree[0].parentCount;
|
2016-02-24 21:01:52 +01:00
|
|
|
}
|
|
|
|
$scope.items = [];
|
|
|
|
for (var i = 1; i < tree.length; i++) {
|
|
|
|
if (tree[i].parentCount - parentCountDelta <= 0) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
var item = tree[i];
|
|
|
|
// move rootItem (and all childs) to level 0
|
|
|
|
item.parentCount = item.parentCount - parentCountDelta;
|
|
|
|
$scope.items.push(item);
|
|
|
|
}
|
|
|
|
} else if ($scope.element.tree) {
|
|
|
|
$scope.items = AgendaTree.getFlatTree(Agenda.getAll());
|
|
|
|
} else {
|
2016-03-18 22:00:50 +01:00
|
|
|
$scope.items = Agenda.filter({
|
|
|
|
where: { parent_id: null },
|
|
|
|
orderBy: 'weight'
|
|
|
|
});
|
2016-02-24 21:01:52 +01:00
|
|
|
}
|
2015-10-22 00:01:51 +02:00
|
|
|
});
|
|
|
|
}
|
|
|
|
]);
|
|
|
|
|
|
|
|
}());
|