checked/improved permissions, improved sorting
Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
This commit is contained in:
@@ -71,7 +71,7 @@
|
|||||||
{average(hist)}
|
{average(hist)}
|
||||||
</td>
|
</td>
|
||||||
<td class="histogram">
|
<td class="histogram">
|
||||||
{#each Object.entries(hist) as [weight,count]}
|
{#each Object.entries(hist).sort((a,b) => a[0] - b[0]) as [weight,count]}
|
||||||
<span style="height: {100*count/max_val(hist)}%">
|
<span style="height: {100*count/max_val(hist)}%">
|
||||||
<span>{weight}</span>
|
<span>{weight}</span>
|
||||||
</span>
|
</span>
|
||||||
|
|||||||
@@ -44,10 +44,6 @@
|
|||||||
router.navigate(`/poll/${poll.id}/view`);
|
router.navigate(`/poll/${poll.id}/view`);
|
||||||
}
|
}
|
||||||
|
|
||||||
function share(poll){
|
|
||||||
router.navigate(`/poll/${poll.id}/share`);
|
|
||||||
}
|
|
||||||
|
|
||||||
onMount(load);
|
onMount(load);
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
@@ -70,13 +66,14 @@
|
|||||||
<td>{@html poll.description.rendered}</td>
|
<td>{@html poll.description.rendered}</td>
|
||||||
<td onclick={e => open(poll)}>{poll.owner.name}</td>
|
<td onclick={e => open(poll)}>{poll.owner.name}</td>
|
||||||
<td>
|
<td>
|
||||||
{#if user.id == poll.owner.id || poll.permission[user.id].permission == 2}
|
{#if user.id}
|
||||||
|
{#if user.id == poll.owner.id || (poll.permission[user.id] && poll.permission[user.id].permission.code == 2)}
|
||||||
<button onclick={e => edit(poll)}>{t('edit')}</button>
|
<button onclick={e => edit(poll)}>{t('edit')}</button>
|
||||||
{/if}
|
{/if}
|
||||||
{#if user.id == poll.owner.id || poll.permission[user.id].permission > 0}
|
{#if user.id == poll.owner.id || (poll.permission[user.id] && poll.permission[user.id].permission.code > 0)}
|
||||||
<button onclick={e => evaluate(poll)}>{t('evaluate')}</button>
|
<button onclick={e => evaluate(poll)}>{t('evaluate')}</button>
|
||||||
{/if}
|
{/if}
|
||||||
<button onclick={e => share(poll)}>{t('share')}</button>
|
{/if}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{/each}
|
{/each}
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
if (res.ok){
|
if (res.ok){
|
||||||
poll = await res.json();
|
poll = await res.json();
|
||||||
yikes();
|
yikes();
|
||||||
|
console.log(Object.entries(poll.weights).sort((a,b) => a[0] - b[0]));
|
||||||
} else error(res);
|
} else error(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -67,7 +68,7 @@
|
|||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<td>{t('option')}</td>
|
<td>{t('option')}</td>
|
||||||
{#each Object.entries(poll.weights) as [weight,name]}
|
{#each Object.entries(poll.weights).sort((a,b) => a[0] - b[0]) as [weight,name]}
|
||||||
<td class="weight">
|
<td class="weight">
|
||||||
{weight}
|
{weight}
|
||||||
<span class="description">
|
<span class="description">
|
||||||
|
|||||||
Reference in New Issue
Block a user