mirror of
https://github.com/krateng/maloja.git
synced 2025-04-20 02:27:38 +03:00
Added pyhp partials for tile charts
This commit is contained in:
parent
33cea26a79
commit
2ae293a889
@ -698,6 +698,12 @@ table.tiles_3x3 td {
|
||||
width:33.333%;
|
||||
font-size:70%
|
||||
}
|
||||
table.tiles_4x4 td {
|
||||
font-size:50%
|
||||
}
|
||||
table.tiles_5x5 td {
|
||||
font-size:40%
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -10,15 +10,18 @@
|
||||
</head>
|
||||
|
||||
<pyhp>
|
||||
# this is temporary! all modules need to be converted into partials at some point
|
||||
html_charts, rep = htmlmodules.module_artistcharts(**amountkeys,**limitkeys)
|
||||
try:
|
||||
top = db.get_charts_artists(**filterkeys,**limitkeys)[0]["artist"]
|
||||
img = utilities.getArtistImage(top)
|
||||
except:
|
||||
img = ""
|
||||
</pyhp>
|
||||
|
||||
<body>
|
||||
<table class="top_info">
|
||||
<tr>
|
||||
<td class="image">
|
||||
<div style="background-image:url('{utilities.getArtistImage(rep) if rep is not None else 0}')"></div>
|
||||
<div style="background-image:url('{img}')"></div>
|
||||
</td>
|
||||
<td class="text">
|
||||
<h1>Artist Charts</h1><a href="/top_artists"><span>View #1 Artists</span></a><br/>
|
||||
@ -32,8 +35,9 @@
|
||||
|
||||
<span class="stat_module_topartists">
|
||||
<pyhp if="settings('CHARTS_DISPLAY_TILES')">
|
||||
<pyhp echo="htmlmodules.module_artistcharts_tiles(timerange=limitkeys['timerange'])" />
|
||||
<pyhp include="partial/charts_artists_tiles.pyhp" />
|
||||
</pyhp>
|
||||
|
||||
</span>
|
||||
|
||||
<pyhp include="partial/charts_artists.pyhp" />
|
||||
|
@ -10,15 +10,21 @@
|
||||
</head>
|
||||
|
||||
<pyhp>
|
||||
# this is temporary! all modules need to be converted into partials at some point
|
||||
html_charts, rep = htmlmodules.module_trackcharts(**amountkeys,**limitkeys)
|
||||
try:
|
||||
try:
|
||||
img = utilities.getArtistImage(filterkeys['artist'])
|
||||
except:
|
||||
top = db.get_charts_tracks(**filterkeys,**limitkeys)[0]["track"]
|
||||
img = utilities.getTrackImage(**top)
|
||||
except:
|
||||
img = ""
|
||||
</pyhp>
|
||||
|
||||
<body>
|
||||
<table class="top_info">
|
||||
<tr>
|
||||
<td class="image">
|
||||
<div style="background-image:url('{utilities.getArtistImage(filterkeys.get('artist')) if filterkeys.get('artist') is not None else (utilities.getTrackImage(rep) if rep is not None else 0)}')"></div>
|
||||
<div style="background-image:url('{img}')"></div>
|
||||
</td>
|
||||
<td class="text">
|
||||
<h1>Track Charts</h1><a href="/top_tracks"><span>View #1 Tracks</span></a><br/>
|
||||
@ -35,8 +41,9 @@
|
||||
|
||||
<span class="stat_module_toptracks">
|
||||
<pyhp if="settings('CHARTS_DISPLAY_TILES')">
|
||||
<pyhp echo="htmlmodules.module_trackcharts_tiles(timerange=limitkeys['timerange'])" />
|
||||
<pyhp include="partial/charts_tracks_tiles.pyhp" />
|
||||
</pyhp>
|
||||
|
||||
</span>
|
||||
|
||||
<pyhp include="partial/charts_tracks.pyhp" />
|
||||
|
49
maloja/web/partial/charts_artists_tiles.pyhp
Normal file
49
maloja/web/partial/charts_artists_tiles.pyhp
Normal file
@ -0,0 +1,49 @@
|
||||
<pyhp>
|
||||
num_levels = 3
|
||||
</pyhp>
|
||||
|
||||
|
||||
<pyhp import="math" />
|
||||
|
||||
|
||||
<pyhp save="db.get_charts_artists(**filterkeys,**limitkeys)" as="artists" />
|
||||
<pyhp save="iter(artists)" as="artists_iterator" />
|
||||
|
||||
|
||||
|
||||
<table class="tiles_top">
|
||||
<tr>
|
||||
<pyhp for="level" in="range(1,num_levels+1)">
|
||||
<td><table class="tiles_{level}x{level} tiles_sub">
|
||||
<pyhp for="row" in="range(level)">
|
||||
<tr>
|
||||
<pyhp for="column" in="range(level)">
|
||||
<pyhp>
|
||||
try:
|
||||
entry = next(artists_iterator)
|
||||
artist = entry['artist']
|
||||
rank = entry['rank']
|
||||
except:
|
||||
artist = None
|
||||
</pyhp>
|
||||
<pyhp if="artist is None">
|
||||
<td><span class='stats'></span> <span></span></td>
|
||||
</pyhp>
|
||||
<pyhp if="artist is not None">
|
||||
<td onclick='window.location.href="{htmlgenerators.link_address(artist)}"'
|
||||
style='cursor:pointer;background-image:url("{utilities.getArtistImage(artist,fast=True)}");'>
|
||||
<span class='stats'>
|
||||
#<pyhp echo="rank" />
|
||||
</span>
|
||||
<span>
|
||||
<pyhp echo="htmlgenerators.html_link(artist)" />
|
||||
</span>
|
||||
</td>
|
||||
</pyhp>
|
||||
</pyhp>
|
||||
</tr>
|
||||
</pyhp>
|
||||
</table></td>
|
||||
</pyhp>
|
||||
</tr>
|
||||
</table>
|
51
maloja/web/partial/charts_tracks_tiles.pyhp
Normal file
51
maloja/web/partial/charts_tracks_tiles.pyhp
Normal file
@ -0,0 +1,51 @@
|
||||
<pyhp>
|
||||
num_levels = 3
|
||||
</pyhp>
|
||||
|
||||
|
||||
<pyhp import="math" />
|
||||
|
||||
|
||||
<pyhp save="db.get_charts_tracks(**filterkeys,**limitkeys)" as="tracks" />
|
||||
<pyhp save="iter(tracks)" as="tracks_iterator" />
|
||||
|
||||
|
||||
|
||||
<table class="tiles_top">
|
||||
<tr>
|
||||
<pyhp for="level" in="range(1,num_levels+1)">
|
||||
<td><table class="tiles_{level}x{level} tiles_sub">
|
||||
<pyhp for="row" in="range(level)">
|
||||
<tr>
|
||||
<pyhp for="column" in="range(level)">
|
||||
<pyhp>
|
||||
try:
|
||||
entry = next(tracks_iterator)
|
||||
track = entry['track']
|
||||
artists = track['artists']
|
||||
title = track['title']
|
||||
rank = entry['rank']
|
||||
except:
|
||||
track = None
|
||||
</pyhp>
|
||||
<pyhp if="track is None">
|
||||
<td><span class='stats'></span> <span></span></td>
|
||||
</pyhp>
|
||||
<pyhp if="track is not None">
|
||||
<td onclick='window.location.href="{htmlgenerators.link_address(track)}"'
|
||||
style='cursor:pointer;background-image:url("{utilities.getTrackImage(artists,title,fast=True)}");'>
|
||||
<span class='stats'>
|
||||
#<pyhp echo="rank" />
|
||||
</span>
|
||||
<span>
|
||||
<pyhp echo="htmlgenerators.html_link(track)" />
|
||||
</span>
|
||||
</td>
|
||||
</pyhp>
|
||||
</pyhp>
|
||||
</tr>
|
||||
</pyhp>
|
||||
</table></td>
|
||||
</pyhp>
|
||||
</tr>
|
||||
</table>
|
Loading…
x
Reference in New Issue
Block a user