From 343ddf5ac517686d68950050761b9342cd7180be Mon Sep 17 00:00:00 2001 From: FinnStutzenstein Date: Thu, 28 Sep 2017 11:13:54 +0200 Subject: [PATCH] Fixed projecting subitems --- .../agenda/static/js/agenda/projector.js | 38 ++++++++++--------- .../templates/agenda/slide-item-list.html | 2 +- openslides/core/static/css/projector.css | 3 ++ 3 files changed, 24 insertions(+), 19 deletions(-) diff --git a/openslides/agenda/static/js/agenda/projector.js b/openslides/agenda/static/js/agenda/projector.js index 82ee55244..51333d36a 100644 --- a/openslides/agenda/static/js/agenda/projector.js +++ b/openslides/agenda/static/js/agenda/projector.js @@ -82,25 +82,27 @@ angular.module('OpenSlidesApp.agenda.projector', ['OpenSlidesApp.agenda']) return Agenda.lastModified(); }, function () { 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 - var parentCountDelta = 0; - if (tree[0]) { - parentCountDelta = tree[0].parentCount; - } - $scope.items = []; - for (var i = 1; i < tree.length; i++) { - if (tree[i].parentCount - parentCountDelta <= 0) { - break; + var tree = AgendaTree.getTree(Agenda.getAll()); + + var getRootNode = function (node) { + if (node.id == $scope.element.id) { + return node; } - var item = tree[i]; - // move rootItem (and all childs) to level 0 - item.parentCount = item.parentCount - parentCountDelta; - $scope.items.push(item); - } + for (var i = 0; i < node.children.length; i++) { + var result = getRootNode(node.children[i]); + if (result) { + return result; + } + } + return false; + }; + _.forEach(tree, function (node) { + var result = getRootNode(node); + if (result) { + $scope.rootItem = result.item; + $scope.tree = result.children; + } + }); } else if ($scope.element.tree) { items = _.filter(Agenda.getAll(), function (item) { return item.type === 1; diff --git a/openslides/agenda/static/templates/agenda/slide-item-list.html b/openslides/agenda/static/templates/agenda/slide-item-list.html index 283ddab12..85281ff69 100644 --- a/openslides/agenda/static/templates/agenda/slide-item-list.html +++ b/openslides/agenda/static/templates/agenda/slide-item-list.html @@ -2,7 +2,7 @@

Agenda

{{ rootItem.getTitle() }}

-
+
diff --git a/openslides/core/static/css/projector.css b/openslides/core/static/css/projector.css index bc8d75012..7637b808f 100644 --- a/openslides/core/static/css/projector.css +++ b/openslides/core/static/css/projector.css @@ -408,6 +408,9 @@ tr.elected td { .spacer { margin-top: 10px; } +.spacer-left-lg { + margin-left: 20px; +} .agendalist-table td { vertical-align: top;