updated StateSelector: now utilizes buttons instead of dropdown
Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
This commit is contained in:
@@ -3,6 +3,14 @@
|
|||||||
import {api} from '../urls.svelte.js';
|
import {api} from '../urls.svelte.js';
|
||||||
import {t} from '../translations.svelte.js';
|
import {t} from '../translations.svelte.js';
|
||||||
|
|
||||||
|
const icons = {
|
||||||
|
10 : '',
|
||||||
|
20 : '',
|
||||||
|
40 : '',
|
||||||
|
60 : '',
|
||||||
|
100: ''
|
||||||
|
}
|
||||||
|
|
||||||
let {
|
let {
|
||||||
caption = t('select_state'),
|
caption = t('select_state'),
|
||||||
selected = $bindable(0),
|
selected = $bindable(0),
|
||||||
@@ -12,9 +20,20 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if project?.allowed_states}
|
{#if project?.allowed_states}
|
||||||
<select bind:value={selected} onchange={() => onchange(selected)}>
|
<!--<select bind:value={selected} onchange={() => onchange(selected)}>
|
||||||
{#each Object.entries(project.allowed_states) as [code,name]}
|
{#each Object.entries(project.allowed_states) as [code,name]}
|
||||||
<option value={+code}>{code%10?name:t('state_'+name.toLowerCase())}</option>
|
<option value={+code}>{code%10?name:t('state_'+name.toLowerCase())}</option>
|
||||||
{/each}
|
{/each}
|
||||||
</select>
|
</select>-->
|
||||||
|
<span class="states">
|
||||||
|
{#each Object.entries(project.allowed_states) as [code,name]}
|
||||||
|
<button onclick={e => onchange(code)} title={code%10?name:t('state_'+name.toLowerCase())} class={selected == code?'active':null}>
|
||||||
|
{#if icons[code]}
|
||||||
|
<span class="symbol">{icons[code]}</span>
|
||||||
|
{:else}
|
||||||
|
{code%10?name:t('state_'+name.toLowerCase())}
|
||||||
|
{/if}
|
||||||
|
</button>
|
||||||
|
{/each}
|
||||||
|
</span>
|
||||||
{/if}
|
{/if}
|
||||||
@@ -130,6 +130,10 @@ tr:hover a{
|
|||||||
color: orange;
|
color: orange;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.states .active{
|
||||||
|
background: yellow;
|
||||||
|
}
|
||||||
|
|
||||||
.taglist .tag{
|
.taglist .tag{
|
||||||
border-color: orange;
|
border-color: orange;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user