fine-tuning permissions stuff

Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
This commit is contained in:
2026-03-06 13:23:40 +01:00
parent 69d3aacc53
commit 9ab1e479eb
4 changed files with 31 additions and 27 deletions

View File

@@ -38,10 +38,10 @@
border: 1px solid lime;
vertical-align: bottom;
position: relative;
width: 15px;
width: 20px;
}
.histogram{
height: 40px;
height: 60px;
}
.histogram span span{
position: absolute;
@@ -73,9 +73,7 @@
<td class="histogram">
{#each Object.entries(hist) as [weight,count]}
<span style="height: {100*count/max_val(hist)}%">
<span>
{weight}
</span>
<span>{weight}</span>
</span>
{/each}
</td>

View File

@@ -8,7 +8,8 @@
import { t } from '../../translations.svelte';
let poll = $state(null);
let selection = $state({});
let editor = user ? { name: user.name, user_id : user.id } : { name : '', user_id : -1 };
let editor = $state(user ? { name: user.name, user_id : user.id } : { name : '', user_id : -1 })
let disabled = $state(false);
async function load(){
let url = api('poll/'+id);
@@ -20,7 +21,7 @@
}
async function save(ev){
console.log({ev,editor,selection});
disabled = true;
let url = api(`poll/${id}/select`);
let res = await post(url,{editor,selection});
if (res.ok) {
@@ -29,6 +30,7 @@
}
function select(option,weight){
disabled = false;
selection[option.id] = +weight;
}
@@ -95,9 +97,8 @@
{/each}
</tbody>
</table>
{#if Object.keys(selection).length}
<button onclick={save}>{t('save')}</button>
{/if}
<button onclick={save} disabled={disabled || !editor.name || !Object.keys(selection).length}>{t('save')} </button>
</fieldset>
<div class="warn">TODO: add notes</div>
<div class="warn">TODO: load previous selection for logged-in user</div>
{/if}