refresh filters on tag remove #818
This commit is contained in:
parent
8bd91f3039
commit
f84c581259
|
@ -11,19 +11,6 @@ class Controller {
|
||||||
this.$transitions = $transitions;
|
this.$transitions = $transitions;
|
||||||
this.itemTypes = [];
|
this.itemTypes = [];
|
||||||
this.tags = [];
|
this.tags = [];
|
||||||
|
|
||||||
/* $transitions.onSuccess({}, transition => {
|
|
||||||
let params = {};
|
|
||||||
if (this.category)
|
|
||||||
params.category = this.category;
|
|
||||||
|
|
||||||
if (this.type)
|
|
||||||
params.type = this.type;
|
|
||||||
|
|
||||||
$window.history.replaceState(params);
|
|
||||||
|
|
||||||
this.applyFilters();
|
|
||||||
}); */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
get order() {
|
get order() {
|
||||||
|
@ -42,15 +29,12 @@ class Controller {
|
||||||
if (this.$stateParams.category)
|
if (this.$stateParams.category)
|
||||||
category = JSON.parse(this.$stateParams.category);
|
category = JSON.parse(this.$stateParams.category);
|
||||||
|
|
||||||
|
|
||||||
if (this.$stateParams.type)
|
if (this.$stateParams.type)
|
||||||
type = JSON.parse(this.$stateParams.type);
|
type = JSON.parse(this.$stateParams.type);
|
||||||
|
|
||||||
|
|
||||||
if (category && category.id)
|
if (category && category.id)
|
||||||
this.category = category;
|
this.category = category;
|
||||||
|
|
||||||
|
|
||||||
if (type && type.id)
|
if (type && type.id)
|
||||||
this.type = type;
|
this.type = type;
|
||||||
});
|
});
|
||||||
|
@ -87,15 +71,14 @@ class Controller {
|
||||||
set type(value) {
|
set type(value) {
|
||||||
if (value && this.type && this.type.id == value.id) return;
|
if (value && this.type && this.type.id == value.id) return;
|
||||||
|
|
||||||
if (!value || !value.id) {
|
|
||||||
this._type = null;
|
|
||||||
this.updateStateParams();
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
this._type = value;
|
this._type = value;
|
||||||
|
|
||||||
|
if (!value || !value.id)
|
||||||
|
this._type = null;
|
||||||
|
|
||||||
this.updateStateParams();
|
this.updateStateParams();
|
||||||
|
|
||||||
|
if ((value && value.id) || this.tags.length > 0)
|
||||||
this.applyFilters();
|
this.applyFilters();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -111,7 +94,7 @@ class Controller {
|
||||||
remove(index) {
|
remove(index) {
|
||||||
this.tags.splice(index, 1);
|
this.tags.splice(index, 1);
|
||||||
|
|
||||||
if (this.tags.length > 0)
|
if (this.tags.length == 0 && this.category && this.type)
|
||||||
this.applyFilters();
|
this.applyFilters();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -123,11 +106,9 @@ class Controller {
|
||||||
if (this.category)
|
if (this.category)
|
||||||
newFilter.categoryFk = this.category.id;
|
newFilter.categoryFk = this.category.id;
|
||||||
|
|
||||||
|
|
||||||
if (this.type)
|
if (this.type)
|
||||||
newFilter.typeFk = this.type.id;
|
newFilter.typeFk = this.type.id;
|
||||||
|
|
||||||
|
|
||||||
newParams = {
|
newParams = {
|
||||||
orderFk: this.order.id,
|
orderFk: this.order.id,
|
||||||
orderBy: this.catalog.getOrderBy(),
|
orderBy: this.catalog.getOrderBy(),
|
||||||
|
@ -169,13 +150,11 @@ class Controller {
|
||||||
if (this.category)
|
if (this.category)
|
||||||
params.category = JSON.stringify(this.category);
|
params.category = JSON.stringify(this.category);
|
||||||
|
|
||||||
|
|
||||||
if (this.type)
|
if (this.type)
|
||||||
params.type = JSON.stringify(this.type);
|
params.type = JSON.stringify(this.type);
|
||||||
else
|
else
|
||||||
params.type = undefined;
|
params.type = undefined;
|
||||||
|
|
||||||
|
|
||||||
this.$state.go(this.$state.current.name, params);
|
this.$state.go(this.$state.current.name, params);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue