From 7029852043e9b26deebd667c627b41b2753a52cd Mon Sep 17 00:00:00 2001 From: Emanuel Schuetze Date: Wed, 2 Mar 2016 14:38:05 +0100 Subject: [PATCH] Template fixes - switch projector live view minimize/maximize buttons - show agenda/item split buttons (project only main agenda items, project subitem) only if subitems are available --- openslides/agenda/static/js/agenda/base.js | 11 +++++++++++ openslides/agenda/static/js/agenda/site.js | 7 ++++++- .../agenda/static/templates/agenda/item-list.html | 6 ++++-- .../static/templates/core/projector-controls.html | 2 +- 4 files changed, 22 insertions(+), 4 deletions(-) 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 ... -
-