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
This commit is contained in:
Emanuel Schuetze 2016-03-02 14:38:05 +01:00
parent f3e59d3d04
commit 7029852043
4 changed files with 22 additions and 4 deletions

View File

@ -128,6 +128,17 @@ angular.module('OpenSlidesApp.agenda', ['OpenSlidesApp.users'])
element.id == self.id; element.id == self.id;
}; };
return typeof _.findKey(projector.elements, predicate) === 'string'; 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: { relations: {

View File

@ -69,6 +69,7 @@ angular.module('OpenSlidesApp.agenda.site', ['OpenSlidesApp.agenda'])
.controller('ItemListCtrl', [ .controller('ItemListCtrl', [
'$scope', '$scope',
'$filter',
'$http', '$http',
'$state', '$state',
'DS', 'DS',
@ -78,12 +79,16 @@ angular.module('OpenSlidesApp.agenda.site', ['OpenSlidesApp.agenda'])
'CustomslideForm', 'CustomslideForm',
'AgendaTree', 'AgendaTree',
'Projector', '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 // Bind agenda tree to the scope
$scope.$watch(function () { $scope.$watch(function () {
return Agenda.lastModified(); return Agenda.lastModified();
}, function () { }, function () {
$scope.items = AgendaTree.getFlatTree(Agenda.getAll()); $scope.items = AgendaTree.getFlatTree(Agenda.getAll());
var subitems = $filter('filter')($scope.items, {'parent_id': ''});
if (subitems.length) {
$scope.agendaHasSubitems = true;
}
}); });
$scope.alert = {}; $scope.alert = {};

View File

@ -38,8 +38,8 @@
<translate>Select ...</translate> <translate>Select ...</translate>
</button> </button>
<!-- project agenda button --> <!-- project agenda button -->
<div class="btn-group" uib-dropdown> <div os-perms="core.can_manage_projector" class="btn-group" uib-dropdown>
<button os-perms="core.can_manage_projector" <button
type="button" type="button"
class="btn btn-default" class="btn btn-default"
title="{{ 'Project agenda' | translate }}" title="{{ 'Project agenda' | translate }}"
@ -49,6 +49,7 @@
<translate>Agenda</translate> <translate>Agenda</translate>
</button> </button>
<button type="button" class="btn btn-default" <button type="button" class="btn btn-default"
ng-if="agendaHasSubitems"
ng-class="{ 'btn-primary': isAgendaProjected() }" ng-class="{ 'btn-primary': isAgendaProjected() }"
uib-dropdown-toggle> uib-dropdown-toggle>
<span class="caret"></span> <span class="caret"></span>
@ -145,6 +146,7 @@
<i class="fa fa-video-camera"></i> <i class="fa fa-video-camera"></i>
</button> </button>
<button type="button" class="btn btn-default btn-sm slimDropDown" <button type="button" class="btn btn-default btn-sm slimDropDown"
ng-if="item.hasSubitems(items)"
ng-class="{ 'btn-primary': item.isProjected(list=true) }" ng-class="{ 'btn-primary': item.isProjected(list=true) }"
uib-dropdown-toggle> uib-dropdown-toggle>
<span class="caret"></span> <span class="caret"></span>

View File

@ -5,7 +5,7 @@
<!-- live view --> <!-- live view -->
<div class="section" os-perms="core.can_see_projector"> <div class="section" os-perms="core.can_see_projector">
<a href="#" ng-click="isLiveViewClosed = !isLiveViewClosed"> <a href="#" ng-click="isLiveViewClosed = !isLiveViewClosed">
<i class="fa toggle-icon" ng-class="isLiveViewClosed ? 'fa-angle-up' : 'fa-angle-down'"></i> <i class="fa toggle-icon" ng-class="isLiveViewClosed ? 'fa-angle-down' : 'fa-angle-up'"></i>
<h4 translate>Live view</h4> <h4 translate>Live view</h4>
</a> </a>
<div uib-collapse="isLiveViewClosed" ng-cloak> <div uib-collapse="isLiveViewClosed" ng-cloak>