Add back root_sort

This commit is contained in:
Ludovic Stephan 2017-04-05 22:23:56 -03:00
parent df47bedae1
commit 23d19545a7

View file

@ -690,7 +690,7 @@ class ModelForest {
* @param {Object} [options] Options for element render method
*/
display($container, templates, options) {
this.roots.sort(this.roots[0].constructor.compare);
this.roots.sort(this.constructor.root_sort);
for (let root of this.roots) {
$container.append(this.render_element(root, templates, options));
}
@ -782,8 +782,6 @@ class ArticleList extends APIModelForest {
/**
* Default structure for ArticleList instances
* @abstract
* @default <tt>{'article': Article,
'category': ArticleCategory}</tt>
*/
static get structure() {
return {
@ -800,6 +798,14 @@ class ArticleList extends APIModelForest {
}
/**
* Comparison function to sort roots
* @default <tt>{@link Models.ArticleCategory.compare|ArticleCategory.compare}</tt>
*/
static get root_sort() {
return ArticleCategory.compare;
}
/**
* Default url to get ArticlList data
* @abstract