mirror of
https://github.com/flarum/core.git
synced 2025-08-08 01:16:52 +02:00
Sort the categories list in the sidebar correctly
This commit is contained in:
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});
|
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});
|
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.description = Model.prop('description');
|
||||||
Category.prototype.color = Model.prop('color');
|
Category.prototype.color = Model.prop('color');
|
||||||
Category.prototype.discussionsCount = Model.prop('discussionsCount');
|
Category.prototype.discussionsCount = Model.prop('discussionsCount');
|
||||||
|
Category.prototype.position = Model.prop('position');
|
||||||
|
|
||||||
export default Category;
|
export default Category;
|
||||||
|
@@ -24,7 +24,8 @@ class CategorySerializer extends BaseSerializer
|
|||||||
'description' => $category->description,
|
'description' => $category->description,
|
||||||
'slug' => $category->slug,
|
'slug' => $category->slug,
|
||||||
'color' => $category->color,
|
'color' => $category->color,
|
||||||
'discussionsCount' => (int) $category->discussions_count
|
'discussionsCount' => (int) $category->discussions_count,
|
||||||
|
'position' => (int) $category->position
|
||||||
];
|
];
|
||||||
|
|
||||||
return $this->extendAttributes($category, $attributes);
|
return $this->extendAttributes($category, $attributes);
|
||||||
|
Reference in New Issue
Block a user