diff --git a/openslides/agenda/static/js/agenda/base.js b/openslides/agenda/static/js/agenda/base.js
index ff58ee2f3..eee5c681d 100644
--- a/openslides/agenda/static/js/agenda/base.js
+++ b/openslides/agenda/static/js/agenda/base.js
@@ -80,7 +80,7 @@ angular.module('OpenSlidesApp.agenda', ['OpenSlidesApp.users'])
);
},
// override isProjected function of jsDataModel factory
- isProjected: function () {
+ isProjected: function (list) {
// Returns true if there is a projector element with the same
// name and the same id.
var projector = Projector.get(1);
@@ -88,9 +88,19 @@ angular.module('OpenSlidesApp.agenda', ['OpenSlidesApp.users'])
if (typeof projector !== 'undefined') {
var self = this;
var predicate = function (element) {
- return element.name == self.content_object.collection &&
- typeof element.id !== 'undefined' &&
- element.id == self.content_object.id;
+ var value;
+ if (typeof list === 'undefined') {
+ // Releated item detail slide
+ value = element.name == self.content_object.collection &&
+ typeof element.id !== 'undefined' &&
+ element.id == self.content_object.id;
+ } else {
+ // Item list slide for sub tree
+ value = element.name == 'agenda/item-list' &&
+ typeof element.id !== 'undefined' &&
+ element.id == self.id;
+ }
+ return value;
};
isProjected = typeof _.findKey(projector.elements, predicate) === 'string';
} else {
@@ -186,21 +196,21 @@ angular.module('OpenSlidesApp.agenda', ['OpenSlidesApp.users'])
return getChildren(parentItems);
},
- // Returns a list of all items as a flat tree the attribute parentCount
+ // Returns a list of all items as a flat tree
getFlatTree: function(items) {
var tree = this.getTree(items);
var flatItems = [];
- function generateFatTree(tree, parentCount) {
+ function generateFlatTree(tree, parentCount) {
_.each(tree, function (item) {
item.item.parentCount = parentCount;
flatItems.push(item.item);
- generateFatTree(item.children, parentCount + 1);
+ generateFlatTree(item.children, parentCount + 1);
});
}
- generateFatTree(tree, 0);
+ generateFlatTree(tree, 0);
return flatItems;
- },
+ }
};
}
])
diff --git a/openslides/agenda/static/js/agenda/projector.js b/openslides/agenda/static/js/agenda/projector.js
index 87a662589..80577f81b 100644
--- a/openslides/agenda/static/js/agenda/projector.js
+++ b/openslides/agenda/static/js/agenda/projector.js
@@ -34,9 +34,10 @@ angular.module('OpenSlidesApp.agenda.projector', ['OpenSlidesApp.agenda'])
.controller('SlideItemListCtrl', [
'$scope',
'$http',
+ '$filter',
'Agenda',
'AgendaTree',
- function($scope, $http, Agenda, AgendaTree) {
+ function($scope, $http, $filter, Agenda, AgendaTree) {
// 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.
@@ -45,7 +46,30 @@ angular.module('OpenSlidesApp.agenda.projector', ['OpenSlidesApp.agenda'])
$scope.$watch(function () {
return Agenda.lastModified();
}, function () {
- $scope.items = AgendaTree.getFlatTree(Agenda.getAll());
+ 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
+ if (tree[0]) {
+ var parentCountDelta = tree[0].parentCount;
+ }
+ $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 {
+ $scope.items = $filter('filter')(Agenda.getAll(), {'parent_id': null});
+ }
});
}
]);
diff --git a/openslides/agenda/static/js/agenda/site.js b/openslides/agenda/static/js/agenda/site.js
index 490677f9a..c27984a31 100644
--- a/openslides/agenda/static/js/agenda/site.js
+++ b/openslides/agenda/static/js/agenda/site.js
@@ -178,19 +178,31 @@ angular.module('OpenSlidesApp.agenda.site', ['OpenSlidesApp.agenda'])
};
// project agenda
- $scope.projectAgenda = function () {
+ $scope.projectAgenda = function (tree, id) {
$http.post('/rest/core/projector/1/prune_elements/',
- [{name: 'agenda/item-list'}]);
+ [{name: 'agenda/item-list', tree: tree, id: id}]);
};
// check if agenda is projected
- $scope.isAgendaProjected = function () {
+ $scope.isAgendaProjected = function (tree) {
// Returns true if there is a projector element with the name
// 'agenda/item-list'.
var projector = Projector.get(1);
if (typeof projector === 'undefined') return false;
var self = this;
var predicate = function (element) {
- return element.name == 'agenda/item-list';
+ var value;
+ if (typeof tree === 'undefined') {
+ // only main agenda items
+ value = element.name == 'agenda/item-list' &&
+ typeof element.id === 'undefined' &&
+ !element.tree;
+ } else {
+ // tree with all agenda items
+ value = element.name == 'agenda/item-list' &&
+ typeof element.id === 'undefined' &&
+ element.tree;
+ }
+ return value;
};
return typeof _.findKey(projector.elements, predicate) === 'string';
};
diff --git a/openslides/agenda/static/templates/agenda/item-list.html b/openslides/agenda/static/templates/agenda/item-list.html
index b2b856df8..09d4d8948 100644
--- a/openslides/agenda/static/templates/agenda/item-list.html
+++ b/openslides/agenda/static/templates/agenda/item-list.html
@@ -38,14 +38,26 @@
+ ng-class="{mainitem: item.parentCount == 0, subitem: item.parentCount != 0, done: item.closed}"> {{ item.getListViewTitle() }} -
Permissions:
-