solved bug ordering by tag
gitea/salix/1985-apply_item_type_filter This commit looks good
Details
gitea/salix/1985-apply_item_type_filter This commit looks good
Details
This commit is contained in:
parent
c830bc6e8a
commit
7df41fc63c
|
@ -20,7 +20,7 @@ class Controller {
|
||||||
];
|
];
|
||||||
this.orderFields = [].concat(this.defaultOrderFields);
|
this.orderFields = [].concat(this.defaultOrderFields);
|
||||||
this._orderWay = this.orderWays[0].way;
|
this._orderWay = this.orderWays[0].way;
|
||||||
this._orderField = this.orderFields[0].field;
|
this.orderField = this.orderFields[0].field;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -76,15 +76,13 @@ class Controller {
|
||||||
if (value) this.applyOrder();
|
if (value) this.applyOrder();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
get orderSelection() {
|
||||||
* Get order fields
|
return this._orderSelection;
|
||||||
*/
|
|
||||||
get orderField() {
|
|
||||||
return this._orderField;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
set orderField(value) {
|
set orderSelection(value) {
|
||||||
this._orderField = value;
|
this._orderSelection = value;
|
||||||
|
|
||||||
if (value) this.applyOrder();
|
if (value) this.applyOrder();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,10 +92,11 @@ class Controller {
|
||||||
* @return {Object} - Order param
|
* @return {Object} - Order param
|
||||||
*/
|
*/
|
||||||
getOrderBy() {
|
getOrderBy() {
|
||||||
|
const isTag = !!(this.orderSelection && this.orderSelection.isTag);
|
||||||
return {
|
return {
|
||||||
field: this.orderField,
|
field: this.orderField,
|
||||||
way: this.orderWay,
|
way: this.orderWay,
|
||||||
isTag: (this.orderSelection && this.orderSelection.isTag)
|
isTag: isTag
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -146,8 +146,8 @@ describe('Order', () => {
|
||||||
|
|
||||||
it(`should remove a tag from tags property and call applyFilters() if there's no more tags`, () => {
|
it(`should remove a tag from tags property and call applyFilters() if there's no more tags`, () => {
|
||||||
spyOn(controller, 'applyFilters');
|
spyOn(controller, 'applyFilters');
|
||||||
controller._categoryId = {id: 1, value: 'My Category'};
|
controller._categoryId = 1;
|
||||||
controller._type = {id: 1, value: 'My type'};
|
controller._typeId = 1;
|
||||||
controller.tags = [{tagFk: 1, value: 'Blue'}];
|
controller.tags = [{tagFk: 1, value: 'Blue'}];
|
||||||
controller.remove(0);
|
controller.remove(0);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue