working on user-defined states
This commit is contained in:
@@ -83,5 +83,5 @@
|
|||||||
{#if editable && editing}
|
{#if editable && editing}
|
||||||
<input bind:value={editValue} onkeyup={typed} autofocus />
|
<input bind:value={editValue} onkeyup={typed} autofocus />
|
||||||
{:else}
|
{:else}
|
||||||
<svelte:element this={type} href="" {onclick} {onmousedown} {onmouseup} {ontouchstart} {ontouchend} class={{editable}} title={t('double_click_to_edit')} >{value}</svelte:element>
|
<svelte:element this={type} href="#" {onclick} {onmousedown} {onmouseup} {ontouchstart} {ontouchend} class={{editable}} title={t('long_click_to_edit')} >{value}</svelte:element>
|
||||||
{/if}
|
{/if}
|
||||||
|
|||||||
@@ -56,7 +56,8 @@
|
|||||||
let task = dragged;
|
let task = dragged;
|
||||||
dragged = null;
|
dragged = null;
|
||||||
highlight = {};
|
highlight = {};
|
||||||
if (task.assignee == user_id && task.status.code == state) return; // no change
|
console.log(state);
|
||||||
|
if (task.assignee == user_id && task.status == state) return; // no change
|
||||||
let patch = {members:{},status:+state}
|
let patch = {members:{},status:+state}
|
||||||
patch.members[user_id] = 'ASSIGNEE';
|
patch.members[user_id] = 'ASSIGNEE';
|
||||||
|
|
||||||
@@ -67,7 +68,7 @@
|
|||||||
body : JSON.stringify(patch)
|
body : JSON.stringify(patch)
|
||||||
});
|
});
|
||||||
if (resp.ok){
|
if (resp.ok){
|
||||||
delete tasks[task.assignee][task.status.code][task.id]
|
delete tasks[task.assignee][task.status][task.id]
|
||||||
if (!tasks[user_id]) tasks[user_id] = {}
|
if (!tasks[user_id]) tasks[user_id] = {}
|
||||||
if (!tasks[user_id][state]) tasks[user_id][state] = {}
|
if (!tasks[user_id][state]) tasks[user_id][state] = {}
|
||||||
tasks[user_id][state][task.id] = task;
|
tasks[user_id][state][task.id] = task;
|
||||||
@@ -147,7 +148,7 @@
|
|||||||
var json = await resp.json();
|
var json = await resp.json();
|
||||||
for (var task_id of Object.keys(json)) {
|
for (var task_id of Object.keys(json)) {
|
||||||
let task = json[task_id];
|
let task = json[task_id];
|
||||||
let state = task.status.code;
|
let state = task.status;
|
||||||
let owner = null;
|
let owner = null;
|
||||||
let assignee = null;
|
let assignee = null;
|
||||||
for (var user_id of Object.keys(task.members)){
|
for (var user_id of Object.keys(task.members)){
|
||||||
@@ -198,7 +199,7 @@
|
|||||||
{#each Object.entries(tasks) as [uid,stateList]}
|
{#each Object.entries(tasks) as [uid,stateList]}
|
||||||
<div class="user">{users[uid]}</div>
|
<div class="user">{users[uid]}</div>
|
||||||
{#each Object.entries(states) as [state,name]}
|
{#each Object.entries(states) as [state,name]}
|
||||||
<div class={[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)} ondrop={ev => drop(uid,state)} >
|
||||||
{#if stateList[state]}
|
{#if stateList[state]}
|
||||||
{#each Object.values(stateList[state]).sort((a,b) => a.name.localeCompare(b.name)) as task}
|
{#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)}
|
{#if !filter || task.name.toLowerCase().includes(filter) || (task.tags && task.tags.filter(tag => tag.toLowerCase().includes(filter)).length)}
|
||||||
|
|||||||
@@ -205,7 +205,7 @@
|
|||||||
</th>
|
</th>
|
||||||
<td class="tasks">
|
<td class="tasks">
|
||||||
{#if tasks}
|
{#if tasks}
|
||||||
<TaskList {tasks} {estimated_time} states={project.allowed_states} show_closed={project.show_closed} />
|
<TaskList {tasks} {estimated_time} states={project?.allowed_states} show_closed={project.show_closed} />
|
||||||
{/if}
|
{/if}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
@@ -110,6 +110,13 @@
|
|||||||
patchTask({name:newName});
|
patchTask({name:newName});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function map_state(tx){
|
||||||
|
for (let [code,name] of Object.entries(states)){
|
||||||
|
if (tx == name) return {status:+code};
|
||||||
|
}
|
||||||
|
return {state:0};
|
||||||
|
}
|
||||||
|
|
||||||
if (task.estimated_time){
|
if (task.estimated_time){
|
||||||
estimated_time.sum += task.estimated_time;
|
estimated_time.sum += task.estimated_time;
|
||||||
}
|
}
|
||||||
@@ -118,25 +125,25 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if !deleted}
|
{#if !deleted}
|
||||||
<li draggable="true" {ondrop} ondragover={e => e.preventDefault()} {ondragstart} class="task {states[task.status].toLowerCase()}">
|
<li draggable="true" {ondrop} ondragover={e => e.preventDefault()} {ondragstart} class="task {states[task.status]?.toLowerCase()}">
|
||||||
<LineEditor bind:value={task.name} onclick={openTask} editable={true} onSet={setName} type="a" />
|
<LineEditor bind:value={task.name} onclick={openTask} editable={true} onSet={setName} type="a" />
|
||||||
{#if task.estimated_time}
|
{#if task.estimated_time}
|
||||||
<span class="estimated_time">({+task.estimated_time} h)</span>
|
<span class="estimated_time">({+task.estimated_time} h)</span>
|
||||||
{/if}
|
{/if}
|
||||||
{#if states[task.status] != 'PENDING'}
|
{#if states[task.status] != 'PENDING'}
|
||||||
<button class="symbol" title={t('do_open')} onclick={() => patchTask({status:'PENDING'})}></button>
|
<button class="symbol" title={t('postpone')} onclick={() => patchTask(map_state('PENDING'))}></button>
|
||||||
{/if}
|
{/if}
|
||||||
{#if states[task.status] != 'OPEN'}
|
{#if states[task.status] != 'OPEN'}
|
||||||
<button class="symbol" title={t('do_open')} onclick={() => patchTask({status:'OPEN'})}></button>
|
<button class="symbol" title={t('do_open')} onclick={() => patchTask(map_state('OPEN'))}></button>
|
||||||
{/if}
|
{/if}
|
||||||
{#if states[task.status] != 'STARTED'}
|
{#if states[task.status] != 'STARTED'}
|
||||||
<button class="symbol" title={t('started')} onclick={() => patchTask({status:'STARTED'})}></button>
|
<button class="symbol" title={t('started')} onclick={() => patchTask(map_state('STARTED'))}></button>
|
||||||
{/if}
|
{/if}
|
||||||
{#if states[task.status] != 'COMPLETE'}
|
{#if states[task.status] != 'COMPLETE'}
|
||||||
<button class="symbol" title={t('complete')} onclick={() => patchTask({status:'COMPLETE'})}></button>
|
<button class="symbol" title={t('complete')} onclick={() => patchTask(map_state('COMPLETE'))}></button>
|
||||||
{/if}
|
{/if}
|
||||||
{#if states[task.status] != 'CANCELLED'}
|
{#if states[task.status] != 'CANCELLED'}
|
||||||
<button class="symbol" title={t('abort')} onclick={() => patchTask({status:'CANCELLED'})} ></button>
|
<button class="symbol" title={t('abort')} onclick={() => patchTask(map_state('CANCELED'))} ></button>
|
||||||
{/if}
|
{/if}
|
||||||
<button class="symbol" title={t('delete_task')} onclick={deleteTask} ></button>
|
<button class="symbol" title={t('delete_task')} onclick={deleteTask} ></button>
|
||||||
<button class="symbol" title={t('add_subtask')} onclick={addSubtask}></button>
|
<button class="symbol" title={t('add_subtask')} onclick={addSubtask}></button>
|
||||||
|
|||||||
@@ -44,6 +44,7 @@
|
|||||||
|
|
||||||
|
|
||||||
function updateOn(id){
|
function updateOn(id){
|
||||||
|
task = null;
|
||||||
loadTask();
|
loadTask();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -162,13 +163,17 @@
|
|||||||
{#if project}
|
{#if project}
|
||||||
<tr>
|
<tr>
|
||||||
<th>{t('project')}</th>
|
<th>{t('project')}</th>
|
||||||
<td class="project"><a href="" onclick={gotoProject}>{project.name}</a></td>
|
<td class="project">
|
||||||
|
<a href="#" onclick={gotoProject}>{project.name}</a>
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{/if}
|
{/if}
|
||||||
{#if task.parent}
|
{#if task.parent}
|
||||||
<tr>
|
<tr>
|
||||||
<th>{t('parent_task')}</th>
|
<th>{t('parent_task')}</th>
|
||||||
<td class="parent" onclick={gotoParent}>{task.parent.name}</td>
|
<td class="parent">
|
||||||
|
<a href="#" onclick={gotoParent}>{task.parent.name}</a>
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{/if}
|
{/if}
|
||||||
<tr>
|
<tr>
|
||||||
@@ -282,7 +287,7 @@
|
|||||||
</th>
|
</th>
|
||||||
<td class="children">
|
<td class="children">
|
||||||
{#if children}
|
{#if children}
|
||||||
<TaskList tasks={children} {estimated_time} show_closed={task.show_closed} />
|
<TaskList states={project?.allowed_states} tasks={children} {estimated_time} show_closed={task.show_closed} />
|
||||||
{/if}
|
{/if}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
@@ -15,7 +15,6 @@
|
|||||||
"bookmark": "Lesezeichen",
|
"bookmark": "Lesezeichen",
|
||||||
"by": "von",
|
"by": "von",
|
||||||
|
|
||||||
|
|
||||||
"client_id": "Client-ID",
|
"client_id": "Client-ID",
|
||||||
"client_secret": "Client-Geheimnis",
|
"client_secret": "Client-Geheimnis",
|
||||||
"close_settings": "Einstellungen schließen",
|
"close_settings": "Einstellungen schließen",
|
||||||
@@ -57,7 +56,6 @@
|
|||||||
"do_login" : "anmelden",
|
"do_login" : "anmelden",
|
||||||
"do_open" : "öffnen",
|
"do_open" : "öffnen",
|
||||||
"do_send" : "versenden",
|
"do_send" : "versenden",
|
||||||
"double_click_to_edit": "Doppel-klicken zum Bearbeiten",
|
|
||||||
"due_date": "Fälligkeitsdatum",
|
"due_date": "Fälligkeitsdatum",
|
||||||
|
|
||||||
"edit": "Bearbeiten",
|
"edit": "Bearbeiten",
|
||||||
@@ -106,6 +104,7 @@
|
|||||||
"login" : "Anmeldung",
|
"login" : "Anmeldung",
|
||||||
"login_services": "Login-Services",
|
"login_services": "Login-Services",
|
||||||
"logout": "Abmelden",
|
"logout": "Abmelden",
|
||||||
|
"long_click_to_edit": "lang klicken zum Bearbeiten",
|
||||||
|
|
||||||
"MANAGE_LOGIN_SERVICES": "Login-Services verwalten",
|
"MANAGE_LOGIN_SERVICES": "Login-Services verwalten",
|
||||||
"members": "Mitarbeiter",
|
"members": "Mitarbeiter",
|
||||||
|
|||||||
Reference in New Issue
Block a user