WIP: Aureplop/kpsul js refactor #501
1 changed files with 9 additions and 3 deletions
|
@ -690,7 +690,7 @@ class ModelForest {
|
||||||
* @param {Object} [options] Options for element render method
|
* @param {Object} [options] Options for element render method
|
||||||
*/
|
*/
|
||||||
display($container, templates, options) {
|
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) {
|
for (let root of this.roots) {
|
||||||
$container.append(this.render_element(root, templates, options));
|
$container.append(this.render_element(root, templates, options));
|
||||||
}
|
}
|
||||||
|
@ -782,8 +782,6 @@ class ArticleList extends APIModelForest {
|
||||||
/**
|
/**
|
||||||
* Default structure for ArticleList instances
|
* Default structure for ArticleList instances
|
||||||
* @abstract
|
* @abstract
|
||||||
* @default <tt>{'article': Article,
|
|
||||||
'category': ArticleCategory}</tt>
|
|
||||||
*/
|
*/
|
||||||
static get structure() {
|
static get structure() {
|
||||||
return {
|
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
|
* Default url to get ArticlList data
|
||||||
* @abstract
|
* @abstract
|
||||||
|
|
Loading…
Reference in a new issue