Bug 38201: Remove methods

We do not need the methods, we can emit from the template.
Also rename the events to the wording more consistent with what we have.

Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Jonathan Druart 2024-07-10 14:01:27 +02:00 committed by Lucas Gass
parent 013a588f71
commit 8c4868fb1b
No known key found for this signature in database
GPG Key ID: 60B447398B0D36CA
4 changed files with 14 additions and 17 deletions

View File

@ -4,7 +4,7 @@
<Toolbar v-if="!embedded">
<ToolbarButton
type="add"
@add-clicked="add_agreement"
@addResource="add_agreement"
:title="$__('New agreement')"
/>
</Toolbar>

View File

@ -2,8 +2,8 @@
<div v-if="!initialized">{{ $__("Loading") }}</div>
<div v-else id="agreements_show">
<Toolbar>
<ToolbarButton type="edit" @edit-clicked="edit_agreement" />
<ToolbarButton type="delete" @delete-clicked="delete_agreement" />
<ToolbarButton type="edit" @editResource="edit_agreement" />
<ToolbarButton type="delete" @deleteResource="delete_agreement" />
</Toolbar>
<h2>

View File

@ -1,11 +1,11 @@
<template>
<a v-if="type === 'add'" @click="click_add" class="btn btn-default"
<a v-if="type === 'add'" @click="$emit('addResource')" class="btn btn-default"
><font-awesome-icon icon="plus" /> {{ title }}</a
>
<a v-if="type === 'delete'" @click="click_delete" class="btn btn-default"
<a v-if="type === 'delete'" @click="$emit('deleteResource')" class="btn btn-default"
><font-awesome-icon icon="trash" /> {{ $__("Delete") }}</a
>
<a v-if="type === 'edit'" @click="click_edit" class="btn btn-default"
<a v-if="type === 'edit'" @click="$emit('editResource')" class="btn btn-default"
><font-awesome-icon icon="pencil" /> {{ $__("Edit") }}</a
>
<a
@ -77,17 +77,8 @@ export default {
}
return url;
},
click_add() {
this.$emit("add-clicked");
},
click_delete() {
this.$emit("delete-clicked");
},
click_edit() {
this.$emit("edit-clicked");
},
},
emits: ["add-clicked", "delete-clicked", "edit-clicked"],
emits: ["addResource", "deleteResource", "editResource"],
name: "Link",
};
</script>

View File

@ -1,5 +1,10 @@
<template>
<Link v-bind="$props" />
<Link
v-bind="$props"
@addResource="$emit('addResource')"
@deleteResource="$emit('deleteResource')"
@editResource="$emit('editResource')"
/>
</template>
<script>
@ -31,6 +36,7 @@ export default {
required: false,
},
},
emits: ["addResource", "deleteResource", "editResource"],
name: "ToolbarButton",
};
</script>