Hidding filters when empty
parent
2cc8b2e458
commit
dd72cc8807
|
@ -221,6 +221,10 @@ class UsFiltersMixin
|
||||||
it.id = it.name
|
it.id = it.name
|
||||||
|
|
||||||
return it
|
return it
|
||||||
|
|
||||||
|
tagsWithAtLeastOneElement = _.filter tags, (tag) ->
|
||||||
|
return tag.count > 0
|
||||||
|
|
||||||
assignedTo = _.map data.assigned_to, (it) ->
|
assignedTo = _.map data.assigned_to, (it) ->
|
||||||
if it.id
|
if it.id
|
||||||
it.id = it.id.toString()
|
it.id = it.id.toString()
|
||||||
|
@ -266,7 +270,8 @@ class UsFiltersMixin
|
||||||
title: @translate.instant("COMMON.FILTERS.CATEGORIES.TAGS"),
|
title: @translate.instant("COMMON.FILTERS.CATEGORIES.TAGS"),
|
||||||
dataType: "tags",
|
dataType: "tags",
|
||||||
content: tags,
|
content: tags,
|
||||||
hideEmpty: true
|
hideEmpty: true,
|
||||||
|
totalTaggedElements: tagsWithAtLeastOneElement.length
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: @translate.instant("COMMON.FILTERS.CATEGORIES.ASSIGNED_TO"),
|
title: @translate.instant("COMMON.FILTERS.CATEGORIES.ASSIGNED_TO"),
|
||||||
|
|
|
@ -188,6 +188,10 @@ class IssuesController extends mixOf(taiga.Controller, taiga.PageMixin, taiga.Fi
|
||||||
it.id = it.name
|
it.id = it.name
|
||||||
|
|
||||||
return it
|
return it
|
||||||
|
|
||||||
|
tagsWithAtLeastOneElement = _.filter tags, (tag) ->
|
||||||
|
return tag.count > 0
|
||||||
|
|
||||||
assignedTo = _.map data.assigned_to, (it) ->
|
assignedTo = _.map data.assigned_to, (it) ->
|
||||||
if it.id
|
if it.id
|
||||||
it.id = it.id.toString()
|
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"),
|
title: @translate.instant("COMMON.FILTERS.CATEGORIES.TAGS"),
|
||||||
dataType: "tags",
|
dataType: "tags",
|
||||||
content: tags
|
content: tags,
|
||||||
|
hideEmpty: true,
|
||||||
|
totalTaggedElements: tagsWithAtLeastOneElement.length
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: @translate.instant("COMMON.FILTERS.CATEGORIES.ASSIGNED_TO"),
|
title: @translate.instant("COMMON.FILTERS.CATEGORIES.ASSIGNED_TO"),
|
||||||
|
|
|
@ -160,6 +160,10 @@ class TaskboardController extends mixOf(taiga.Controller, taiga.PageMixin, taiga
|
||||||
it.id = it.name
|
it.id = it.name
|
||||||
|
|
||||||
return it
|
return it
|
||||||
|
|
||||||
|
tagsWithAtLeastOneElement = _.filter tags, (tag) ->
|
||||||
|
return tag.count > 0
|
||||||
|
|
||||||
assignedTo = _.map data.assigned_to, (it) ->
|
assignedTo = _.map data.assigned_to, (it) ->
|
||||||
if it.id
|
if it.id
|
||||||
it.id = it.id.toString()
|
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"),
|
title: @translate.instant("COMMON.FILTERS.CATEGORIES.TAGS"),
|
||||||
dataType: "tags",
|
dataType: "tags",
|
||||||
content: tags,
|
content: tags,
|
||||||
hideEmpty: true
|
hideEmpty: true,
|
||||||
|
totalTaggedElements: tagsWithAtLeastOneElement.length
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: @translate.instant("COMMON.FILTERS.CATEGORIES.ASSIGNED_TO"),
|
title: @translate.instant("COMMON.FILTERS.CATEGORIES.ASSIGNED_TO"),
|
||||||
|
|
|
@ -49,7 +49,9 @@ form
|
||||||
li(
|
li(
|
||||||
ng-class="{selected: vm.isOpen(filter.dataType)}"
|
ng-class="{selected: vm.isOpen(filter.dataType)}"
|
||||||
ng-repeat="filter in vm.filters track by 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(
|
a.filters-cat-single.e2e-category(
|
||||||
ng-class="{selected: vm.isOpen(filter.dataType)}"
|
ng-class="{selected: vm.isOpen(filter.dataType)}"
|
||||||
ng-click="vm.toggleFilterCategory(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.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}}
|
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(
|
a.filters-cat-single(
|
||||||
ng-class="{selected: vm.isOpen('custom-filter')}"
|
ng-class="{selected: vm.isOpen('custom-filter')}"
|
||||||
ng-click="vm.toggleFilterCategory('custom-filter')"
|
ng-click="vm.toggleFilterCategory('custom-filter')"
|
||||||
|
|
Loading…
Reference in New Issue