Browse Source

Feature: Add single pin display and share link for pin

pull/169/head
winkidney 5 years ago
committed by Isaac Bythewood
parent
commit
133cd93d94
6 changed files with 46 additions and 13 deletions
  1. +13
    -5
      pinry-spa/src/components/PinPreview.vue
  2. +2
    -0
      pinry-spa/src/components/Pins.vue
  3. +23
    -0
      pinry-spa/src/components/api.js
  4. +6
    -6
      pinry-spa/src/views/Pins4Id.vue
  5. +1
    -1
      pinry-spa/src/views/Pins4Tag.vue
  6. +1
    -1
      pinry-spa/src/views/Pins4User.vue

+ 13
- 5
pinry-spa/src/components/PinPreview.vue View File

@@ -28,7 +28,7 @@
</p> </p>
</div> </div>
<div class="is-pulled-right"> <div class="is-pulled-right">
<a :href="pinItem.referer">
<a :href="pinItem.referer" target="_blank">
<b-button <b-button
v-show="pinItem.referer !== null" v-show="pinItem.referer !== null"
class="meta-link" class="meta-link"
@@ -36,7 +36,7 @@
Referer Referer
</b-button> </b-button>
</a> </a>
<a :href="pinItem.original_image_url">
<a :href="pinItem.original_image_url" target="_blank">
<b-button <b-button
v-show="pinItem.original_image_url !== null" v-show="pinItem.original_image_url !== null"
class="meta-link" class="meta-link"
@@ -44,11 +44,11 @@
Original Image Original Image
</b-button> </b-button>
</a> </a>
<b-button tag="router-link"
:to="{ name: 'pin', params: { pinId: pinItem.id } }"
<b-button
@click="closeAndGoTo"
class="meta-link" class="meta-link"
type="is-success"> type="is-success">
Pin URL
Goto Pin Link
</b-button> </b-button>
</div> </div>
</div> </div>
@@ -63,6 +63,14 @@
export default { export default {
name: 'PinPreview', name: 'PinPreview',
props: ['pinItem'], props: ['pinItem'],
methods: {
closeAndGoTo() {
this.$parent.close();
this.$router.push(
{ name: 'pin', params: { pinId: this.pinItem.id } },
);
},
},
}; };
</script> </script>




+ 2
- 0
pinry-spa/src/components/Pins.vue View File

@@ -184,6 +184,8 @@ export default {
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 = API.fetchPinsForBoard(this.pinFilters.boardFilter);
} else if (this.pinFilters.idFilter) {
promise = API.fetchPin(this.pinFilters.idFilter);
} else { } else {
promise = API.fetchPins(this.status.offset); promise = API.fetchPins(this.status.offset);
} }


+ 23
- 0
pinry-spa/src/components/api.js View File

@@ -19,6 +19,28 @@ function fetchPins(offset, tagFilter, userFilter) {
); );
} }


function fetchPin(pinId) {
const url = `${API_PREFIX}pins/${pinId}`;
return new Promise(
(resolve, reject) => {
const p = axios.get(
url,
);
p.then(
(resp) => {
const response = {
data: { results: [resp.data], next: null },
};
resolve(response);
},
(error) => {
reject(error);
},
);
},
);
}

function fetchPinsForBoard(boardId) { function fetchPinsForBoard(boardId) {
const url = `${API_PREFIX}boards/${boardId}`; const url = `${API_PREFIX}boards/${boardId}`;
return new Promise( return new Promise(
@@ -103,6 +125,7 @@ const User = {
}; };


export default { export default {
fetchPin,
fetchPins, fetchPins,
fetchPinsForBoard, fetchPinsForBoard,
User, User,


+ 6
- 6
pinry-spa/src/views/Pins4Id.vue View File

@@ -10,10 +10,10 @@ import PHeader from '../components/PHeader.vue';
import Pins from '../components/Pins.vue'; import Pins from '../components/Pins.vue';


export default { export default {
name: 'p-header',
name: 'Pins4Id',
data() { data() {
return { return {
filters: { tagFilter: null },
filters: { idFilter: null },
}; };
}, },
components: { components: {
@@ -21,15 +21,15 @@ export default {
Pins, Pins,
}, },
created() { created() {
this.initializeTag();
this.initialize();
}, },
beforeRouteUpdate(to, from, next) { beforeRouteUpdate(to, from, next) {
this.initializeTag();
this.initialize();
next(); next();
}, },
methods: { methods: {
initializeTag() {
this.filters.tagFilter = this.$route.params.tag;
initialize() {
this.filters.idFilter = this.$route.params.pinId;
}, },
}, },
}; };


+ 1
- 1
pinry-spa/src/views/Pins4Tag.vue View File

@@ -10,7 +10,7 @@ import PHeader from '../components/PHeader.vue';
import Pins from '../components/Pins.vue'; import Pins from '../components/Pins.vue';


export default { export default {
name: 'p-header',
name: 'Pins4Tag',
data() { data() {
return { return {
filters: { tagFilter: null }, filters: { tagFilter: null },


+ 1
- 1
pinry-spa/src/views/Pins4User.vue View File

@@ -10,7 +10,7 @@ import PHeader from '../components/PHeader.vue';
import Pins from '../components/Pins.vue'; import Pins from '../components/Pins.vue';


export default { export default {
name: 'p-header',
name: 'Pins4User',
data() { data() {
return { return {
filters: { userFilter: null }, filters: { userFilter: null },


Loading…
Cancel
Save