Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
funkwhale
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Zwordi
funkwhale
Commits
c4991796
Commit
c4991796
authored
7 years ago
by
Bat
Browse files
Options
Downloads
Patches
Plain Diff
Add some pagination to radio details
parent
85aef442
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
api/funkwhale_api/radios/views.py
+5
-6
5 additions, 6 deletions
api/funkwhale_api/radios/views.py
front/src/views/radios/Detail.vue
+26
-3
26 additions, 3 deletions
front/src/views/radios/Detail.vue
with
31 additions
and
9 deletions
api/funkwhale_api/radios/views.py
+
5
−
6
View file @
c4991796
...
...
@@ -45,12 +45,11 @@ class RadioViewSet(
def
tracks
(
self
,
request
,
*
args
,
**
kwargs
):
radio
=
self
.
get_object
()
tracks
=
radio
.
get_candidates
().
for_nested_serialization
()
serializer
=
TrackSerializerNested
(
tracks
,
many
=
True
)
data
=
{
'
count
'
:
len
(
tracks
),
'
results
'
:
serializer
.
data
}
return
Response
(
data
,
status
=
200
)
page
=
self
.
paginate_queryset
(
tracks
)
if
page
is
not
None
:
serializer
=
TrackSerializerNested
(
page
,
many
=
True
)
return
self
.
get_paginated_response
(
serializer
.
data
)
@list_route
(
methods
=
[
'
get
'
])
def
filters
(
self
,
request
,
*
args
,
**
kwargs
):
...
...
This diff is collapsed.
Click to expand it.
front/src/views/radios/Detail.vue
+
26
−
3
View file @
c4991796
...
...
@@ -32,6 +32,15 @@
<div
class=
"ui vertical stripe segment"
>
<h2>
Tracks
</h2>
<track-table
:tracks=
"tracks"
></track-table>
<div
class=
"ui center aligned basic segment"
>
<pagination
v-if=
"totalTracks > 25"
@
page-changed=
"selectPage"
:current=
"page"
:paginate-by=
"25"
:total=
"totalTracks"
></pagination>
</div>
</div>
</div>
</
template
>
...
...
@@ -40,6 +49,7 @@
import
axios
from
'
axios
'
import
TrackTable
from
'
@/components/audio/track/Table
'
import
RadioButton
from
'
@/components/radios/Button
'
import
Pagination
from
'
@/components/Pagination
'
export
default
{
props
:
{
...
...
@@ -47,26 +57,34 @@ export default {
},
components
:
{
TrackTable
,
RadioButton
RadioButton
,
Pagination
},
data
:
function
()
{
return
{
isLoading
:
false
,
radio
:
null
,
tracks
:
[]
tracks
:
[],
totalTracks
:
0
,
page
:
1
}
},
created
:
function
()
{
this
.
fetch
()
},
methods
:
{
selectPage
:
function
(
page
)
{
this
.
page
=
page
},
fetch
:
function
()
{
let
self
=
this
self
.
isLoading
=
true
let
url
=
'
radios/radios/
'
+
this
.
id
+
'
/
'
axios
.
get
(
url
).
then
((
response
)
=>
{
self
.
radio
=
response
.
data
axios
.
get
(
url
+
'
tracks
'
).
then
((
response
)
=>
{
axios
.
get
(
url
+
'
tracks
'
,
{
params
:
{
page
:
this
.
page
}}).
then
((
response
)
=>
{
console
.
log
(
response
.
data
.
count
)
this
.
totalTracks
=
response
.
data
.
count
this
.
tracks
=
response
.
data
.
results
}).
then
(()
=>
{
self
.
isLoading
=
false
...
...
@@ -82,6 +100,11 @@ export default {
})
})
}
},
watch
:
{
page
:
function
()
{
this
.
fetch
()
}
}
}
</
script
>
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment