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._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();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get order fields
|
||||
*/
|
||||
get orderField() {
|
||||
return this._orderField;
|
||||
get orderSelection() {
|
||||
return this._orderSelection;
|
||||
}
|
||||
|
||||
set orderField(value) {
|
||||
this._orderField = value;
|
||||
set orderSelection(value) {
|
||||
this._orderSelection = value;
|
||||
|
||||
if (value) this.applyOrder();
|
||||
}
|
||||
|
||||
|
@ -94,10 +92,11 @@ class Controller {
|
|||
* @return {Object} - Order param
|
||||
*/
|
||||
getOrderBy() {
|
||||
const isTag = !!(this.orderSelection && this.orderSelection.isTag);
|
||||
return {
|
||||
field: this.orderField,
|
||||
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`, () => {
|
||||
spyOn(controller, 'applyFilters');
|
||||
controller._categoryId = {id: 1, value: 'My Category'};
|
||||
controller._type = {id: 1, value: 'My type'};
|
||||
controller._categoryId = 1;
|
||||
controller._typeId = 1;
|
||||
controller.tags = [{tagFk: 1, value: 'Blue'}];
|
||||
controller.remove(0);
|
||||
|
||||
|
|
Loading…
Reference in New Issue