Move delete button for status into a component See merge request !8environments/dev/deployments/1
commit
0db25bdca0
@ -0,0 +1,17 @@
|
|||||||
|
const DeleteButton = {
|
||||||
|
props: [ 'status' ],
|
||||||
|
methods: {
|
||||||
|
deleteStatus () {
|
||||||
|
const confirmed = confirm('Do you really want to delete this status?')
|
||||||
|
if (confirmed) {
|
||||||
|
this.$store.dispatch('deleteStatus', { id: this.status.id })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
currentUser () { return this.$store.state.users.currentUser },
|
||||||
|
canDelete () { return this.currentUser.rights.delete_others_notice || this.status.user.id == this.currentUser.id }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default DeleteButton
|
@ -0,0 +1,20 @@
|
|||||||
|
<template>
|
||||||
|
<div v-if="canDelete">
|
||||||
|
<a href="#" v-on:click.prevent="deleteStatus()">
|
||||||
|
<i class='fa icon-cancel delete-status'></i>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script src="./delete_button.js" ></script>
|
||||||
|
|
||||||
|
<style lang='scss'>
|
||||||
|
@import '../../_variables.scss';
|
||||||
|
|
||||||
|
.icon-cancel,.delete-status {
|
||||||
|
cursor: pointer;
|
||||||
|
&:hover {
|
||||||
|
color: $red;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
Loading…
Reference in new issue