mirror of
https://github.com/pinry/pinry.git
synced 2025-11-16 18:05:51 +01:00
Feature: Add pin delete function
This commit is contained in:
committed by
Isaac Bythewood
parent
459486932d
commit
58f778f4b4
@@ -8,7 +8,7 @@
|
||||
custom-size="mdi-24px">
|
||||
</b-icon>
|
||||
</span>
|
||||
<span class="icon-container">
|
||||
<span class="icon-container" @click="deletePin">
|
||||
<b-icon
|
||||
type="is-light"
|
||||
icon="delete"
|
||||
@@ -27,12 +27,34 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import API from './api';
|
||||
|
||||
export default {
|
||||
name: 'Editor',
|
||||
props: {
|
||||
show: {
|
||||
default: false,
|
||||
type: Boolean,
|
||||
pin: {
|
||||
default() {
|
||||
return {};
|
||||
},
|
||||
type: Object,
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
deletePin() {
|
||||
this.$buefy.dialog.confirm({
|
||||
message: 'Delete this Pin?',
|
||||
onConfirm: () => {
|
||||
API.Pin.deleteById(this.pin.id).then(
|
||||
() => {
|
||||
this.$buefy.toast.open('Pin deleted');
|
||||
this.$emit('pin-delete-succeed', this.pin.id);
|
||||
},
|
||||
() => {
|
||||
this.$buefy.toast.open('Failed to delete Pin');
|
||||
},
|
||||
);
|
||||
},
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
@@ -17,11 +17,15 @@
|
||||
<div class="grid-sizer"></div>
|
||||
<div class="gutter-sizer"></div>
|
||||
<div class="pin-card grid-item">
|
||||
<div>
|
||||
<EditorUI v-show="shouldShowEdit(item.id)"></EditorUI>
|
||||
<img :src="item.url"
|
||||
@mouseenter="showEditButtons(item.id)"
|
||||
<div @mouseenter="showEditButtons(item.id)"
|
||||
@mouseleave="hideEditButtons(item.id)"
|
||||
>
|
||||
<EditorUI
|
||||
v-show="shouldShowEdit(item.id)"
|
||||
:pin="item"
|
||||
v-on:pin-delete-succeed="reset"
|
||||
></EditorUI>
|
||||
<img :src="item.url"
|
||||
@load="onPinImageLoaded(item.id)"
|
||||
@click="openPreview(item)"
|
||||
alt="item.description"
|
||||
@@ -76,7 +80,7 @@ import loadingSpinner from './loadingSpinner.vue';
|
||||
import noMore from './noMore.vue';
|
||||
import scroll from './utils/scroll';
|
||||
import bus from './utils/bus';
|
||||
import EditorUI from './EditorUI.vue';
|
||||
import EditorUI from './PinEditorUI.vue';
|
||||
|
||||
function createImageItem(pin) {
|
||||
const image = {};
|
||||
|
||||
@@ -64,6 +64,12 @@ const Pin = {
|
||||
},
|
||||
);
|
||||
},
|
||||
deleteById(pinId) {
|
||||
const url = `${API_PREFIX}pins/${pinId}/`;
|
||||
return axios.delete(
|
||||
url,
|
||||
);
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user