Initial idea for sliders
This commit is contained in:
parent
56b1358f0a
commit
4bda1cd8f1
|
@ -178,6 +178,7 @@
|
||||||
<translate translate-context="*/*/*">New channels</translate>
|
<translate translate-context="*/*/*">New channels</translate>
|
||||||
</h3>
|
</h3>
|
||||||
<channels-widget :show-modification-date="true" :limit="10" :filters="{ordering: '-creation_date', external: 'false'}"></channels-widget>
|
<channels-widget :show-modification-date="true" :limit="10" :filters="{ordering: '-creation_date', external: 'false'}"></channels-widget>
|
||||||
|
<album-slider :filters="{playable: true, ordering: '-creation_date'}" :limit="10"></album-slider>
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
</main>
|
</main>
|
||||||
|
@ -189,6 +190,7 @@ import _ from '@/lodash'
|
||||||
import {mapState} from 'vuex'
|
import {mapState} from 'vuex'
|
||||||
import showdown from 'showdown'
|
import showdown from 'showdown'
|
||||||
import AlbumWidget from "@/components/audio/album/Widget"
|
import AlbumWidget from "@/components/audio/album/Widget"
|
||||||
|
import AlbumSlider from "@/components/audio/album/Slider"
|
||||||
import ChannelsWidget from "@/components/audio/ChannelsWidget"
|
import ChannelsWidget from "@/components/audio/ChannelsWidget"
|
||||||
import LoginForm from "@/components/auth/LoginForm"
|
import LoginForm from "@/components/auth/LoginForm"
|
||||||
import SignupForm from "@/components/auth/SignupForm"
|
import SignupForm from "@/components/auth/SignupForm"
|
||||||
|
@ -200,6 +202,7 @@ export default {
|
||||||
ChannelsWidget,
|
ChannelsWidget,
|
||||||
LoginForm,
|
LoginForm,
|
||||||
SignupForm,
|
SignupForm,
|
||||||
|
AlbumSlider,
|
||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -0,0 +1,84 @@
|
||||||
|
<template>
|
||||||
|
<div class="wrapper">
|
||||||
|
<div class="ui two column grid">
|
||||||
|
<div class="column">
|
||||||
|
<h3 v-if="!!this.$slots.title" class="ui header">
|
||||||
|
<slot name="title"></slot>
|
||||||
|
</h3>
|
||||||
|
<slot></slot>
|
||||||
|
</div>
|
||||||
|
<div class="column">
|
||||||
|
<button :class="['right', 'floated', 'circular', 'icon', 'ui', {'disabled': !nextPage}, 'button',]" @click.prevent="fetchData(nextPage)">
|
||||||
|
<i class="right arrow icon"></i>
|
||||||
|
</button>
|
||||||
|
<button :class="['right', 'floated', 'circular', 'icon', 'ui', {'disabled': !previousPage}, 'button',]" @click.prevent="fetchData(previousPage)">
|
||||||
|
<i class="left arrow icon"></i>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="ui hidden divider"></div>
|
||||||
|
<div class="ui app-cards cards">
|
||||||
|
<div v-if="isLoading" class="ui inverted active dimmer">
|
||||||
|
<div class="ui loader"></div>
|
||||||
|
</div>
|
||||||
|
<album-card v-for="album in albums" :album="album" :key="album.id" />
|
||||||
|
</div>
|
||||||
|
<template v-if="!isLoading && albums.length === 0">
|
||||||
|
<empty-state @refresh="fetchData('albums/')" :refresh="true"></empty-state>
|
||||||
|
</template>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
|
||||||
|
import axios from 'axios'
|
||||||
|
import AlbumCard from '@/components/audio/album/Card'
|
||||||
|
import $ from 'jquery'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
components: {
|
||||||
|
AlbumCard,
|
||||||
|
},
|
||||||
|
props: {
|
||||||
|
limit: {type: Number, default: 4},
|
||||||
|
filters: {type: Object, required: true},
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
albums: [],
|
||||||
|
count: 0,
|
||||||
|
isLoading: false,
|
||||||
|
errors: null,
|
||||||
|
previousPage: null,
|
||||||
|
nextPage: null,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.fetchData()
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
fetchData (url) {
|
||||||
|
url = url || 'albums/'
|
||||||
|
this.isLoading = true
|
||||||
|
let self = this
|
||||||
|
let params = {q: this.query, ...this.filters}
|
||||||
|
params.page_size = this.limit
|
||||||
|
params.offset = this.offset
|
||||||
|
axios.get(url, {params: params}).then((response) => {
|
||||||
|
self.previousPage = response.data.previous
|
||||||
|
self.nextPage = response.data.next
|
||||||
|
self.isLoading = false
|
||||||
|
self.albums = [...response.data.results]
|
||||||
|
self.count = response.data.count
|
||||||
|
}, error => {
|
||||||
|
self.isLoading = false
|
||||||
|
self.errors = error.backendErrors
|
||||||
|
})
|
||||||
|
},
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
$('.component-album-card')
|
||||||
|
.transition('scale')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
|
@ -19,21 +19,15 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="ui section hidden divider"></div>
|
<div class="ui section hidden divider"></div>
|
||||||
<div class="ui stackable one column grid">
|
<album-slider :filters="{scope: scope, playable: true, ordering: '-creation_date'}">
|
||||||
<div class="column">
|
<template slot="title"><translate translate-context="Content/Home/Title">Recently added</translate></template>
|
||||||
<album-widget :filters="{scope: scope, playable: true, ordering: '-creation_date'}">
|
</album-slider>
|
||||||
<template slot="title"><translate translate-context="Content/Home/Title">Recently added</translate></template>
|
|
||||||
</album-widget>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<template v-if="scope === 'all'">
|
<template v-if="scope === 'all'">
|
||||||
<h3 class="ui header" >
|
<h3 class="ui header" >
|
||||||
<translate translate-context="*/*/*">New channels</translate>
|
<translate translate-context="*/*/*">New channels</translate>
|
||||||
</h3>
|
</h3>
|
||||||
<channels-widget :show-modification-date="true" :limit="12" :filters="{ordering: '-creation_date', external: 'false'}"></channels-widget>
|
<channels-widget :show-modification-date="true" :limit="12" :filters="{ordering: '-creation_date', external: 'false'}"></channels-widget>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
</main>
|
</main>
|
||||||
</template>
|
</template>
|
||||||
|
@ -46,6 +40,7 @@ import ChannelsWidget from "@/components/audio/ChannelsWidget"
|
||||||
import ArtistCard from "@/components/audio/artist/Card"
|
import ArtistCard from "@/components/audio/artist/Card"
|
||||||
import TrackWidget from "@/components/audio/track/Widget"
|
import TrackWidget from "@/components/audio/track/Widget"
|
||||||
import AlbumWidget from "@/components/audio/album/Widget"
|
import AlbumWidget from "@/components/audio/album/Widget"
|
||||||
|
import AlbumSlider from "@/components/audio/album/Slider"
|
||||||
import PlaylistWidget from "@/components/playlists/Widget"
|
import PlaylistWidget from "@/components/playlists/Widget"
|
||||||
|
|
||||||
const ARTISTS_URL = "artists/"
|
const ARTISTS_URL = "artists/"
|
||||||
|
@ -62,6 +57,7 @@ export default {
|
||||||
AlbumWidget,
|
AlbumWidget,
|
||||||
PlaylistWidget,
|
PlaylistWidget,
|
||||||
ChannelsWidget,
|
ChannelsWidget,
|
||||||
|
AlbumSlider,
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
|
Loading…
Reference in New Issue