Sort views by title
This commit is contained in:
parent
05fa41d9ee
commit
baf3474c29
|
@ -53,7 +53,7 @@
|
|||
<h2>{project.title}</h2>
|
||||
{#if views}
|
||||
<ul>
|
||||
{#each $views as view (view.id)}
|
||||
{#each [...$views].sort(View.compare) as view (view.id)}
|
||||
<!-- svelte-ignore a11y-no-noninteractive-element-to-interactive-role -->
|
||||
<li
|
||||
on:click={() => {
|
||||
|
|
|
@ -51,6 +51,10 @@ export default class View {
|
|||
this._filters = filters;
|
||||
}
|
||||
|
||||
static compare(a: View, b: View): number {
|
||||
return a.title.localeCompare(b.title);
|
||||
}
|
||||
|
||||
get id(): number {
|
||||
return this._id;
|
||||
}
|
||||
|
@ -166,6 +170,8 @@ export default class View {
|
|||
|
||||
this._title = title;
|
||||
|
||||
views.reload(this);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue