Merge branch 'main' into module/contact

This commit is contained in:
2025-10-07 20:43:36 +02:00
11 changed files with 177 additions and 43 deletions

View File

@@ -7,10 +7,12 @@
import { t } from '../../translations.svelte.js';
import { user } from '../../user.svelte.js';
import Card from './KanbanCard.svelte';
import LineEditor from '../../Components/LineEditor.svelte';
import Card from './KanbanCard.svelte';
import LineEditor from '../../Components/LineEditor.svelte';
import MarkdownEditor from '../../Components/MarkdownEditor.svelte';
let { id } = $props();
let descr = $state(false);
let filter_input = $state('');
let router = useTinyRouter();
if (router.hasQueryParam('filter')) filter_input = router.getQueryParam('filter');
@@ -25,6 +27,24 @@
$effect(() => updateUrl(filter_input));
async function do_archive(ex){
ex.preventDefault();
var task = dragged;
const url = api(`task/${task.id}`);
const resp = await fetch(url,{
credentials : 'include',
method : 'PATCH',
body : JSON.stringify({no_index:true})
});
delete highlight.archive;
if (resp.ok){
yikes();
delete tasks[task.assignee][task.status][task.id]
} else {
error(resp);
}
}
function updateUrl(){
let url = window.location.origin + window.location.pathname;
if (filter_input) url += '?filter=' + encodeURI(filter_input);
@@ -149,6 +169,11 @@
highlight = {user:user_id,state:state};
}
function hover_archive(ev){
ev.preventDefault();
highlight.archive = true;
}
function openTask(task_id){
controller.abort();
router.navigate(`/task/${task_id}/view`)
@@ -190,6 +215,10 @@
{/if}
{#if project}
<fieldset class="kanban description {descr?'active':''}" onclick={e => descr = !descr}>
<legend>{t('description')} {t('expand_on_click')}</legend>
{@html project.description.rendered}
</fieldset>
<div class="kanban" style="display: grid; grid-template-columns: {`repeat(${columns}, auto)`}">
<span class="filter">
<input type="text" bind:value={filter_input} autofocus />
@@ -207,7 +236,7 @@
{#each Object.entries(tasks) as [uid,stateList]}
<div class="user">{users[uid]}</div>
{#each Object.entries(project.allowed_states) as [state,name]}
<div class={['state_'+state, highlight.user == uid && highlight.state == state ? 'highlight':'']} ondragover={ev => hover(ev,uid,state)} ondrop={ev => drop(uid,state)} >
<div class={['state_'+state, highlight.user == uid && highlight.state == state ? 'highlight':'']} ondragover={ev => hover(ev,uid,state)} ondragleave={e => delete highlight.user} ondrop={ev => drop(uid,state)} >
{#if stateList[state]}
{#each Object.values(stateList[state]).sort((a,b) => a.name.localeCompare(b.name)) as task}
{#if !filter || task.name.toLowerCase().includes(filter) || (task.tags && task.tags.filter(tag => tag.toLowerCase().includes(filter)).length)}
@@ -222,4 +251,7 @@
{/each}
{/each}
</div>
{/if}
<div class="archive {highlight.archive?'hover':''}" ondragover={hover_archive} ondragleave={e => delete highlight.archive} ondrop={do_archive} >
{t('archive')}
</div>
{/if}

View File

@@ -16,7 +16,10 @@
<div
draggable="true"
class={`box prio_${task.total_prio} p${Math.floor(task.total_prio/10)*10} p${task.total_prio % 10}`}
{onclick} {ondragstart} style={style}>
{onclick} {ondragstart}
style={style}
title={task.description.source}
>
<span class="title">{task.name}</span>
{#if task.estimated_time}
<span class="estimate">

View File

@@ -36,7 +36,7 @@
{#if module=='bookmark'}
{@html target(object.comment.rendered).replace(/<p>(.*?)<\/p>/, '$1')} <!-- this is a workaround for in-proper formatting of paragraphs within list items in firefox -->
<p>
<a href={object.url}>{object.url}</a>
<a href={object.url} target="_blank">{object.url}</a>
</p>
<hr/>
{:else if module=='task' || module=='project'}