Agenda list slide improvements
- project summary of selected item - show full tree OR main agenda items only - show done items grey (without icon)
This commit is contained in:
parent
d3d73a019d
commit
a6be43809f
@ -80,7 +80,7 @@ angular.module('OpenSlidesApp.agenda', ['OpenSlidesApp.users'])
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
// override isProjected function of jsDataModel factory
|
// override isProjected function of jsDataModel factory
|
||||||
isProjected: function () {
|
isProjected: function (list) {
|
||||||
// Returns true if there is a projector element with the same
|
// Returns true if there is a projector element with the same
|
||||||
// name and the same id.
|
// name and the same id.
|
||||||
var projector = Projector.get(1);
|
var projector = Projector.get(1);
|
||||||
@ -88,9 +88,19 @@ angular.module('OpenSlidesApp.agenda', ['OpenSlidesApp.users'])
|
|||||||
if (typeof projector !== 'undefined') {
|
if (typeof projector !== 'undefined') {
|
||||||
var self = this;
|
var self = this;
|
||||||
var predicate = function (element) {
|
var predicate = function (element) {
|
||||||
return element.name == self.content_object.collection &&
|
var value;
|
||||||
typeof element.id !== 'undefined' &&
|
if (typeof list === 'undefined') {
|
||||||
element.id == self.content_object.id;
|
// Releated item detail slide
|
||||||
|
value = element.name == self.content_object.collection &&
|
||||||
|
typeof element.id !== 'undefined' &&
|
||||||
|
element.id == self.content_object.id;
|
||||||
|
} else {
|
||||||
|
// Item list slide for sub tree
|
||||||
|
value = element.name == 'agenda/item-list' &&
|
||||||
|
typeof element.id !== 'undefined' &&
|
||||||
|
element.id == self.id;
|
||||||
|
}
|
||||||
|
return value;
|
||||||
};
|
};
|
||||||
isProjected = typeof _.findKey(projector.elements, predicate) === 'string';
|
isProjected = typeof _.findKey(projector.elements, predicate) === 'string';
|
||||||
} else {
|
} else {
|
||||||
@ -186,21 +196,21 @@ angular.module('OpenSlidesApp.agenda', ['OpenSlidesApp.users'])
|
|||||||
return getChildren(parentItems);
|
return getChildren(parentItems);
|
||||||
},
|
},
|
||||||
|
|
||||||
// Returns a list of all items as a flat tree the attribute parentCount
|
// Returns a list of all items as a flat tree
|
||||||
getFlatTree: function(items) {
|
getFlatTree: function(items) {
|
||||||
var tree = this.getTree(items);
|
var tree = this.getTree(items);
|
||||||
var flatItems = [];
|
var flatItems = [];
|
||||||
|
|
||||||
function generateFatTree(tree, parentCount) {
|
function generateFlatTree(tree, parentCount) {
|
||||||
_.each(tree, function (item) {
|
_.each(tree, function (item) {
|
||||||
item.item.parentCount = parentCount;
|
item.item.parentCount = parentCount;
|
||||||
flatItems.push(item.item);
|
flatItems.push(item.item);
|
||||||
generateFatTree(item.children, parentCount + 1);
|
generateFlatTree(item.children, parentCount + 1);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
generateFatTree(tree, 0);
|
generateFlatTree(tree, 0);
|
||||||
return flatItems;
|
return flatItems;
|
||||||
},
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
])
|
])
|
||||||
|
@ -34,9 +34,10 @@ angular.module('OpenSlidesApp.agenda.projector', ['OpenSlidesApp.agenda'])
|
|||||||
.controller('SlideItemListCtrl', [
|
.controller('SlideItemListCtrl', [
|
||||||
'$scope',
|
'$scope',
|
||||||
'$http',
|
'$http',
|
||||||
|
'$filter',
|
||||||
'Agenda',
|
'Agenda',
|
||||||
'AgendaTree',
|
'AgendaTree',
|
||||||
function($scope, $http, Agenda, AgendaTree) {
|
function($scope, $http, $filter, Agenda, AgendaTree) {
|
||||||
// Attention! Each object that is used here has to be dealt on server side.
|
// Attention! Each object that is used here has to be dealt on server side.
|
||||||
// Add it to the coresponding get_requirements method of the ProjectorElement
|
// Add it to the coresponding get_requirements method of the ProjectorElement
|
||||||
// class.
|
// class.
|
||||||
@ -45,7 +46,30 @@ angular.module('OpenSlidesApp.agenda.projector', ['OpenSlidesApp.agenda'])
|
|||||||
$scope.$watch(function () {
|
$scope.$watch(function () {
|
||||||
return Agenda.lastModified();
|
return Agenda.lastModified();
|
||||||
}, function () {
|
}, function () {
|
||||||
$scope.items = AgendaTree.getFlatTree(Agenda.getAll());
|
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
|
||||||
|
if (tree[0]) {
|
||||||
|
var parentCountDelta = tree[0].parentCount;
|
||||||
|
}
|
||||||
|
$scope.items = [];
|
||||||
|
for (var i = 1; i < tree.length; i++) {
|
||||||
|
if (tree[i].parentCount - parentCountDelta <= 0) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
var item = tree[i];
|
||||||
|
// move rootItem (and all childs) to level 0
|
||||||
|
item.parentCount = item.parentCount - parentCountDelta;
|
||||||
|
$scope.items.push(item);
|
||||||
|
}
|
||||||
|
} else if ($scope.element.tree) {
|
||||||
|
$scope.items = AgendaTree.getFlatTree(Agenda.getAll());
|
||||||
|
} else {
|
||||||
|
$scope.items = $filter('filter')(Agenda.getAll(), {'parent_id': null});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
|
@ -178,19 +178,31 @@ angular.module('OpenSlidesApp.agenda.site', ['OpenSlidesApp.agenda'])
|
|||||||
};
|
};
|
||||||
|
|
||||||
// project agenda
|
// project agenda
|
||||||
$scope.projectAgenda = function () {
|
$scope.projectAgenda = function (tree, id) {
|
||||||
$http.post('/rest/core/projector/1/prune_elements/',
|
$http.post('/rest/core/projector/1/prune_elements/',
|
||||||
[{name: 'agenda/item-list'}]);
|
[{name: 'agenda/item-list', tree: tree, id: id}]);
|
||||||
};
|
};
|
||||||
// check if agenda is projected
|
// check if agenda is projected
|
||||||
$scope.isAgendaProjected = function () {
|
$scope.isAgendaProjected = function (tree) {
|
||||||
// Returns true if there is a projector element with the name
|
// Returns true if there is a projector element with the name
|
||||||
// 'agenda/item-list'.
|
// 'agenda/item-list'.
|
||||||
var projector = Projector.get(1);
|
var projector = Projector.get(1);
|
||||||
if (typeof projector === 'undefined') return false;
|
if (typeof projector === 'undefined') return false;
|
||||||
var self = this;
|
var self = this;
|
||||||
var predicate = function (element) {
|
var predicate = function (element) {
|
||||||
return element.name == 'agenda/item-list';
|
var value;
|
||||||
|
if (typeof tree === 'undefined') {
|
||||||
|
// only main agenda items
|
||||||
|
value = element.name == 'agenda/item-list' &&
|
||||||
|
typeof element.id === 'undefined' &&
|
||||||
|
!element.tree;
|
||||||
|
} else {
|
||||||
|
// tree with all agenda items
|
||||||
|
value = element.name == 'agenda/item-list' &&
|
||||||
|
typeof element.id === 'undefined' &&
|
||||||
|
element.tree;
|
||||||
|
}
|
||||||
|
return value;
|
||||||
};
|
};
|
||||||
return typeof _.findKey(projector.elements, predicate) === 'string';
|
return typeof _.findKey(projector.elements, predicate) === 'string';
|
||||||
};
|
};
|
||||||
|
@ -38,14 +38,26 @@
|
|||||||
<translate>Select ...</translate>
|
<translate>Select ...</translate>
|
||||||
</button>
|
</button>
|
||||||
<!-- project agenda button -->
|
<!-- project agenda button -->
|
||||||
<a os-perms="core.can_manage_projector"
|
<div class="btn-group" uib-dropdown>
|
||||||
class="btn btn-default"
|
<button os-perms="core.can_manage_projector"
|
||||||
title="{{ 'Project agenda' | translate }}"
|
type="button"
|
||||||
ng-click="projectAgenda()"
|
class="btn btn-default"
|
||||||
ng-class="{ 'btn-primary': isAgendaProjected() }">
|
title="{{ 'Project agenda' | translate }}"
|
||||||
<i class="fa fa-video-camera"></i>
|
ng-click="projectAgenda(tree=true)"
|
||||||
<translate>Agenda</translate>
|
ng-class="{ 'btn-primary': isAgendaProjected(tree=true) }">
|
||||||
</a>
|
<i class="fa fa-video-camera"></i>
|
||||||
|
<translate>Agenda</translate>
|
||||||
|
</button>
|
||||||
|
<button type="button" class="btn btn-default"
|
||||||
|
ng-class="{ 'btn-primary': isAgendaProjected() }"
|
||||||
|
uib-dropdown-toggle>
|
||||||
|
<span class="caret"></span>
|
||||||
|
</button>
|
||||||
|
<ul class="uib-dropdown-menu" role="menu" aria-labelledby="split-button">
|
||||||
|
<li role="menuitem"><a href="" ng-click="projectAgenda(tree=true)" translate>All agenda items (Default)</a>
|
||||||
|
<li role="menuitem"><a href="" ng-click="projectAgenda(tree=false)" translate>Only main agenda items</a>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
<!-- auto numbering button -->
|
<!-- auto numbering button -->
|
||||||
<a os-perms="core.can_manage_projector"
|
<a os-perms="core.can_manage_projector"
|
||||||
class="btn btn-default"
|
class="btn btn-default"
|
||||||
@ -123,12 +135,25 @@
|
|||||||
ng-class="{ 'activeline': item.isProjected(), 'selected': item.selected, 'hiddenrow': item.is_hidden}">
|
ng-class="{ 'activeline': item.isProjected(), 'selected': item.selected, 'hiddenrow': item.is_hidden}">
|
||||||
<!-- projector column -->
|
<!-- projector column -->
|
||||||
<td ng-show="!isDeleteMode" os-perms="core.can_manage_projector">
|
<td ng-show="!isDeleteMode" os-perms="core.can_manage_projector">
|
||||||
<a class="btn btn-default btn-sm"
|
<div class="btn-group" style="width:54px;" uib-dropdown>
|
||||||
ng-class="{ 'btn-primary': item.isProjected() }"
|
<button os-perms="core.can_manage_projector"
|
||||||
ng-click="item.project()"
|
type="button"
|
||||||
title="{{ 'Project item' | translate }}">
|
class="btn btn-default btn-sm"
|
||||||
<i class="fa fa-video-camera"></i>
|
title="{{ 'Project item' | translate }}"
|
||||||
</a>
|
ng-click="item.project()"
|
||||||
|
ng-class="{ 'btn-primary': item.isProjected() }">
|
||||||
|
<i class="fa fa-video-camera"></i>
|
||||||
|
</button>
|
||||||
|
<button type="button" class="btn btn-default btn-sm slimDropDown"
|
||||||
|
ng-class="{ 'btn-primary': item.isProjected(list=true) }"
|
||||||
|
uib-dropdown-toggle>
|
||||||
|
<span class="caret"></span>
|
||||||
|
</button>
|
||||||
|
<ul class="uib-dropdown-menu" role="menu" aria-labelledby="split-button">
|
||||||
|
<li role="menuitem"><a href="" ng-click="item.project()" translate>Project item (Default)</a>
|
||||||
|
<li role="menuitem"><a href="" ng-click="projectAgenda(tree=true, id=item.id)" translate>Project all sub items</a>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
<!-- delete selection column -->
|
<!-- delete selection column -->
|
||||||
<td ng-show="isDeleteMode" os-perms="agenda.can_manage" class="deleteColumn">
|
<td ng-show="isDeleteMode" os-perms="agenda.can_manage" class="deleteColumn">
|
||||||
<input type="checkbox" ng-model="item.selected">
|
<input type="checkbox" ng-model="item.selected">
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
<div ng-controller="SlideItemListCtrl" class="content scrollcontent">
|
<div ng-controller="SlideItemListCtrl" class="content scrollcontent">
|
||||||
<h1 translate>Agenda</h1>
|
<h1 ng-if="!element.id" translate>Agenda</h1>
|
||||||
|
<h1 ng-if="element.id">{{ rootItem.getTitle() }}</h1>
|
||||||
|
|
||||||
<div class="agendalist">
|
<div class="agendalist">
|
||||||
<!-- item type: AGENDA_ITEM = 1, HIDDEN_ITEM = 2 -->
|
<!-- item type: AGENDA_ITEM = 1, HIDDEN_ITEM = 2 -->
|
||||||
<p ng-repeat="item in items | filter: {type: 1}"
|
<p ng-repeat="item in items | filter: {type: 1}"
|
||||||
ng-class="item.parent_id ? 'subitem' : 'mainitem'">
|
ng-class="{mainitem: item.parentCount == 0, subitem: item.parentCount != 0, done: item.closed}">
|
||||||
<span ng-repeat="n in [].constructor(item.parentCount) track by $index"> </span>
|
<span ng-repeat="n in [].constructor(item.parentCount) track by $index"> </span>
|
||||||
{{ item.getListViewTitle() }}
|
{{ item.getListViewTitle() }}
|
||||||
<i ng-if="item.closed" class="fa fa-check"></i>
|
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -532,6 +532,11 @@ img {
|
|||||||
background-color: #317796;
|
background-color: #317796;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.slimDropDown {
|
||||||
|
padding-left: 4px !important;
|
||||||
|
padding-right: 4px !important;
|
||||||
|
}
|
||||||
|
|
||||||
.spacer, .spacer-top {
|
.spacer, .spacer-top {
|
||||||
margin-top: 7px;
|
margin-top: 7px;
|
||||||
}
|
}
|
||||||
|
@ -301,6 +301,9 @@ tr.elected td {
|
|||||||
.agendalist p {
|
.agendalist p {
|
||||||
font-size: 140%;
|
font-size: 140%;
|
||||||
}
|
}
|
||||||
|
.agendalist p.done {
|
||||||
|
color: #9a9898;
|
||||||
|
}
|
||||||
.agendalist .mainitem {
|
.agendalist .mainitem {
|
||||||
margin-top: 25px;
|
margin-top: 25px;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user