Pic does something
This commit is contained in:
parent
95bd71e0a4
commit
f6f98a7003
49
src/components/TopItem.vue
Normal file
49
src/components/TopItem.vue
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
<template>
|
||||||
|
<a @click="addSubscription">
|
||||||
|
<img :src="imgUrl" :alt="author" :title="author">
|
||||||
|
</a>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import axios from '@nextcloud/axios'
|
||||||
|
import { generateUrl } from '@nextcloud/router'
|
||||||
|
import { showError } from '@nextcloud/dialogs'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'TopItem',
|
||||||
|
components: {},
|
||||||
|
props: {
|
||||||
|
xmlUrl: {
|
||||||
|
type: String,
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
imgUrl: {
|
||||||
|
type: String,
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
author: {
|
||||||
|
type: String,
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
async addSubscription() {
|
||||||
|
try {
|
||||||
|
await axios.post(generateUrl('/apps/gpoddersync/subscription_change/create'), { add: [this.xmlUrl], remove: [] })
|
||||||
|
} catch (e) {
|
||||||
|
console.error(e)
|
||||||
|
showError(t('Error while adding the feed'))
|
||||||
|
}
|
||||||
|
|
||||||
|
this.$store.dispatch('subscriptions/fetch')
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
img {
|
||||||
|
height: 100%;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
</style>
|
@ -12,7 +12,7 @@
|
|||||||
<NcLoadingIcon v-if="loading" />
|
<NcLoadingIcon v-if="loading" />
|
||||||
<ul v-if="!loading" class="tops">
|
<ul v-if="!loading" class="tops">
|
||||||
<li v-for="top in tops" :key="top.id">
|
<li v-for="top in tops" :key="top.id">
|
||||||
<img :src="top.imgURL" :alt="top.author" :title="top.author">
|
<TopItem :xml-url="top.xmlURL" :img-url="top.imgURL" :author="top.author" />
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<span class="caption">{{ t('Suggests by fyyd') }}</span>
|
<span class="caption">{{ t('Suggests by fyyd') }}</span>
|
||||||
@ -22,15 +22,17 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { NcLoadingIcon, NcSelect } from '@nextcloud/vue'
|
import { NcLoadingIcon, NcSelect } from '@nextcloud/vue'
|
||||||
|
import TopItem from './TopItem.vue'
|
||||||
import axios from '@nextcloud/axios'
|
import axios from '@nextcloud/axios'
|
||||||
import { generateUrl } from '@nextcloud/router'
|
import { generateUrl } from '@nextcloud/router'
|
||||||
import { showError } from '@nextcloud/dialogs'
|
import { showError } from '@nextcloud/dialogs'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'Top',
|
name: 'TopList',
|
||||||
components: {
|
components: {
|
||||||
NcLoadingIcon,
|
NcLoadingIcon,
|
||||||
NcSelect,
|
NcSelect,
|
||||||
|
TopItem,
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@ -72,11 +74,6 @@ export default {
|
|||||||
flex-basis: 15%;
|
flex-basis: 15%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tops li img {
|
|
||||||
height: 100%;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.select {
|
.select {
|
||||||
min-width: 160px;
|
min-width: 160px;
|
||||||
}
|
}
|
@ -5,7 +5,7 @@
|
|||||||
<Magnify :size="20" />
|
<Magnify :size="20" />
|
||||||
</NcTextField>
|
</NcTextField>
|
||||||
</p>
|
</p>
|
||||||
<Top v-if="!search" />
|
<TopList v-if="!search" />
|
||||||
<AddRss v-if="!search" />
|
<AddRss v-if="!search" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@ -14,7 +14,7 @@
|
|||||||
import AddRss from '../components/AddRss.vue'
|
import AddRss from '../components/AddRss.vue'
|
||||||
import Magnify from 'vue-material-design-icons/Magnify.vue'
|
import Magnify from 'vue-material-design-icons/Magnify.vue'
|
||||||
import { NcTextField } from '@nextcloud/vue'
|
import { NcTextField } from '@nextcloud/vue'
|
||||||
import Top from '../components/Top.vue'
|
import TopList from '../components/TopList.vue'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'Discover',
|
name: 'Discover',
|
||||||
@ -22,7 +22,7 @@ export default {
|
|||||||
AddRss,
|
AddRss,
|
||||||
Magnify,
|
Magnify,
|
||||||
NcTextField,
|
NcTextField,
|
||||||
Top,
|
TopList,
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
Loading…
Reference in New Issue
Block a user