|
@@ -23,6 +23,8 @@ |
|
|
<EditorUI |
|
|
<EditorUI |
|
|
v-show="shouldShowEdit(item.id)" |
|
|
v-show="shouldShowEdit(item.id)" |
|
|
:pin="item" |
|
|
:pin="item" |
|
|
|
|
|
:currentUsername="editorMeta.user.meta.username" |
|
|
|
|
|
:currentBoardId="editorMeta.currentBoard.id" |
|
|
v-on:pin-delete-succeed="reset" |
|
|
v-on:pin-delete-succeed="reset" |
|
|
></EditorUI> |
|
|
></EditorUI> |
|
|
<img :src="item.url" |
|
|
<img :src="item.url" |
|
@@ -105,7 +107,6 @@ function createImageItem(pin) { |
|
|
|
|
|
|
|
|
function initialData() { |
|
|
function initialData() { |
|
|
return { |
|
|
return { |
|
|
currentEditId: null, |
|
|
|
|
|
blocks: [], |
|
|
blocks: [], |
|
|
blocksMap: {}, |
|
|
blocksMap: {}, |
|
|
status: { |
|
|
status: { |
|
@@ -113,6 +114,14 @@ function initialData() { |
|
|
hasNext: true, |
|
|
hasNext: true, |
|
|
offset: 0, |
|
|
offset: 0, |
|
|
}, |
|
|
}, |
|
|
|
|
|
editorMeta: { |
|
|
|
|
|
currentEditId: null, |
|
|
|
|
|
currentBoard: {}, |
|
|
|
|
|
user: { |
|
|
|
|
|
loggedIn: false, |
|
|
|
|
|
meta: {}, |
|
|
|
|
|
}, |
|
|
|
|
|
}, |
|
|
}; |
|
|
}; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@@ -133,19 +142,20 @@ export default { |
|
|
return { |
|
|
return { |
|
|
tagFilter: null, |
|
|
tagFilter: null, |
|
|
userFilter: null, |
|
|
userFilter: null, |
|
|
|
|
|
boardFilter: null, |
|
|
}; |
|
|
}; |
|
|
}, |
|
|
}, |
|
|
}, |
|
|
}, |
|
|
}, |
|
|
}, |
|
|
methods: { |
|
|
methods: { |
|
|
shouldShowEdit(id) { |
|
|
shouldShowEdit(id) { |
|
|
return this.currentEditId === id; |
|
|
|
|
|
|
|
|
return this.editorMeta.currentEditId === id; |
|
|
}, |
|
|
}, |
|
|
showEditButtons(id) { |
|
|
showEditButtons(id) { |
|
|
this.currentEditId = id; |
|
|
|
|
|
|
|
|
this.editorMeta.currentEditId = id; |
|
|
}, |
|
|
}, |
|
|
hideEditButtons() { |
|
|
hideEditButtons() { |
|
|
this.currentEditId = null; |
|
|
|
|
|
|
|
|
this.editorMeta.currentEditId = null; |
|
|
}, |
|
|
}, |
|
|
onPinImageLoaded(itemId) { |
|
|
onPinImageLoaded(itemId) { |
|
|
this.blocksMap[itemId].class = { |
|
|
this.blocksMap[itemId].class = { |
|
@@ -201,8 +211,23 @@ export default { |
|
|
return true; |
|
|
return true; |
|
|
}, |
|
|
}, |
|
|
initialize() { |
|
|
initialize() { |
|
|
|
|
|
this.initializeMeta(); |
|
|
this.fetchMore(true); |
|
|
this.fetchMore(true); |
|
|
}, |
|
|
}, |
|
|
|
|
|
initializeMeta() { |
|
|
|
|
|
const self = this; |
|
|
|
|
|
API.User.fetchUserInfo().then( |
|
|
|
|
|
(user) => { |
|
|
|
|
|
if (user === null) { |
|
|
|
|
|
self.editorMeta.user.loggedIn = false; |
|
|
|
|
|
self.editorMeta.user.meta = {}; |
|
|
|
|
|
} else { |
|
|
|
|
|
self.editorMeta.user.meta = user; |
|
|
|
|
|
self.editorMeta.user.loggedIn = true; |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
); |
|
|
|
|
|
}, |
|
|
reset() { |
|
|
reset() { |
|
|
const data = initialData(); |
|
|
const data = initialData(); |
|
|
Object.entries(data).forEach( |
|
|
Object.entries(data).forEach( |
|
@@ -224,7 +249,19 @@ export default { |
|
|
} else if (this.pinFilters.userFilter) { |
|
|
} else if (this.pinFilters.userFilter) { |
|
|
promise = API.fetchPins(this.status.offset, null, this.pinFilters.userFilter); |
|
|
promise = API.fetchPins(this.status.offset, null, this.pinFilters.userFilter); |
|
|
} else if (this.pinFilters.boardFilter) { |
|
|
} else if (this.pinFilters.boardFilter) { |
|
|
promise = API.fetchPinsForBoard(this.pinFilters.boardFilter); |
|
|
|
|
|
|
|
|
promise = new Promise( |
|
|
|
|
|
(resolve, reject) => { |
|
|
|
|
|
API.fetchPinsForBoard(this.pinFilters.boardFilter).then( |
|
|
|
|
|
(resp) => { |
|
|
|
|
|
this.editorMeta.currentBoard = resp.data.board; |
|
|
|
|
|
resolve(resp); |
|
|
|
|
|
}, |
|
|
|
|
|
(error) => { |
|
|
|
|
|
reject(error); |
|
|
|
|
|
}, |
|
|
|
|
|
); |
|
|
|
|
|
}, |
|
|
|
|
|
); |
|
|
} else if (this.pinFilters.idFilter) { |
|
|
} else if (this.pinFilters.idFilter) { |
|
|
promise = API.fetchPin(this.pinFilters.idFilter); |
|
|
promise = API.fetchPin(this.pinFilters.idFilter); |
|
|
} else { |
|
|
} else { |
|
|