Skip to content

Commit 9538487

Browse files
committed
feat(category): sort categories directly via sort property on category model
1 parent e72e9dd commit 9538487

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

Diff for: addon/components/category-nav.hbs

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
/>
2323
{{/each}}
2424
{{else}}
25-
{{#each this.categories.records as |category|}}
25+
{{#each (sort-by "sort" this.categories.records) as |category|}}
2626
<CategoryNav::Category
2727
@category={{category}}
2828
@selected={{@selected}}

Diff for: addon/models/category.js

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ export default class CategoryModel extends LocalizedModel {
77
@attr color;
88
@attr metainfo;
99
@attr allowedMimeTypes;
10+
@attr sort;
1011

1112
@belongsTo("category", { inverse: "children", async: true }) parent;
1213
@hasMany("category", { inverse: "parent", async: true }) children;

0 commit comments

Comments
 (0)