Browse Source

added button to task/xx/view, that allows temporarily display of subtasks

Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
module/tasks
Stephan Richter 6 days ago
parent
commit
5dbe4aa09d
  1. 16
      frontend/src/routes/task/View.svelte

16
frontend/src/routes/task/View.svelte

@ -24,6 +24,7 @@
let project = $state(null); let project = $state(null);
const router = useTinyRouter(); const router = useTinyRouter();
let showSettings = $state(router.fullPath.endsWith('/edit')); let showSettings = $state(router.fullPath.endsWith('/edit'));
let show_closed = $state(false);
let task = $state(null); let task = $state(null);
$effect(() => updateOn(id)); $effect(() => updateOn(id));
@ -79,7 +80,7 @@
const url = api('task/list'); const url = api('task/list');
const data = { const data = {
parent_task_id : +task.id, parent_task_id : +task.id,
show_closed : task.show_closed show_closed : show_closed
}; };
const resp = await fetch(url,{ const resp = await fetch(url,{
credentials : 'include', credentials : 'include',
@ -108,10 +109,11 @@
const url = api(`task/${id}`); const url = api(`task/${id}`);
const resp = await fetch(url,{credentials:'include'}); const resp = await fetch(url,{credentials:'include'});
if (resp.ok){ if (resp.ok){
task = await resp.json();
yikes(); yikes();
task = await resp.json();
project = null; project = null;
children = null; children = null;
if (task.show_closed) show_closed = true;
loadChildren(); loadChildren();
if (task.project_id) loadProject(); if (task.project_id) loadProject();
if (task.parent_task_id) loadParent(); if (task.parent_task_id) loadParent();
@ -131,6 +133,13 @@
} }
} }
function showClosed(){
show_closed = !show_closed;
children = null;
loadChildren();
}
function showPrjFiles(){ function showPrjFiles(){
var url = `/files/project/${project.id}`; var url = `/files/project/${project.id}`;
window.open(url, '_blank').focus(); window.open(url, '_blank').focus();
@ -292,6 +301,9 @@
<div> <div>
{t('subtasks')} {t('subtasks')}
<button onclick={addChild} >{t('add_object',{object:t('subtask')})}</button> <button onclick={addChild} >{t('add_object',{object:t('subtask')})}</button>
{#if !show_closed}
<button onclick={showClosed}>{t('display_closed')}</button>
{/if}
</div> </div>
<div class="children"> <div class="children">
{#if children} {#if children}

Loading…
Cancel
Save