working on project settings update:
adding/updating members not implemented
This commit is contained in:
26
frontend/src/Components/PermissionSelector.svelte
Normal file
26
frontend/src/Components/PermissionSelector.svelte
Normal file
@@ -0,0 +1,26 @@
|
||||
<script>
|
||||
import {onMount} from 'svelte';
|
||||
import {t} from '../translations.svelte.js';
|
||||
let {
|
||||
caption = t('select_permission'),
|
||||
selected = $bindable(0),
|
||||
onchange = (val) => console.log('changed to',val),
|
||||
permissions = null
|
||||
} = $props();
|
||||
|
||||
function onSelect(newVal){
|
||||
onchange({name:permissions[newVal],code:newVal});
|
||||
}
|
||||
|
||||
let message = $state(t('loading'));
|
||||
</script>
|
||||
|
||||
{#if permissions}
|
||||
<select bind:value={selected} onchange={() => onSelect(selected)}>
|
||||
{#each Object.entries(permissions) as [k,perm]}
|
||||
<option value={+k}>{t('permission_'+perm.toLowerCase())}</option>
|
||||
{/each}
|
||||
</select>
|
||||
{:else}
|
||||
<span>{message}</span>
|
||||
{/if}
|
||||
Reference in New Issue
Block a user