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

View file

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

View file

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