Skip to content

Commit

Permalink
merge 'feat: order traditions alphabetically'
Browse files Browse the repository at this point in the history
  • Loading branch information
schiwaa committed Feb 23, 2024
2 parents 9a7ea1e + 0ac8d61 commit 64113f2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class EditStemma extends HTMLElement {
// unless last re-render is active or only very shortly finished (TODO: How?)
stemmaRenderer.render_stemma( stemmaRenderer.ellipse_border_to_none( editor_dot ) );
} catch( { name, message } ) {
// console.log( name, message );
// Nothing happens when we do not have a well formed dot string.
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,18 @@ class TraditionList extends HTMLElement {
return traditionListItem;
}

alphabetizeTraditions( traditions ) {
return traditions.sort( (tradition_a, tradition_b) => tradition_a.name.localeCompare( tradition_b.name ) );
}

/**
* Renders a container for the traditions and sections navigation tree.
* Adds a list item for each tradition using @see SectionPropertiesView.createTraditionListItem.
*
* @param {Tradition[]} traditions
*/
render( traditions ) {
const orderedTraditions = this.alphabetizeTraditions( traditions );
this.innerHTML = `
<ul id="traditions-list" class="nav flex-column mb-2"></ul>`;
const traditionListElement = this.querySelector( 'ul' )
Expand Down

0 comments on commit 64113f2

Please sign in to comment.