tweaking project list
This commit is contained in:
@@ -5,7 +5,8 @@
|
|||||||
let {
|
let {
|
||||||
simple = false,
|
simple = false,
|
||||||
editable = simple,
|
editable = simple,
|
||||||
onclick = evt => { startEdit() },
|
href = '#',
|
||||||
|
onclick = evt => { evt.preventDefault(); startEdit(); return false },
|
||||||
onSet = newVal => {return true;},
|
onSet = newVal => {return true;},
|
||||||
type = 'div',
|
type = 'div',
|
||||||
value = $bindable(null)
|
value = $bindable(null)
|
||||||
@@ -91,5 +92,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} {oncontextmenu} class={{editable}} title={t('long_click_to_edit')} >{value}</svelte:element>
|
<svelte:element this={type} href={href} {onclick} {onmousedown} {onmouseup} {ontouchstart} {ontouchend} {oncontextmenu} class={{editable}} title={t('long_click_to_edit')} >{value}</svelte:element>
|
||||||
{/if}
|
{/if}
|
||||||
|
|||||||
@@ -49,9 +49,10 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function show(e,pid){
|
function show(e){
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
router.navigate(`/project/${pid}/view`);
|
let href = e.target.getAttribute('href');
|
||||||
|
if (href) router.navigate(href);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -92,20 +93,22 @@
|
|||||||
{#each sortedProjects as project}
|
{#each sortedProjects as project}
|
||||||
<tr>
|
<tr>
|
||||||
<td class="name">
|
<td class="name">
|
||||||
<a href="#" onclick={e => show(e,project.id)}>{project.name}</a>
|
<a href={`/project/${project.id}/view`} onclick={show}>{project.name}</a>
|
||||||
</td>
|
</td>
|
||||||
<td class="company" onclick={() => show(project.id)} >
|
<td class="company">
|
||||||
{#if project.company_id && companies[project.company_id]}
|
{#if project.company_id && companies[project.company_id]}
|
||||||
{companies[project.company_id].name}
|
<a href={`/company/${companies[project.company_id]}/view`} onclick={show}>{companies[project.company_id].name}</a>
|
||||||
{/if}
|
{/if}
|
||||||
</td>
|
</td>
|
||||||
<td class="state" onclick={() => show(project.id)} >
|
<td class="state">
|
||||||
{t("state_"+project.allowed_states[project.status]?.toLowerCase())}
|
<a href={`/project/${project.id}/view`} onclick={show}>{t("state_"+project.allowed_states[project.status]?.toLowerCase())}</a>
|
||||||
</td>
|
</td>
|
||||||
<td class="members" onclick={() => show(project.id)} >
|
<td class="members" >
|
||||||
|
<a href={`/project/${project.id}/view`} onclick={show}>
|
||||||
{#each Object.entries(project.members) as [uid,member]}
|
{#each Object.entries(project.members) as [uid,member]}
|
||||||
<div>{member.user.name}</div>
|
<div>{member.user.name}</div>
|
||||||
{/each}
|
{/each}
|
||||||
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td class="actions">
|
<td class="actions">
|
||||||
<button class="edit symbol" title={t('edit')}></button>
|
<button class="edit symbol" title={t('edit')}></button>
|
||||||
|
|||||||
@@ -103,8 +103,11 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function openTask(){
|
function openTask(e){
|
||||||
router.navigate(`/task/${task.id}/view`);
|
e.preventDefault();
|
||||||
|
let href = e.target.getAttribute('href');
|
||||||
|
if (href) router.navigate(href);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function patchTask(changeset){
|
async function patchTask(changeset){
|
||||||
@@ -143,7 +146,7 @@
|
|||||||
|
|
||||||
{#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" href={`/task/${task.id}/view`} />
|
||||||
{#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}
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
export function api(rel_path){
|
export function api(rel_path){
|
||||||
return `${location.protocol}//${location.host.replace('5173','8080')}/api/${rel_path}`;
|
return `${location.protocol}//${location.host.replace('5173','8080')}/api/${rel_path}`;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user