Add mark for active filters

This commit is contained in:
Urban Rotnik 2020-10-20 16:45:54 +02:00
parent c8083f730c
commit e7d2d78935
2 changed files with 25 additions and 0 deletions

View file

@ -38,6 +38,17 @@ var DasboardCurrentTasksWidget = (function() {
return values;
}
function markAppliedFilters(state) {
if (state.statuses.sort().toString() === getDefaultStatusValues().sort().toString()
&& (state.project_id.length === 0)
&& (state.sort === 'due_date')
&& (state.experiment_id.length === 0)) {
$('.filter-container').removeClass('filters-applied');
} else {
$('.filter-container').addClass('filters-applied');
}
}
function initInfiniteScroll() {
InfiniteScroll.init('.current-tasks-list', {
url: $('.current-tasks-list').data('tasksListUrl'),
@ -73,6 +84,7 @@ var DasboardCurrentTasksWidget = (function() {
};
if (filterState) {
markAppliedFilters(filterState);
localStorage.setItem('current_tasks_filters_per_team/' + teamId, JSON.stringify(filterState));
}
}
@ -100,6 +112,7 @@ var DasboardCurrentTasksWidget = (function() {
// Select saved navbar state
$('.current-tasks-navbar .navbar-link').removeClass('active');
$('.current-tasks-navbar').find(`[data-mode='${parsedFilterState.mode}']`).addClass('active');
markAppliedFilters(parsedFilterState);
} catch (e) {
dropdownSelector.selectValues(statusFilter, getDefaultStatusValues());
}

View file

@ -111,6 +111,18 @@
width: 100%;
}
}
&.filters-applied::after {
background: $brand-danger;
border: 1px solid $color-white;
border-radius: 50%;
content: "";
height: 7px;
left: 22px;
position: absolute;
top: 6px;
width: 7px;
}
}
.widget-placeholder {