implemented storing of bookmarks

Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
This commit is contained in:
2025-08-02 22:48:49 +02:00
parent d1b8d1a062
commit 61b5a6ffbb
10 changed files with 130 additions and 5 deletions

View File

@@ -7,6 +7,7 @@
import AddDoc from "./routes/document/Add.svelte";
import AddTask from "./routes/task/Add.svelte";
import Bookmarks from "./routes/bookmark/Index.svelte";
import Callback from "./routes/user/OidcCallback.svelte";
import DocList from "./routes/document/List.svelte";
import EditService from "./routes/user/EditService.svelte";
@@ -50,6 +51,7 @@
<!-- https://github.com/notnotsamuel/svelte-tiny-router -->
<Menu />
<Route path="/" component={User} />
<Route path="/bookmark" component={Bookmarks} />
<Route path="/document" component={DocList} />
<Route path="/document/add" component={AddDoc} />
<Route path="/document/:id/send" component={SendDoc} />

View File

@@ -41,6 +41,7 @@ onMount(fetchModules);
<a href="#" onclick={() => go('/project')}>{t('projects')}</a>
<a href="#" onclick={() => go('/task')}>{t('tasks')}</a>
<a href="#" onclick={() => go('/document')}>{t('documents')}</a>
<a href="#" onclick={() => go('/bookmark')}>{t('bookmarks')}</a>
<a href="#" onclick={() => go('/notes')}>{t('notes')}</a>
<a href="https://svelte.dev/tutorial/svelte/state" target="_blank">{t('tutorial')}</a>
{#each modules as module,i}<a href={module.url}>{module.name}</a>{/each}

View File

@@ -0,0 +1,43 @@
<script>
import { api } from '../../urls.svelte.js';
import { t } from '../../translations.svelte.js';
import Editor from '../../Components/MarkdownEditor.svelte';
let comment = $state({source:null,rendered:null});
let error = $state(null);
let link = $state(null);
async function onclick(ev){
let data = {
url : link,
comment : comment.source
};
const url = api('bookmark/save');
const resp = await fetch(url,{
credentials : 'include',
method : 'POST',
body : JSON.stringify(data)
});
if (resp.ok) {
} else {
error = await resp.text();
}
}
</script>
<fieldset>
<legend>{t('Bookmarks')}</legend>
{#if error}
<span class="error">{error}</span>
{/if}
<label>
{t('URL')}
<input bind:value={link} />
</label>
<label>
{t('Comment')}
<Editor simple={true} bind:value={comment} />
</label>
<button {onclick}>{t('save')}</button>
</fieldset>