diff --git a/pinry-spa/src/components/Boards.vue b/pinry-spa/src/components/Boards.vue
index 48b8449..a2dab1b 100644
--- a/pinry-spa/src/components/Boards.vue
+++ b/pinry-spa/src/components/Boards.vue
@@ -16,24 +16,32 @@
-
+
-
![]()
+
+
+
+
-
+
@@ -52,6 +60,7 @@ import loadingSpinner from './loadingSpinner.vue';
import noMore from './noMore.vue';
import scroll from './utils/scroll';
import placeholder from '../assets/pinry-placeholder.jpg';
+import BoardEditorUI from './editors/BoardEditUI.vue';
function createBoardItem(board) {
const defaultPreviewImage = placeholder;
@@ -81,25 +90,45 @@ function createBoardItem(board) {
return boardItem;
}
+function initialData() {
+ return {
+ currentEditBoard: null,
+ blocks: [],
+ blocksMap: {},
+ status: {
+ loading: false,
+ hasNext: true,
+ offset: 0,
+ },
+ };
+}
+
export default {
name: 'boards',
components: {
loadingSpinner,
noMore,
+ BoardEditorUI,
},
- data() {
- return {
- blocks: [],
- blocksMap: {},
- status: {
- loading: false,
- hasNext: true,
- offset: 0,
- },
- };
- },
+ data: initialData,
props: ['boardUsername'],
methods: {
+ initialize() {
+ this.fetchMore(true);
+ },
+ reset() {
+ const data = initialData();
+ Object.entries(data).forEach(
+ (kv) => {
+ const [key, value] = kv;
+ this[key] = value;
+ },
+ );
+ this.initialize();
+ },
+ shouldShowEdit(boardId) {
+ return this.currentEditBoard === boardId;
+ },
onPinImageLoaded(itemId) {
this.blocksMap[itemId].class = {
'image-loaded': true,
@@ -165,7 +194,7 @@ export default {
},
created() {
this.registerScrollEvent();
- this.fetchMore(true);
+ this.initialize();
},
};
diff --git a/pinry-spa/src/components/api.js b/pinry-spa/src/components/api.js
index 1e47274..77e5b6f 100644
--- a/pinry-spa/src/components/api.js
+++ b/pinry-spa/src/components/api.js
@@ -34,6 +34,10 @@ const Board = {
{ pins_to_add: pinIds },
);
},
+ delete(boardId) {
+ const url = `${API_PREFIX}boards/${boardId}/`;
+ return axios.delete(url);
+ },
};
const Pin = {
diff --git a/pinry-spa/src/components/editors/BoardEditUI.vue b/pinry-spa/src/components/editors/BoardEditUI.vue
new file mode 100644
index 0000000..69a6b76
--- /dev/null
+++ b/pinry-spa/src/components/editors/BoardEditUI.vue
@@ -0,0 +1,58 @@
+
+
+
+
+
+
+
diff --git a/pinry-spa/src/components/editors/PinEditorUI.vue b/pinry-spa/src/components/editors/PinEditorUI.vue
index 0aae94d..9783a62 100644
--- a/pinry-spa/src/components/editors/PinEditorUI.vue
+++ b/pinry-spa/src/components/editors/PinEditorUI.vue
@@ -61,28 +61,5 @@ export default {
diff --git a/pinry-spa/src/components/editors/editor.scss b/pinry-spa/src/components/editors/editor.scss
new file mode 100644
index 0000000..2b84622
--- /dev/null
+++ b/pinry-spa/src/components/editors/editor.scss
@@ -0,0 +1,24 @@
+@mixin border-radius {
+ border-radius: 3px;
+}
+
+.editor-buttons {
+ padding: 3px 1px 3px 3px;
+ background-color: rgba(225, 225, 225, 0.6);
+ position: absolute;
+ top: 5px;
+ right: 5px;
+ float: right;
+ cursor: pointer;
+
+ @include border-radius;
+ .icon-container {
+ @include border-radius;
+ padding: 5px 2px 2px 2px;
+ background-color: rgba(0, 0, 0, 0.8);
+ margin-right: 2px;
+ span {
+ opacity: 0.9;
+ }
+ }
+}
\ No newline at end of file