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)}
|
||||
</td>
|
||||
<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>{weight}</span>
|
||||
</span>
|
||||
|
||||
@@ -44,10 +44,6 @@
|
||||
router.navigate(`/poll/${poll.id}/view`);
|
||||
}
|
||||
|
||||
function share(poll){
|
||||
router.navigate(`/poll/${poll.id}/share`);
|
||||
}
|
||||
|
||||
onMount(load);
|
||||
|
||||
</script>
|
||||
@@ -70,13 +66,14 @@
|
||||
<td>{@html poll.description.rendered}</td>
|
||||
<td onclick={e => open(poll)}>{poll.owner.name}</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>
|
||||
{/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>
|
||||
{/if}
|
||||
<button onclick={e => share(poll)}>{t('share')}</button>
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
{/each}
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
if (res.ok){
|
||||
poll = await res.json();
|
||||
yikes();
|
||||
console.log(Object.entries(poll.weights).sort((a,b) => a[0] - b[0]));
|
||||
} else error(res);
|
||||
}
|
||||
|
||||
@@ -67,7 +68,7 @@
|
||||
<thead>
|
||||
<tr>
|
||||
<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">
|
||||
{weight}
|
||||
<span class="description">
|
||||
|
||||
Reference in New Issue
Block a user