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