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;
};
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: {

View File

@ -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 = {};

View File

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

View File

@ -5,7 +5,7 @@
<!-- live view -->
<div class="section" os-perms="core.can_see_projector">
<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>
</a>
<div uib-collapse="isLiveViewClosed" ng-cloak>