Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
B
Backend Server
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
SpinShare
Backend Server
Commits
bf43c4f9
Commit
bf43c4f9
authored
Apr 16, 2020
by
Andreas Heimann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added pagination to index
parent
d57adb56
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
6 deletions
+28
-6
public/assets/css/main.css
public/assets/css/main.css
+2
-0
public/assets/css/main.less
public/assets/css/main.less
+2
-0
src/Controller/IndexController.php
src/Controller/IndexController.php
+6
-4
templates/index/index.html.twig
templates/index/index.html.twig
+18
-2
No files found.
public/assets/css/main.css
View file @
bf43c4f9
...
...
@@ -125,9 +125,11 @@ button:focus,
display
:
flex
;
justify-content
:
center
;
align-items
:
center
;
color
:
#fff
;
}
.song-row
.song-header
.row-controls
.item.disabled
{
opacity
:
0.4
;
pointer-events
:
none
;
}
.song-row
.song-header
.row-controls
.item
:not
(
.disabled
)
:hover
{
background
:
rgba
(
255
,
255
,
255
,
0.2
);
...
...
public/assets/css/main.less
View file @
bf43c4f9
...
...
@@ -129,9 +129,11 @@ button, .button {
display: flex;
justify-content: center;
align-items: center;
color: #fff;
&.disabled {
opacity: 0.4;
pointer-events: none;
}
&:not(.disabled):hover {
...
...
src/Controller/IndexController.php
View file @
bf43c4f9
...
...
@@ -25,15 +25,17 @@ class IndexController extends AbstractController
$activePromos
=
$em
->
getRepository
(
Promo
::
class
)
->
findBy
(
array
(
'isVisible'
=>
true
),
array
(
'id'
=>
'DESC'
),
2
);
$newOffset
=
$request
->
query
->
get
(
'newOffset'
)
*
6
;
$popularOffset
=
$request
->
query
->
get
(
'popularOffset'
)
*
6
;
$newOffset
=
$request
->
query
->
get
(
'newOffset'
);
$popularOffset
=
$request
->
query
->
get
(
'popularOffset'
);
$resultsNewSongs
=
$em
->
getRepository
(
Song
::
class
)
->
findBy
(
array
(),
array
(
'id'
=>
'DESC'
),
6
,
$newOffset
);
$resultsPopularSongs
=
$em
->
getRepository
(
Song
::
class
)
->
findBy
(
array
(),
array
(
'downloads'
=>
'DESC'
,
'views'
=>
'DESC'
),
6
,
$popularOffset
);
$resultsNewSongs
=
$em
->
getRepository
(
Song
::
class
)
->
findBy
(
array
(),
array
(
'id'
=>
'DESC'
),
6
,
$newOffset
*
6
);
$resultsPopularSongs
=
$em
->
getRepository
(
Song
::
class
)
->
findBy
(
array
(),
array
(
'downloads'
=>
'DESC'
,
'views'
=>
'DESC'
),
6
,
$popularOffset
*
6
);
$data
[
'promos'
]
=
$activePromos
;
$data
[
'newSongs'
]
=
$resultsNewSongs
;
$data
[
'newOffset'
]
=
$newOffset
;
$data
[
'popularSongs'
]
=
$resultsPopularSongs
;
$data
[
'popularOffset'
]
=
$popularOffset
;
return
$this
->
render
(
'index/index.html.twig'
,
$data
);
}
...
...
templates/index/index.html.twig
View file @
bf43c4f9
...
...
@@ -26,7 +26,15 @@
</div>
<div
class=
"song-row song-row-new"
>
<div
class=
"song-header"
>
<div
class=
"row-title row-title-noactions"
>
New Songs
</div>
<div
class=
"row-title"
>
New Songs
</div>
<div
class=
"row-controls"
>
{%
if
newOffset
>
0
%}
<a
href=
"
{{
path
(
'index.index'
,
{
newOffset
:
newOffset
-
1
}
)
}}
"
class=
"item row-controls-previous"
><i
class=
"mdi mdi-chevron-left"
></i></a>
{%
else
%}
<a
href=
"#"
class=
"item disabled row-controls-previous"
><i
class=
"mdi mdi-chevron-left"
></i></a>
{%
endif
%}
<a
href=
"
{{
path
(
'index.index'
,
{
newOffset
:
newOffset
+
1
}
)
}}
"
class=
"item row-controls-next"
><i
class=
"mdi mdi-chevron-right"
></i></a>
</div>
</div>
<div
class=
"song-list"
>
{%
for
song
in
newSongs
%}
...
...
@@ -53,7 +61,15 @@
</div>
<div
class=
"song-row song-row-popular"
>
<div
class=
"song-header"
>
<div
class=
"row-title row-title-noactions"
>
Popular Songs
</div>
<div
class=
"row-title"
>
Popular Songs
</div>
<div
class=
"row-controls"
>
{%
if
popularOffset
>
0
%}
<a
href=
"
{{
path
(
'index.index'
,
{
popularOffset
:
popularOffset
-
1
}
)
}}
"
class=
"item row-controls-previous"
><i
class=
"mdi mdi-chevron-left"
></i></a>
{%
else
%}
<a
href=
"#"
class=
"item disabled row-controls-previous"
><i
class=
"mdi mdi-chevron-left"
></i></a>
{%
endif
%}
<a
href=
"
{{
path
(
'index.index'
,
{
popularOffset
:
popularOffset
+
1
}
)
}}
"
class=
"item row-controls-next"
><i
class=
"mdi mdi-chevron-right"
></i></a>
</div>
</div>
<div
class=
"song-list"
>
{%
for
song
in
popularSongs
%}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment