diff --git a/openslides/agenda/static/js/agenda/base.js b/openslides/agenda/static/js/agenda/base.js index eee5c681d..e597b41d5 100644 --- a/openslides/agenda/static/js/agenda/base.js +++ b/openslides/agenda/static/js/agenda/base.js @@ -128,6 +128,17 @@ angular.module('OpenSlidesApp.agenda', ['OpenSlidesApp.users']) element.id == self.id; }; return typeof _.findKey(projector.elements, predicate) === 'string'; + }, + hasSubitems: function(items) { + var self = this; + var hasChild = false; + // Returns true if the item has at least one child item. + _.each(items, function (item) { + if (item.parent_id == self.id) { + hasChild = true; + } + }); + return hasChild; } }, relations: { diff --git a/openslides/agenda/static/js/agenda/site.js b/openslides/agenda/static/js/agenda/site.js index c27984a31..2828e8a2e 100644 --- a/openslides/agenda/static/js/agenda/site.js +++ b/openslides/agenda/static/js/agenda/site.js @@ -69,6 +69,7 @@ angular.module('OpenSlidesApp.agenda.site', ['OpenSlidesApp.agenda']) .controller('ItemListCtrl', [ '$scope', + '$filter', '$http', '$state', 'DS', @@ -78,12 +79,16 @@ angular.module('OpenSlidesApp.agenda.site', ['OpenSlidesApp.agenda']) 'CustomslideForm', 'AgendaTree', 'Projector', - function($scope, $http, $state, DS, operator, ngDialog, Agenda, CustomslideForm, AgendaTree, Projector) { + function($scope, $filter, $http, $state, DS, operator, ngDialog, Agenda, CustomslideForm, AgendaTree, Projector) { // Bind agenda tree to the scope $scope.$watch(function () { return Agenda.lastModified(); }, function () { $scope.items = AgendaTree.getFlatTree(Agenda.getAll()); + var subitems = $filter('filter')($scope.items, {'parent_id': ''}); + if (subitems.length) { + $scope.agendaHasSubitems = true; + } }); $scope.alert = {}; diff --git a/openslides/agenda/static/templates/agenda/item-list.html b/openslides/agenda/static/templates/agenda/item-list.html index 09d4d8948..9dd67fb8a 100644 --- a/openslides/agenda/static/templates/agenda/item-list.html +++ b/openslides/agenda/static/templates/agenda/item-list.html @@ -38,8 +38,8 @@ Select ... -
-