Subscribe button working
All checks were successful
repod / nextcloud (push) Successful in 2m3s
repod / nodejs (push) Successful in 2m37s

This commit is contained in:
Michel Roux 2023-08-23 17:54:09 +02:00
parent 569850d666
commit 72ef60f23c
6 changed files with 756 additions and 645 deletions

1320
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -53,6 +53,12 @@ export default {
</script> </script>
<style scoped> <style scoped>
.caption {
float: right;
font-size: small;
margin: .5rem;
}
.tops { .tops {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
@ -63,10 +69,4 @@ export default {
.tops li { .tops li {
flex-basis: 15%; flex-basis: 15%;
} }
.caption {
float: right;
font-size: small;
margin: .5rem;
}
</style> </style>

View File

@ -2,16 +2,21 @@
<div class="header"> <div class="header">
<img class="background" :src="imageUrl"> <img class="background" :src="imageUrl">
<div class="content"> <div class="content">
<NcAvatar :display-name="author" <NcAvatar class="avatar"
:display-name="author"
:is-no-user="true" :is-no-user="true"
:url="imageUrl" /> :url="imageUrl" />
<div class="infos"> <div class="infos">
<h1>{{ title }}</h1> <h2>{{ title }}</h2>
<a :href="link" target="_blank"> <a :href="link" target="_blank">
{{ author }} <i>{{ author }}</i>
</a> </a>
<br><br>
<p>
<small>{{ description }}</small>
</p>
</div> </div>
<NcAppNavigationNew :text="t('Subscribe')"> <NcAppNavigationNew :text="t('Subscribe')" @click="addSubscription">
<template #icon> <template #icon>
<Plus :size="20" /> <Plus :size="20" />
</template> </template>
@ -23,6 +28,9 @@
<script> <script>
import { NcAppNavigationNew, NcAvatar } from '@nextcloud/vue' import { NcAppNavigationNew, NcAvatar } from '@nextcloud/vue'
import Plus from 'vue-material-design-icons/Plus.vue' import Plus from 'vue-material-design-icons/Plus.vue'
import axios from '@nextcloud/axios'
import { generateUrl } from '@nextcloud/router'
import { showError } from '@nextcloud/dialogs'
export default { export default {
name: 'Banner', name: 'Banner',
@ -36,6 +44,10 @@ export default {
type: String, type: String,
required: true, required: true,
}, },
description: {
type: String,
required: true,
},
imageUrl: { imageUrl: {
type: String, type: String,
required: true, required: true,
@ -49,26 +61,54 @@ export default {
required: true, required: true,
}, },
}, },
computed: {
url() {
return atob(this.$route.params.url)
},
},
methods: {
async addSubscription() {
try {
await axios.post(generateUrl('/apps/gpoddersync/subscription_change/create'), { add: [this.url], remove: [] })
} catch (e) {
console.error(e)
showError(t('Error while adding the feed'))
}
this.$store.dispatch('subscriptions/fetch')
},
},
} }
</script> </script>
<style scoped> <style scoped>
.header { .avatar {
overflow: hidden; height: 8rem;
position: relative; width: 8rem;
} }
.background { .background {
filter: blur(.5rem) brightness(50%); filter: blur(.5rem) brightness(50%);
height: auto;
left: 0;
opacity: 0.4; opacity: 0.4;
position: absolute; position: absolute;
top: 0; top: 0;
left: 0;
width: 100%; width: 100%;
height: auto;
} }
.content { .content {
display: flex;
gap: 2rem;
height: 10rem;
overflow: hidden;
position: relative;
}
.header {
height: 14rem;
overflow: hidden;
padding: 2rem;
position: relative; position: relative;
} }
</style> </style>

View File

@ -37,9 +37,9 @@ export default {
<style scoped> <style scoped>
.main { .main {
margin: 15px 51px;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 1rem; gap: 1rem;
margin: 15px 51px;
} }
</style> </style>

View File

@ -8,6 +8,7 @@
</NcEmptyContent> </NcEmptyContent>
<Banner v-if="feed" <Banner v-if="feed"
:author="feed.author" :author="feed.author"
:description="feed.description"
:image-url="feed.imageUrl" :image-url="feed.imageUrl"
:link="feed.link" :link="feed.link"
:title="feed.title" /> :title="feed.title" />

View File

@ -30,10 +30,10 @@ export default {
NcButton, NcButton,
NcEmptyContent, NcEmptyContent,
}, },
data() { computed: {
return { gPodderSyncUrl() {
gPodderSyncUrl: generateUrl('/settings/apps/installed/gpoddersync'), return generateUrl('/settings/apps/installed/gpoddersync')
} },
}, },
} }
</script> </script>