1
0
Fork 1
mirror of https://github.com/pixelfed/pixelfed.git synced 2024-12-25 01:05:36 +00:00

Update Profile.vue, add Profile Embed to menu

This commit is contained in:
Daniel Supernault 2019-12-05 19:17:55 -07:00
parent eccc84cbdc
commit 477d866b6b
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7

View file

@ -422,6 +422,9 @@
<div class="list-group-item cursor-pointer text-center rounded text-dark" @click="copyProfileLink">
Copy Link
</div>
<div v-if="profile.locked == false" class="list-group-item cursor-pointer text-center rounded text-dark" @click="showEmbedProfileModal">
Embed
</div>
<div v-if="user && !owner && !relationship.following" class="list-group-item cursor-pointer text-center rounded text-dark" @click="followProfile">
Follow
</div>
@ -471,6 +474,21 @@
</p>
</div>
</b-modal>
<b-modal ref="embedModal"
id="ctx-embed-modal"
hide-header
hide-footer
centered
rounded
size="md"
body-class="p-2 rounded">
<div>
<textarea class="form-control disabled" rows="1" style="border: 1px solid #efefef; font-size: 14px; line-height: 12px; height: 37px; margin: 0 0 7px; resize: none; white-space: nowrap;" v-model="ctxEmbedPayload"></textarea>
<hr>
<button :class="copiedEmbed ? 'btn btn-primary btn-block btn-sm py-1 font-weight-bold disabed': 'btn btn-primary btn-block btn-sm py-1 font-weight-bold'" @click="ctxCopyEmbed" :disabled="copiedEmbed">{{copiedEmbed ? 'Embed Code Copied!' : 'Copy Embed Code'}}</button>
<p class="mb-0 px-2 small text-muted">By using this embed, you agree to our <a href="/site/terms">Terms of Use</a></p>
</div>
</b-modal>
</div>
</template>
<style type="text/css" scoped>
@ -545,7 +563,9 @@
bookmarksPage: 2,
collections: [],
collectionsPage: 2,
isMobile: false
isMobile: false,
ctxEmbedPayload: null,
copiedEmbed: false
}
},
beforeMount() {
@ -1083,6 +1103,8 @@
},
statusUrl(status) {
return status.url;
if(status.local == true) {
return status.url;
}
@ -1091,12 +1113,25 @@
},
profileUrl(status) {
return status.url;
if(status.local == true) {
return status.account.url;
}
return '/i/web/profile/_/' + status.account.id;
}
},
showEmbedProfileModal() {
this.ctxEmbedPayload = window.App.util.embed.profile(this.profile.url)
this.$refs.embedModal.show();
},
ctxCopyEmbed() {
navigator.clipboard.writeText(this.ctxEmbedPayload);
this.$refs.embedModal.hide();
this.$refs.visitorContextMenu.hide();
},
}
}
</script>