diff --git a/app/coffee/modules/controllerMixins.coffee b/app/coffee/modules/controllerMixins.coffee index 08d0ac50..bf0290b7 100644 --- a/app/coffee/modules/controllerMixins.coffee +++ b/app/coffee/modules/controllerMixins.coffee @@ -221,6 +221,10 @@ class UsFiltersMixin it.id = it.name return it + + tagsWithAtLeastOneElement = _.filter tags, (tag) -> + return tag.count > 0 + assignedTo = _.map data.assigned_to, (it) -> if it.id it.id = it.id.toString() @@ -266,7 +270,8 @@ class UsFiltersMixin title: @translate.instant("COMMON.FILTERS.CATEGORIES.TAGS"), dataType: "tags", content: tags, - hideEmpty: true + hideEmpty: true, + totalTaggedElements: tagsWithAtLeastOneElement.length }, { title: @translate.instant("COMMON.FILTERS.CATEGORIES.ASSIGNED_TO"), diff --git a/app/coffee/modules/issues/list.coffee b/app/coffee/modules/issues/list.coffee index c1172408..81b577a5 100644 --- a/app/coffee/modules/issues/list.coffee +++ b/app/coffee/modules/issues/list.coffee @@ -188,6 +188,10 @@ class IssuesController extends mixOf(taiga.Controller, taiga.PageMixin, taiga.Fi it.id = it.name return it + + tagsWithAtLeastOneElement = _.filter tags, (tag) -> + return tag.count > 0 + assignedTo = _.map data.assigned_to, (it) -> if it.id it.id = it.id.toString() @@ -259,7 +263,9 @@ class IssuesController extends mixOf(taiga.Controller, taiga.PageMixin, taiga.Fi { title: @translate.instant("COMMON.FILTERS.CATEGORIES.TAGS"), dataType: "tags", - content: tags + content: tags, + hideEmpty: true, + totalTaggedElements: tagsWithAtLeastOneElement.length }, { title: @translate.instant("COMMON.FILTERS.CATEGORIES.ASSIGNED_TO"), diff --git a/app/coffee/modules/taskboard/main.coffee b/app/coffee/modules/taskboard/main.coffee index 1a13a106..97252b9b 100644 --- a/app/coffee/modules/taskboard/main.coffee +++ b/app/coffee/modules/taskboard/main.coffee @@ -160,6 +160,10 @@ class TaskboardController extends mixOf(taiga.Controller, taiga.PageMixin, taiga it.id = it.name return it + + tagsWithAtLeastOneElement = _.filter tags, (tag) -> + return tag.count > 0 + assignedTo = _.map data.assigned_to, (it) -> if it.id it.id = it.id.toString() @@ -205,7 +209,8 @@ class TaskboardController extends mixOf(taiga.Controller, taiga.PageMixin, taiga title: @translate.instant("COMMON.FILTERS.CATEGORIES.TAGS"), dataType: "tags", content: tags, - hideEmpty: true + hideEmpty: true, + totalTaggedElements: tagsWithAtLeastOneElement.length }, { title: @translate.instant("COMMON.FILTERS.CATEGORIES.ASSIGNED_TO"), diff --git a/app/modules/components/filter/filter.jade b/app/modules/components/filter/filter.jade index 05760586..db7f53b1 100644 --- a/app/modules/components/filter/filter.jade +++ b/app/modules/components/filter/filter.jade @@ -49,7 +49,9 @@ form li( ng-class="{selected: vm.isOpen(filter.dataType)}" ng-repeat="filter in vm.filters track by filter.dataType" + ng-if="!(filter.hideEmpty && filter.totalTaggedElements === 0)" ) + a.filters-cat-single.e2e-category( ng-class="{selected: vm.isOpen(filter.dataType)}" ng-click="vm.toggleFilterCategory(filter.dataType)" @@ -78,7 +80,11 @@ form span.name(ng-attr-style="{{it.color ? 'border-left: 3px solid ' + it.color: ''}}") {{it.name}} span.number.e2e-filter-count(ng-if="it.count > 0") {{it.count}} - li.custom-filters.e2e-custom-filters(ng-class="{selected: vm.isOpen('custom-filter')}") + li.custom-filters.e2e-custom-filters( + ng-class="{selected: vm.isOpen('custom-filter')}" + ng-if="vm.customFilters.length > 0" + ) + a.filters-cat-single( ng-class="{selected: vm.isOpen('custom-filter')}" ng-click="vm.toggleFilterCategory('custom-filter')"