refactor: use slot name 'actions' in Table component

This commit is contained in:
j3d1 2023-12-28 23:32:30 +01:00
parent a458d4f850
commit 54a8445cd4
3 changed files with 40 additions and 35 deletions

View file

@ -19,9 +19,9 @@
:columns="['uid', 'description', 'box']"
:items="loadedItems"
:keyName="'uid'"
v-slot="{ item }"
@itemActivated="openLightboxModalWith($event)"
>
<template #actions="{ item }">
<div class="btn-group">
<button class="btn btn-success" @click.stop="markItemReturned(item)" title="returned">
<font-awesome-icon icon="check"/>
@ -33,6 +33,7 @@
<font-awesome-icon icon="trash"/>
</button>
</div>
</template>
</Table>
</div>
</div>
@ -53,13 +54,15 @@
<h6 class="card-subtitle text-secondary">uid: {{ item.uid }} box: {{ item.box }}</h6>
<div class="row mx-auto mt-2">
<div class="btn-group">
<button class="btn btn-outline-success" @click.stop="confirm('return Item?') && markItemReturned(item)" title="returned">
<button class="btn btn-outline-success"
@click.stop="confirm('return Item?') && markItemReturned(item)" title="returned">
<font-awesome-icon icon="check"/>
</button>
<button class="btn btn-outline-secondary" @click.stop="openEditingModalWith(item)" title="edit">
<font-awesome-icon icon="edit"/>
</button>
<button class="btn btn-outline-danger" @click.stop="confirm('delete Item?') && deleteItem(item)" title="delete">
<button class="btn btn-outline-danger" @click.stop="confirm('delete Item?') && deleteItem(item)"
title="delete">
<font-awesome-icon icon="trash"/>
</button>
</div>

View file

@ -6,8 +6,8 @@
:columns="['id', 'name', 'state', 'last_activity', 'assigned_to']"
:items="tickets"
:keyName="'id'"
v-slot="{ item }"
>
<template #actions="{ item }">
<div class="btn-group">
<a class="btn btn-primary" :href="'/ticket/' + item.id" title="view"
@click.prevent="gotoDetail(item)">
@ -15,6 +15,7 @@
View
</a>
</div>
</template>
</Table>
</div>
</div>

View file

@ -3,8 +3,8 @@
:columns="['slug', 'name']"
:items="events"
:keyName="'slug'"
v-slot="{ item }"
>
<template #actions="{ item }">
<div class="btn-group">
<button class="btn btn-secondary" @click.stop="changeEvent(item)">
<font-awesome-icon icon="archive"/>
@ -15,6 +15,7 @@
delete
</button>
</div>
</template>
</Table>
</template>