mirror of
https://github.com/krateng/maloja.git
synced 2023-08-10 21:12:55 +03:00
Replaced remaining htmlgenerator calls
This commit is contained in:
parent
f7ca7b0dc9
commit
6ca88685bf
@ -1,7 +1,7 @@
|
|||||||
from .. import database_packed
|
from .. import database_packed
|
||||||
from . import filters
|
from . import filters
|
||||||
|
|
||||||
from .. import database, database_packed, htmlgenerators, malojatime, utilities, urihandler, malojauri
|
from .. import database, database_packed, malojatime, utilities, urihandler, malojauri
|
||||||
from doreah import settings
|
from doreah import settings
|
||||||
|
|
||||||
import urllib
|
import urllib
|
||||||
@ -16,7 +16,6 @@ JINJA_CONTEXT = {
|
|||||||
# maloja
|
# maloja
|
||||||
"db": database,
|
"db": database,
|
||||||
"dbp":dbp,
|
"dbp":dbp,
|
||||||
"htmlgenerators": htmlgenerators,
|
|
||||||
"malojatime": malojatime,
|
"malojatime": malojatime,
|
||||||
"utilities": utilities,
|
"utilities": utilities,
|
||||||
"urihandler": urihandler,
|
"urihandler": urihandler,
|
||||||
|
@ -11,7 +11,6 @@ import waitress
|
|||||||
from . import monkey
|
from . import monkey
|
||||||
# rest of the project
|
# rest of the project
|
||||||
from . import database
|
from . import database
|
||||||
from . import htmlgenerators
|
|
||||||
from . import malojatime
|
from . import malojatime
|
||||||
from . import utilities
|
from . import utilities
|
||||||
from . import malojauri
|
from . import malojauri
|
||||||
|
@ -19,7 +19,9 @@
|
|||||||
{% if adminmode %}
|
{% if adminmode %}
|
||||||
You are only seeing this information because you are in admin mode:
|
You are only seeing this information because you are in admin mode:
|
||||||
<br/><br/>
|
<br/><br/>
|
||||||
<div style="white-space: pre-wrap; font-family: monospace;">{{ traceback }}</div>
|
<div style="white-space: pre-wrap; font-family: monospace;">{% autoescape true -%}
|
||||||
|
{{ traceback }}
|
||||||
|
{%- endautoescape %}</div>
|
||||||
{% else %}
|
{% else %}
|
||||||
A team of Korean schoolgirls with katanas has been dispatched to deal with this situation.
|
A team of Korean schoolgirls with katanas has been dispatched to deal with this situation.
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
@ -53,8 +53,8 @@
|
|||||||
{{ entityrow.row(e['artist']) }}
|
{{ entityrow.row(e['artist']) }}
|
||||||
|
|
||||||
<!-- scrobbles -->
|
<!-- scrobbles -->
|
||||||
<td class="amount">{{ htmlgenerators.scrobblesArtistLink(e['artist'],urihandler.internal_to_uri(limitkeys),amount=e['scrobbles']) }}</td>
|
<td class="amount">{{ links.link_scrobbles([{'artist':e['artist'],'timerange':limitkeys.timerange}],amount=e['scrobbles']) }}</td>
|
||||||
<td class="bar">{{ htmlgenerators.scrobblesArtistLink(e['artist'],urihandler.internal_to_uri(limitkeys),percent=e['scrobbles']*100/maxbar) }}</td>
|
<td class="bar">{{ links.link_scrobbles([{'artist':e['artist'],'timerange':limitkeys.timerange}],percent=e['scrobbles']*100/maxbar) }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
@ -50,8 +50,8 @@
|
|||||||
{{ entityrow.row(e['track']) }}
|
{{ entityrow.row(e['track']) }}
|
||||||
|
|
||||||
<!-- scrobbles -->
|
<!-- scrobbles -->
|
||||||
<td class="amount">{{ htmlgenerators.scrobblesTrackLink(e['track'],urihandler.internal_to_uri(limitkeys),amount=e['scrobbles']) }}</td>
|
<td class="amount">{{ links.link_scrobbles([{'track':e.track,'timerange':limitkeys.timerange}],amount=e['scrobbles']) }}</td>
|
||||||
<td class="bar">{{ htmlgenerators.scrobblesTrackLink(e['track'],urihandler.internal_to_uri(limitkeys),percent=e['scrobbles']*100/maxbar) }}</td>
|
<td class="bar">{{ links.link_scrobbles([{'track':e.track,'timerange':limitkeys.timerange}],percent=e['scrobbles']*100/maxbar) }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
@ -13,11 +13,11 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td>{{ thisrange.desc() }}</td>
|
<td>{{ thisrange.desc() }}</td>
|
||||||
<td class="rank">
|
<td class="rank">
|
||||||
{{ '#' + t.rank.__str__() if t.rank is not none else 'n/a' }}
|
{{ links.link_rank(filterkeys,thisrange,rank=t.rank) }}
|
||||||
</td>
|
</td>
|
||||||
<td class="chart">
|
<td class="chart">
|
||||||
{% set prct = ((minrank+1-t.rank)*100/minrank if t.rank is not none else 0) %}
|
{% set prct = ((minrank+1-t.rank)*100/minrank if t.rank is not none else 0) %}
|
||||||
{{ htmlgenerators.rankLink(thisrange.urikeys(),percent=prct,medal=t.rank,**filterkeys) }}
|
{{ links.link_rank(filterkeys,thisrange,percent=prct,rank=t.rank) }}
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
{% import 'snippets/links.jinja' as links %}
|
||||||
|
|
||||||
{% set ranges = dbp.get_pulse(filterkeys,limitkeys,delimitkeys) %}
|
{% set ranges = dbp.get_pulse(filterkeys,limitkeys,delimitkeys) %}
|
||||||
|
|
||||||
{% set maxbar = ranges|map(attribute="scrobbles")|max|default(1) %}
|
{% set maxbar = ranges|map(attribute="scrobbles")|max|default(1) %}
|
||||||
@ -10,10 +12,10 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td>{{ thisrange.desc() }}</td>
|
<td>{{ thisrange.desc() }}</td>
|
||||||
<td class="amount">
|
<td class="amount">
|
||||||
{{ htmlgenerators.scrobblesLink(thisrange.urikeys(),amount=t.scrobbles,**filterkeys) }}
|
{{ links.link_scrobbles([filterkeys,{'timerange':thisrange}],amount=t.scrobbles) }}
|
||||||
</td>
|
</td>
|
||||||
<td class="bar">
|
<td class="bar">
|
||||||
{{ htmlgenerators.scrobblesLink(thisrange.urikeys(),percent=t.scrobbles*100/maxbar,**filterkeys) }}
|
{{ links.link_scrobbles([filterkeys,{'timerange':thisrange}],percent=t.scrobbles*100/maxbar) }}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
{% import 'snippets/links.jinja' as links %}
|
||||||
|
{% import 'snippets/entityrow.jinja' as entityrow %}
|
||||||
|
|
||||||
{% set ranges = dbp.get_top_artists(limitkeys,delimitkeys) %}
|
{% set ranges = dbp.get_top_artists(limitkeys,delimitkeys) %}
|
||||||
|
|
||||||
{% set maxbar = ranges|map(attribute="scrobbles")|max|default(1) %}
|
{% set maxbar = ranges|map(attribute="scrobbles")|max|default(1) %}
|
||||||
@ -17,9 +20,9 @@
|
|||||||
<td class='amount'>0</td>
|
<td class='amount'>0</td>
|
||||||
<td class='bar'></td>
|
<td class='bar'></td>
|
||||||
{% else %}
|
{% else %}
|
||||||
{{ htmlgenerators.entity_column(artist,image=utilities.getArtistImage(artist,fast=True)) }}
|
{{ entityrow.row(artist) }}
|
||||||
<td class='amount'>{{ htmlgenerators.scrobblesArtistLink(artist,thisrange.urikeys(),amount=e.scrobbles) }}</td>
|
<td class='amount'>{{ links.link_scrobbles([{'artist':artist,'timerange':thisrange}],amount=e.scrobbles) }}</td>
|
||||||
<td class='bar'> {{ htmlgenerators.scrobblesArtistLink(artist,thisrange.urikeys(),percent=e.scrobbles*100/maxbar) }}</td>
|
<td class='bar'> {{ links.link_scrobbles([{'artist':artist,'timerange':thisrange}],percent=e.scrobbles*100/maxbar) }}</td>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
{% import 'snippets/links.jinja' as links %}
|
||||||
|
{% import 'snippets/entityrow.jinja' as entityrow %}
|
||||||
|
|
||||||
{% set ranges = dbp.get_top_tracks(filterkeys,limitkeys,delimitkeys) %}
|
{% set ranges = dbp.get_top_tracks(filterkeys,limitkeys,delimitkeys) %}
|
||||||
|
|
||||||
{% set maxbar = ranges|map(attribute="scrobbles")|max|default(1) %}
|
{% set maxbar = ranges|map(attribute="scrobbles")|max|default(1) %}
|
||||||
@ -17,9 +20,9 @@
|
|||||||
<td class='amount'>0</td>
|
<td class='amount'>0</td>
|
||||||
<td class='bar'></td>
|
<td class='bar'></td>
|
||||||
{% else %}
|
{% else %}
|
||||||
{{ htmlgenerators.entity_column(track,image=utilities.getTrackImage(track.artists,track.title,fast=True)) }}
|
{{ entityrow.row(track) }}
|
||||||
<td class='amount'>{{ htmlgenerators.scrobblesTrackLink(track,thisrange.urikeys(),amount=e.scrobbles) }}</td>
|
<td class='amount'>{{ links.link_scrobbles([{'track':track,'timerange':thisrange}],amount=e.scrobbles) }}</td>
|
||||||
<td class='bar'> {{ htmlgenerators.scrobblesTrackLink(track,thisrange.urikeys(),percent=e.scrobbles*100/maxbar) }}</td>
|
<td class='bar'> {{ links.link_scrobbles([{'track':track,'timerange':thisrange}],percent=e.scrobbles*100/maxbar) }}</td>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -23,3 +23,37 @@
|
|||||||
{{ mlj_uri.create_uri("/artist",{'artist':entity}) }}
|
{{ mlj_uri.create_uri("/artist",{'artist':entity}) }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{%- endmacro %}
|
{%- endmacro %}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
{% macro link_scrobbles(keydicts,amount=None,percent=None) %}
|
||||||
|
|
||||||
|
<a href='{{ mlj_uri.create_uri("/scrobbles",*keydicts) }}'>
|
||||||
|
{% if percent is not none %}
|
||||||
|
<div style='width:{{ percent }}%;'></div>
|
||||||
|
{% elif amount is not none %}
|
||||||
|
{{ amount }}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
</a>
|
||||||
|
{%- endmacro %}
|
||||||
|
|
||||||
|
|
||||||
|
{% macro link_rank(filterkeys,timerange,rank=None,percent=None) %}
|
||||||
|
|
||||||
|
{% if 'track' in filterkeys %}
|
||||||
|
{% set url = mlj_uri.create_uri("/charts_track",{'timerange':timerange}) %}
|
||||||
|
{% elif 'artist' in filterkeys %}
|
||||||
|
{% set url = mlj_uri.create_uri("/charts_artists",{'timerange':timerange}) %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% set rankclass = {1:'gold',2:'silver',3:'bronze'}[rank] or "" %}
|
||||||
|
|
||||||
|
<a href='{{ url }}'>
|
||||||
|
{% if percent is not none %}
|
||||||
|
<div class=" {{ rankclass }}" style='width: {{ percent }}%;'></div>
|
||||||
|
{% else %}
|
||||||
|
{% if rank is not none %}#{{ rank }}{% else %}n/a{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
</a>
|
||||||
|
{%- endmacro %}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user