7 changed files with 113 additions and 17 deletions
@ -0,0 +1,21 @@ |
|||||||
|
package de.srsoftware.umbrella.core.model; |
||||||
|
|
||||||
|
import de.srsoftware.tools.Mappable; |
||||||
|
|
||||||
|
import java.util.Map; |
||||||
|
|
||||||
|
import static de.srsoftware.umbrella.core.Constants.ID; |
||||||
|
|
||||||
|
public class WikiPage implements Mappable { |
||||||
|
|
||||||
|
private final long id; |
||||||
|
|
||||||
|
public WikiPage(long id){ |
||||||
|
this.id = id; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public Map<String, Object> toMap() { |
||||||
|
return Map.of(ID,id); |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,37 @@ |
|||||||
|
<script> |
||||||
|
import { onMount } from 'svelte'; |
||||||
|
import { api } from '../../urls.svelte'; |
||||||
|
import { t } from '../../translations.svelte'; |
||||||
|
|
||||||
|
let error = $state(null); |
||||||
|
let pages = $state(null); |
||||||
|
let lastLetter = null; |
||||||
|
|
||||||
|
async function loadPageList(){ |
||||||
|
const url = api('wiki'); |
||||||
|
const res = await fetch(url,{credentials:'include'}); |
||||||
|
if (res.ok){ |
||||||
|
pages = await res.json(); |
||||||
|
} else { |
||||||
|
error = await res.text(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
onMount(loadPageList); |
||||||
|
</script> |
||||||
|
|
||||||
|
{#if error} |
||||||
|
<span class="error">{error}</span> |
||||||
|
{/if} |
||||||
|
<h1>{t('wiki')}</h1> |
||||||
|
{#if pages} |
||||||
|
{#each pages as page} |
||||||
|
{#if page.charAt(0).toUpperCase() != lastLetter} |
||||||
|
|
||||||
|
<h2>{lastLetter = page.charAt(0).toUpperCase()||page.charAt(0).toUpperCase()}</h2> |
||||||
|
{/if} |
||||||
|
<div> |
||||||
|
<a href={`/wiki/${page}/view`}>{page}</a> |
||||||
|
</div> |
||||||
|
{/each} |
||||||
|
{/if} |
||||||
Loading…
Reference in new issue