This commit is contained in:
parent
11e1a6f845
commit
e6790f6120
|
@ -63,7 +63,7 @@
|
|||
ng-model="$ctrl.orderField"
|
||||
selection="$ctrl.orderSelection"
|
||||
translate-fields="['name']"
|
||||
order="name"
|
||||
order="priority DESC"
|
||||
show-field="name"
|
||||
value-field="field"
|
||||
label="Order by"
|
||||
|
|
|
@ -14,10 +14,10 @@ class Controller extends Section {
|
|||
{way: 'DESC', name: 'Descendant'},
|
||||
];
|
||||
this.defaultOrderFields = [
|
||||
{field: 'relevancy DESC, name', name: 'Relevancy'},
|
||||
{field: 'showOrder, price', name: 'Color and price'},
|
||||
{field: 'name', name: 'Name'},
|
||||
{field: 'price', name: 'Price'}
|
||||
{field: 'relevancy DESC, name', name: 'Relevancy', priority: 999},
|
||||
{field: 'showOrder, price', name: 'Color and price', priority: 999},
|
||||
{field: 'name', name: 'Name', priority: 999},
|
||||
{field: 'price', name: 'Price', priority: 999}
|
||||
];
|
||||
this.orderFields = [].concat(this.defaultOrderFields);
|
||||
this._orderWay = this.orderWays[0].way;
|
||||
|
@ -312,9 +312,11 @@ class Controller extends Section {
|
|||
tags.push({
|
||||
name: itemTag.name,
|
||||
field: itemTag.tagFk,
|
||||
isTag: true
|
||||
isTag: true,
|
||||
priority: 1
|
||||
});
|
||||
}
|
||||
} else
|
||||
tags[alreadyAdded].priority += 1;
|
||||
});
|
||||
});
|
||||
let newFilterList = [].concat(this.defaultOrderFields);
|
||||
|
|
|
@ -45,7 +45,7 @@ describe('Order', () => {
|
|||
jest.spyOn(controller, 'buildTagsFilter');
|
||||
jest.spyOn(controller, 'buildOrderFilter');
|
||||
|
||||
const expectedResult = [{field: 'showOrder, price', name: 'Color and price'}];
|
||||
const expectedResult = [{field: 'showOrder, price', name: 'Color and price', priority: 999}];
|
||||
const items = [{id: 1, name: 'My Item', tags: [
|
||||
{tagFk: 4, name: 'Length'},
|
||||
{tagFk: 5, name: 'Color'}
|
||||
|
|
Loading…
Reference in New Issue