From 4058bac534b403523fef50fc9f2332c923758068 Mon Sep 17 00:00:00 2001 From: winkidney Date: Fri, 6 Dec 2019 00:56:52 +0800 Subject: [PATCH] Feature: Add board filter for board-selection --- pinry-spa/src/components/PHeader.vue | 6 +- pinry-spa/src/components/api.js | 4 + pinry-spa/src/components/modals.js | 3 +- .../src/components/pin_create/FilterSelect.vue | 89 ++++++++++++++++++++++ .../src/components/pin_create/PinCreateModal.vue | 33 +++++++- 5 files changed, 130 insertions(+), 5 deletions(-) create mode 100644 pinry-spa/src/components/pin_create/FilterSelect.vue diff --git a/pinry-spa/src/components/PHeader.vue b/pinry-spa/src/components/PHeader.vue index 6251c18..a74a3df 100644 --- a/pinry-spa/src/components/PHeader.vue +++ b/pinry-spa/src/components/PHeader.vue @@ -140,7 +140,11 @@ export default { modals.openLogin(this, this.onLoginSucceed); }, createPin() { - modals.openPinCreate(this, this.onPinCreated); + modals.openPinCreate( + this, + this.onPinCreated, + { username: this.user.meta.username }, + ); }, createBoard() { modals.openBoardCreate(this); diff --git a/pinry-spa/src/components/api.js b/pinry-spa/src/components/api.js index 3750815..691240c 100644 --- a/pinry-spa/src/components/api.js +++ b/pinry-spa/src/components/api.js @@ -23,6 +23,10 @@ const Board = { }, ); }, + fetchFullList(username) { + const url = `${API_PREFIX}boards-auto-complete/?submitter__username=${username}`; + return axios.get(url); + }, }; const Pin = { diff --git a/pinry-spa/src/components/modals.js b/pinry-spa/src/components/modals.js index 749e438..3e8c7e2 100644 --- a/pinry-spa/src/components/modals.js +++ b/pinry-spa/src/components/modals.js @@ -4,11 +4,12 @@ import SignUpForm from './SignUpForm.vue'; import BoardEdit from './BoardEdit.vue'; -function openPinCreate(vm, onCreate) { +function openPinCreate(vm, onCreate, props = null) { vm.$buefy.modal.open( { parent: vm, component: PinCreateModal, + props, hasModalCard: true, events: { 'create.succeed': onCreate, diff --git a/pinry-spa/src/components/pin_create/FilterSelect.vue b/pinry-spa/src/components/pin_create/FilterSelect.vue new file mode 100644 index 0000000..0060a72 --- /dev/null +++ b/pinry-spa/src/components/pin_create/FilterSelect.vue @@ -0,0 +1,89 @@ + + + diff --git a/pinry-spa/src/components/pin_create/PinCreateModal.vue b/pinry-spa/src/components/pin_create/PinCreateModal.vue index b3ba7bb..920044e 100644 --- a/pinry-spa/src/components/pin_create/PinCreateModal.vue +++ b/pinry-spa/src/components/pin_create/PinCreateModal.vue @@ -24,7 +24,7 @@ v-model="form.url.value" placeholder="where to fetch the image" maxlength="256" - > + > + > + > @@ -58,6 +58,9 @@ +
+ +