diff --git a/CHANGELOG b/CHANGELOG index c09196ef0..4199cac69 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -15,6 +15,8 @@ Agenda: - Fixed multiple request on creation of agenda related items [#3341]. - Added possibility to mark speakers [#3570]. - New DOCX export of agenda [#3569]. +- Hide closed agenda items in the item slide [#3567]. +- Agenda is now collapsable for a better overview [#3567]. Motions: - New export dialog [#3185]. diff --git a/openslides/agenda/static/css/agenda/_projector.scss b/openslides/agenda/static/css/agenda/_projector.scss index ff956afe1..3546680d0 100644 --- a/openslides/agenda/static/css/agenda/_projector.scss +++ b/openslides/agenda/static/css/agenda/_projector.scss @@ -6,10 +6,6 @@ p { font-size: 140%; - - &.done { - color: #9a9898; - } } .mainitem { diff --git a/openslides/agenda/static/css/agenda/_site.scss b/openslides/agenda/static/css/agenda/_site.scss index 7553f648b..f5fb60b1b 100644 --- a/openslides/agenda/static/css/agenda/_site.scss +++ b/openslides/agenda/static/css/agenda/_site.scss @@ -2,12 +2,21 @@ #agenda-table { .icon-column { + padding: 3px; width: 5%; } .title-column { - padding: 0px 10px; - width: 95%; + padding-left: 3px; + padding-right: 10px; + width: calc(95% - 15px ); + } + + .caret-spacer { + width: 15px; + padding: 3px; + color: #337ab7; + font-size: 115%; } } diff --git a/openslides/agenda/static/js/agenda/base.js b/openslides/agenda/static/js/agenda/base.js index fa296f8be..f5a002e59 100644 --- a/openslides/agenda/static/js/agenda/base.js +++ b/openslides/agenda/static/js/agenda/base.js @@ -298,6 +298,7 @@ angular.module('OpenSlidesApp.agenda', ['OpenSlidesApp.users']) function generateFlatTree(tree, parentCount) { _.each(tree, function (item) { + item.item.childrenCount = item.children.length; item.item.parentCount = parentCount; flatItems.push(item.item); generateFlatTree(item.children, parentCount + 1); diff --git a/openslides/agenda/static/js/agenda/site.js b/openslides/agenda/static/js/agenda/site.js index cf29def52..4c2a38864 100644 --- a/openslides/agenda/static/js/agenda/site.js +++ b/openslides/agenda/static/js/agenda/site.js @@ -120,10 +120,7 @@ angular.module('OpenSlidesApp.agenda.site', [ return item.list_view_title; }); $scope.items = AgendaTree.getFlatTree(allowedItems); - var subitems = $filter('filter')($scope.items, {'parent_id': ''}); - if (subitems.length) { - $scope.agendaHasSubitems = true; - } + $scope.agendaHasSubitems = $filter('filter')($scope.items, {'parent_id': ''}).length; }); Projector.bindAll({}, $scope, 'projectors'); $scope.mainListTree = true; @@ -169,6 +166,12 @@ angular.module('OpenSlidesApp.agenda.site', [ }, }; + // Expand all items during searching. + $scope.filter.changed = function () { + $scope.collapseState = true; + $scope.toggleCollapseState(); + }; + // pagination $scope.pagination = osTablePagination.createInstance('AgendaTablePagination'); @@ -235,6 +238,14 @@ angular.module('OpenSlidesApp.agenda.site', [ } }; + // Agenda collapse function + $scope.toggleCollapseState = function () { + $scope.collapseState = !$scope.collapseState; + _.forEach($scope.items, function (item) { + item.hideChildren = $scope.collapseState; + }); + }; + /** Agenda item functions **/ // open dialog for new topics // TODO Remove this. Don't forget import button in template. $scope.newDialog = function () { @@ -278,6 +289,7 @@ angular.module('OpenSlidesApp.agenda.site', [ $scope.edit = function (item) { ngDialog.open(item.getContentObjectForm().getDialog({id: item.content_object.id})); }; + // export $scope.pdfExport = function () { AgendaPdfExport.export($scope.itemsFiltered); @@ -393,6 +405,33 @@ angular.module('OpenSlidesApp.agenda.site', [ } ]) +// filter to hide collapsed items. Items has to be a flat tree. +.filter('collapsedItemFilter', [ + function () { + return function (items) { + return _.filter(items, function (item) { + var index = _.findIndex(items, item); + var parentId = item.parent_id; + // Search for parents, if one has the hideChildren attribute set. All parents + // have a higher index as this item, because items is a flat tree. + // If a parent has this attribute, we should remove this item. Else if we hit + // the top or an item on the first layer, the item is not collapsed. + for (--index; index >= 0 && parentId !== null; index--) { + var p = items[index]; + if (p.id === parentId) { + if (p.hideChildren) { + return false; + } else { + parentId = p.parent_id; + } + } + } + return true; + }); + }; + } +]) + .controller('ItemDetailCtrl', [ '$scope', '$filter', diff --git a/openslides/agenda/static/templates/agenda/item-list.html b/openslides/agenda/static/templates/agenda/item-list.html index 6e974c87c..4617e7e47 100644 --- a/openslides/agenda/static/templates/agenda/item-list.html +++ b/openslides/agenda/static/templates/agenda/item-list.html @@ -148,6 +148,13 @@ + + · + + Expand all + Collapse all + +
@@ -232,6 +239,7 @@ | osFilter: filter.filterString : filter.getObjectQueryString | filter: {closed: filter.booleanFilters.closed.value} | filter: {is_hidden: filter.booleanFilters.is_hidden.value}) + | collapsedItemFilter | limitTo : pagination.itemsPerPage : pagination.limitBegin"> @@ -279,11 +287,18 @@
-
+
+
+ +
@@ -295,7 +310,8 @@
-
+
List of speakers · diff --git a/openslides/agenda/static/templates/agenda/slide-item-list.html b/openslides/agenda/static/templates/agenda/slide-item-list.html index 77c66810d..bcd1013bb 100644 --- a/openslides/agenda/static/templates/agenda/slide-item-list.html +++ b/openslides/agenda/static/templates/agenda/slide-item-list.html @@ -11,18 +11,18 @@