mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
improved German, download images on click
This commit is contained in:
parent
25440ff0ea
commit
a6f87a394a
@ -648,7 +648,7 @@
|
|||||||
"success": "Konto erfolgreich gelöscht!"
|
"success": "Konto erfolgreich gelöscht!"
|
||||||
},
|
},
|
||||||
"download": {
|
"download": {
|
||||||
"description": "Klicke auf den Knopf oben, um den Inhalt deiner Posts und Kommentare herunterzuladen. Um die Bilder der posts herunterzuladen, musst du auf den jeweiligen Link unten klicken.",
|
"description": "Klicke auf den Knopf oben, um den Inhalt deiner Beiträge und Kommentare herunterzuladen. Um die Bilder der Beiträge herunterzuladen, musst du auf den jeweiligen Link unten klicken.",
|
||||||
"json": "als JSON",
|
"json": "als JSON",
|
||||||
"name": "Daten herunterladen"
|
"name": "Daten herunterladen"
|
||||||
},
|
},
|
||||||
|
|||||||
@ -1,14 +1,14 @@
|
|||||||
<template>
|
<template>
|
||||||
<base-card>
|
<base-card>
|
||||||
<h2 class="title">{{ $t('settings.download.name') }}</h2>
|
<h2 class="title">{{ $t('settings.download.name') }}</h2>
|
||||||
<base-button @click="onClick(jsonData)" icon="download" secondary filled>
|
<base-button @click="onClick(jsonData)" icon="download" secondary filled :disabled="loading">
|
||||||
{{ $t('settings.download.json') }}
|
{{ $t('settings.download.json') }}
|
||||||
</base-button>
|
</base-button>
|
||||||
<ds-space margin="large" />
|
<ds-space margin="large" />
|
||||||
<ds-text>{{ $t('settings.download.description') }}</ds-text>
|
<ds-text>{{ $t('settings.download.description') }}</ds-text>
|
||||||
<ds-space margin="large" />
|
<ds-space margin="large" />
|
||||||
<base-card v-for="image in imageList" :key="image.key">
|
<base-card v-for="image in imageList" :key="image.key">
|
||||||
<a :href="image.url">{{ image.title }}</a>
|
<a :href="image.url" @click.prevent="downloadImage(image)">{{ image.title }}</a>
|
||||||
<ds-space margin="xxx-small" />
|
<ds-space margin="xxx-small" />
|
||||||
</base-card>
|
</base-card>
|
||||||
</base-card>
|
</base-card>
|
||||||
@ -27,6 +27,8 @@ export default {
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
userData: {},
|
userData: {},
|
||||||
|
loading: true,
|
||||||
|
imageList: [],
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@ -36,20 +38,6 @@ export default {
|
|||||||
jsonData() {
|
jsonData() {
|
||||||
return { data: JSON.stringify(this.userData, null, 2), type: 'json' }
|
return { data: JSON.stringify(this.userData, null, 2), type: 'json' }
|
||||||
},
|
},
|
||||||
imageList() {
|
|
||||||
if (isEmpty(this.userData)) return null
|
|
||||||
const userId = this.userData.user.id
|
|
||||||
if (isEmpty(userId)) return null
|
|
||||||
return this.userData.posts
|
|
||||||
.filter((post) => post.author.id === userId)
|
|
||||||
.map((post) => {
|
|
||||||
const obj = {}
|
|
||||||
obj.key = post.id
|
|
||||||
obj.url = post.image.url
|
|
||||||
obj.title = post.title
|
|
||||||
return obj
|
|
||||||
})
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
onClick(method) {
|
onClick(method) {
|
||||||
@ -60,6 +48,16 @@ export default {
|
|||||||
document.body.appendChild(fileLink)
|
document.body.appendChild(fileLink)
|
||||||
fileLink.click()
|
fileLink.click()
|
||||||
},
|
},
|
||||||
|
downloadImage({ url, title }) {
|
||||||
|
this.$axios.get(url, { responseType: 'blob' }).then((response) => {
|
||||||
|
const blob = new Blob([response.data], { type: 'application/pdf' })
|
||||||
|
const link = document.createElement('a')
|
||||||
|
link.href = URL.createObjectURL(blob)
|
||||||
|
link.download = title
|
||||||
|
link.click()
|
||||||
|
URL.revokeObjectURL(link.href)
|
||||||
|
})
|
||||||
|
},
|
||||||
},
|
},
|
||||||
apollo: {
|
apollo: {
|
||||||
queryUserData: {
|
queryUserData: {
|
||||||
@ -71,6 +69,19 @@ export default {
|
|||||||
},
|
},
|
||||||
update({ userData }) {
|
update({ userData }) {
|
||||||
this.userData = userData
|
this.userData = userData
|
||||||
|
this.loading = false
|
||||||
|
if (isEmpty(this.userData)) return null
|
||||||
|
const userId = this.userData.user.id
|
||||||
|
if (isEmpty(userId)) return null
|
||||||
|
this.imageList = this.userData.posts
|
||||||
|
.filter((post) => post.author.id === userId && post.image)
|
||||||
|
.map((post) => {
|
||||||
|
const obj = {}
|
||||||
|
obj.key = post.id
|
||||||
|
obj.url = post.image.url
|
||||||
|
obj.title = post.title
|
||||||
|
return obj
|
||||||
|
})
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user