mirror of
https://github.com/flarum/framework.git
synced 2025-02-21 03:59:39 +08:00
Sort the categories list in the sidebar correctly
This commit is contained in:
parent
45c4cffeea
commit
39c7dd5165
2
extensions/tags/js/bootstrap.js
vendored
2
extensions/tags/js/bootstrap.js
vendored
@ -67,7 +67,7 @@ app.initializers.add('categories', function() {
|
||||
|
||||
items.add('uncategorized', CategoryNavItem.component({params: this.stickyParams()}), {last: true});
|
||||
|
||||
app.store.all('categories').forEach(category => {
|
||||
app.store.all('categories').sort((a, b) => a.position() - b.position()).forEach(category => {
|
||||
items.add('category'+category.id(), CategoryNavItem.component({category, params: this.stickyParams()}), {last: true});
|
||||
});
|
||||
});
|
||||
|
@ -8,5 +8,6 @@ Category.prototype.slug = Model.prop('slug');
|
||||
Category.prototype.description = Model.prop('description');
|
||||
Category.prototype.color = Model.prop('color');
|
||||
Category.prototype.discussionsCount = Model.prop('discussionsCount');
|
||||
Category.prototype.position = Model.prop('position');
|
||||
|
||||
export default Category;
|
||||
|
@ -24,7 +24,8 @@ class CategorySerializer extends BaseSerializer
|
||||
'description' => $category->description,
|
||||
'slug' => $category->slug,
|
||||
'color' => $category->color,
|
||||
'discussionsCount' => (int) $category->discussions_count
|
||||
'discussionsCount' => (int) $category->discussions_count,
|
||||
'position' => (int) $category->position
|
||||
];
|
||||
|
||||
return $this->extendAttributes($category, $attributes);
|
||||
|
Loading…
x
Reference in New Issue
Block a user