implemented unlinking task from parent task

Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
This commit is contained in:
2025-10-18 14:08:54 +02:00
parent 472fa147de
commit 7ca3445c31
2 changed files with 11 additions and 2 deletions

View File

@@ -171,7 +171,7 @@ public class Task implements Mappable {
case MEMBERS: continue; case MEMBERS: continue;
case NAME: name = json.getString(key); break; case NAME: name = json.getString(key); break;
case NO_INDEX: noIndex = json.getBoolean(NO_INDEX); break; case NO_INDEX: noIndex = json.getBoolean(NO_INDEX); break;
case PARENT_TASK_ID: parentTaskId = json.getLong(PARENT_TASK_ID); break; case PARENT_TASK_ID: parentTaskId = json.isNull(PARENT_TASK_ID) ? null : json.getLong(PARENT_TASK_ID); break;
case PRIORITY: priority = json.getInt(PRIORITY); break; case PRIORITY: priority = json.getInt(PRIORITY); break;
case REQUIRED_TASKS_IDS: case REQUIRED_TASKS_IDS:
requiredTasksIds.clear(); requiredTasksIds.clear();

View File

@@ -140,6 +140,10 @@
showSettings = !showSettings; showSettings = !showSettings;
} }
function unlink_parent(){
update({parent_task_id:null});
}
async function update(data){ async function update(data){
const url = api(`task/${id}`); const url = api(`task/${id}`);
const resp = await fetch(url,{ const resp = await fetch(url,{
@@ -151,7 +155,11 @@
yikes(); yikes();
let old_task = task; let old_task = task;
task = await resp.json(); task = await resp.json();
if (task.parent_id == old_task.parent_id) task.parent = old_task.parent; if (!task.parent_id){
task.parent = null;
} else {
if (task.parent_id == old_task.parent_id) task.parent = old_task.parent;
}
return true; return true;
} else { } else {
error(resp); error(resp);
@@ -196,6 +204,7 @@
<div>{t('parent_task')}</div> <div>{t('parent_task')}</div>
<div class="parent"> <div class="parent">
<a href="#" onclick={gotoParent}>{task.parent.name}</a> <a href="#" onclick={gotoParent}>{task.parent.name}</a>
<button class="symbol" title={t('unlink')} onclick={unlink_parent}></button>
</div> </div>
{/if} {/if}
<div>{t('task')}</div> <div>{t('task')}</div>