implemented deletion and updating of notes
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
import Login from "./Components/Login.svelte";
|
||||
import Messages from "./routes/message/Messages.svelte";
|
||||
import Menu from "./Components/Menu.svelte";
|
||||
import Notes from "./routes/notes/List.svelte";
|
||||
import ProjectList from "./routes/project/List.svelte";
|
||||
import ProjectAdd from "./routes/project/Create.svelte";
|
||||
import ResetPw from "./routes/user/ResetPw.svelte";
|
||||
@@ -53,6 +54,7 @@
|
||||
<Route path="/document/:id/send" component={SendDoc} />
|
||||
<Route path="/document/:id/view" component={ViewDoc} />
|
||||
<Route path="/message/settings" component={Messages} />
|
||||
<Route path="/notes" component={Notes} />
|
||||
<Route path="/project" component={ProjectList} />
|
||||
<Route path="/project/add" component={ProjectAdd} />
|
||||
<Route path="/project/:project_id/add_task" component={AddTask} />
|
||||
|
||||
@@ -21,6 +21,12 @@ async function fetchModules(){
|
||||
console.log('error');
|
||||
}
|
||||
}
|
||||
|
||||
function go(path){
|
||||
router.navigate(path);
|
||||
return false;
|
||||
}
|
||||
|
||||
onMount(fetchModules);
|
||||
</script>
|
||||
|
||||
@@ -31,10 +37,11 @@ onMount(fetchModules);
|
||||
</style>
|
||||
|
||||
<nav>
|
||||
<a href="" onclick={() => router.navigate('/user')}>{t('users')}</a>
|
||||
<a href="" onclick={() => router.navigate('/project')}>{t('projects')}</a>
|
||||
<a href="" onclick={() => router.navigate('/task')}>{t('tasks')}</a>
|
||||
<a href="" onclick={() => router.navigate('/document')}>{t('documents')}</a>
|
||||
<a href="#" onclick={() => go('/user')}>{t('users')}</a>
|
||||
<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('/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}
|
||||
{#if user.name }
|
||||
|
||||
@@ -1,16 +1,18 @@
|
||||
<script>
|
||||
import { onMount } from 'svelte';
|
||||
import { onMount } from 'svelte';
|
||||
import { useTinyRouter } from 'svelte-tiny-router';
|
||||
|
||||
import { api } from '../../urls.svelte.js';
|
||||
import { t } from '../../translations.svelte.js';
|
||||
import { user } from '../../user.svelte.js';
|
||||
import { api } from '../../urls.svelte.js';
|
||||
import { t } from '../../translations.svelte.js';
|
||||
import { user } from '../../user.svelte.js';
|
||||
|
||||
import Editor from '../../Components/MarkdownEditor.svelte';
|
||||
|
||||
let authors = $state(null);
|
||||
let error = $state(null);
|
||||
let note = $state({source:null,rendered:null});
|
||||
let notes = $state(null);
|
||||
let authors = $state(null);
|
||||
let error = $state(null);
|
||||
let note = $state({source:null,rendered:null});
|
||||
let notes = $state(null);
|
||||
const router = useTinyRouter();
|
||||
let {
|
||||
module = null,
|
||||
entity_id = null
|
||||
@@ -31,8 +33,12 @@
|
||||
}
|
||||
}
|
||||
|
||||
function goToEntity(n){
|
||||
router.navigate(`/${n.module}/${n.entity_id}/view`);
|
||||
}
|
||||
|
||||
async function load(){
|
||||
const url = api(`notes/${module}/${entity_id}`);
|
||||
const url = (module == null && entity_id == null) ? api('notes') : api(`notes/${module}/${entity_id}`);
|
||||
const resp = await fetch(url,{credentials:'include'});
|
||||
if (resp.ok){
|
||||
const data = await resp.json();
|
||||
@@ -99,7 +105,11 @@
|
||||
{#if notes}
|
||||
{#each Object.entries(notes) as [nid,note]}
|
||||
<fieldset>
|
||||
{#if module}
|
||||
<legend class="author">{authors[note.user_id].name}</legend>
|
||||
{:else}
|
||||
<legend class="entity" onclick={() => goToEntity(note)}>{t(note.module)} {note.entity_id}</legend>
|
||||
{/if}
|
||||
<legend class="time">
|
||||
{note.timestamp.replace('T',' ')}
|
||||
{#if user.id == note.user_id}
|
||||
|
||||
@@ -186,7 +186,7 @@
|
||||
{#if ready}
|
||||
<div class="kanban" style="display: grid; grid-template-columns: {`repeat(${columns}, auto)`}">
|
||||
<span class="filter">
|
||||
<input type="text" bind:value={filter_input} />
|
||||
<input type="text" bind:value={filter_input} autofocus />
|
||||
{t('filter')}
|
||||
</span>
|
||||
<div class="head">{t('user')}</div>
|
||||
|
||||
Reference in New Issue
Block a user