mirror of
https://github.com/pinry/pinry.git
synced 2025-11-14 00:55:43 +01:00
Feature: Add 'remove-from-board' in board view
This commit is contained in:
committed by
Isaac Bythewood
parent
41851a09a8
commit
a4dd2ea30f
@@ -26,6 +26,7 @@
|
|||||||
:currentUsername="editorMeta.user.meta.username"
|
:currentUsername="editorMeta.user.meta.username"
|
||||||
:currentBoardId="editorMeta.currentBoard.id"
|
:currentBoardId="editorMeta.currentBoard.id"
|
||||||
v-on:pin-delete-succeed="reset"
|
v-on:pin-delete-succeed="reset"
|
||||||
|
v-on:pin-remove-from-board-succeed="reset"
|
||||||
></EditorUI>
|
></EditorUI>
|
||||||
<img :src="item.url"
|
<img :src="item.url"
|
||||||
@load="onPinImageLoaded(item.id)"
|
@load="onPinImageLoaded(item.id)"
|
||||||
|
|||||||
@@ -45,6 +45,13 @@ const Board = {
|
|||||||
{ pins_to_add: pinIds },
|
{ pins_to_add: pinIds },
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
removeFromBoard(boardId, pinIds) {
|
||||||
|
const url = `${API_PREFIX}boards/${boardId}/`;
|
||||||
|
return axios.patch(
|
||||||
|
url,
|
||||||
|
{ pins_to_remove: pinIds },
|
||||||
|
);
|
||||||
|
},
|
||||||
delete(boardId) {
|
delete(boardId) {
|
||||||
const url = `${API_PREFIX}boards/${boardId}/`;
|
const url = `${API_PREFIX}boards/${boardId}/`;
|
||||||
return axios.delete(url);
|
return axios.delete(url);
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="editor">
|
<div class="editor">
|
||||||
<div class="editor-buttons">
|
<div class="editor-buttons">
|
||||||
<span class="icon-container" v-if="inBoard">
|
<span class="icon-container" v-if="inBoard" @click="removeFromBoard">
|
||||||
<b-icon
|
<b-icon
|
||||||
type="is-light"
|
type="is-light"
|
||||||
icon="minus-box"
|
icon="minus-box"
|
||||||
@@ -63,6 +63,24 @@ export default {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
removeFromBoard() {
|
||||||
|
this.$buefy.dialog.confirm({
|
||||||
|
message: 'Remove Pin from Board?',
|
||||||
|
onConfirm: () => {
|
||||||
|
API.Board.removeFromBoard(this.currentBoardId, [this.pin.id]).then(
|
||||||
|
() => {
|
||||||
|
this.$buefy.toast.open('Pin removed');
|
||||||
|
this.$emit('pin-remove-from-board-succeed', this.pin.id);
|
||||||
|
},
|
||||||
|
() => {
|
||||||
|
this.$buefy.toast.open(
|
||||||
|
{ type: 'is-danger', message: 'Failed to Remove Pin' },
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
},
|
||||||
deletePin() {
|
deletePin() {
|
||||||
this.$buefy.dialog.confirm({
|
this.$buefy.dialog.confirm({
|
||||||
message: 'Delete this Pin?',
|
message: 'Delete this Pin?',
|
||||||
|
|||||||
Reference in New Issue
Block a user