Now you can only ask for one song at a time (in the contest)
This commit is contained in:
parent
960e43f840
commit
db97fe0e7e
18
karaoke.py
18
karaoke.py
|
@ -14,6 +14,24 @@ import json
|
||||||
|
|
||||||
bp = Blueprint("karaoke", url_prefix="/manage/karaoke")
|
bp = Blueprint("karaoke", url_prefix="/manage/karaoke")
|
||||||
|
|
||||||
|
@bp.get("/admin")
|
||||||
|
async def show_songs(request, order: Order):
|
||||||
|
|
||||||
|
if order.code not in ['9YKGJ', 'CMPQG']:
|
||||||
|
raise exceptions.Forbidden("Birichino")
|
||||||
|
|
||||||
|
orders = [x for x in request.app.ctx.om.cache.values() if x.karaoke_songs]
|
||||||
|
|
||||||
|
songs = []
|
||||||
|
for o in orders:
|
||||||
|
if not o.karaoke_songs: continue
|
||||||
|
|
||||||
|
for song, data in o.karaoke_songs.items():
|
||||||
|
songs.append({'song': song, 'order': o, **data})
|
||||||
|
|
||||||
|
tpl = request.app.ctx.tpl.get_template('karaoke_admin.html')
|
||||||
|
return html(tpl.render(songs=songs))
|
||||||
|
|
||||||
@bp.post("/add")
|
@bp.post("/add")
|
||||||
async def add_song(request, order: Order):
|
async def add_song(request, order: Order):
|
||||||
if not order: raise exceptions.Forbidden("You have been logged out. Please access the link in your E-Mail to login again!")
|
if not order: raise exceptions.Forbidden("You have been logged out. Please access the link in your E-Mail to login again!")
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
<p>Singing is the spirit of Karaoke! If you like doing it join us for some fun with your favourite songs!<br />You can still just come to the desk and ask for a song, but keep in mind we will always give priority to requests that came through the form. Also, special matters or difficult to find songs will only be honored by the form!</p>
|
<p>Singing is the spirit of Karaoke! If you like doing it join us for some fun with your favourite songs!<br />You can still just come to the desk and ask for a song, but keep in mind we will always give priority to requests that came through the form. Also, special matters or difficult to find songs will only be honored by the form!</p>
|
||||||
<h3>Participate in the contest!</h3>
|
<h3>Participate in the contest!</h3>
|
||||||
<p>You can either decide to just sing, or let others vote you (anonymously) and try to win the prize! If you wish to send a song for the contest, make sure to toggle the appropriate option.</p>
|
<p>You can either decide to just sing, or let others vote you (anonymously) and try to win the prize! If you wish to send a song for the contest, make sure to toggle the appropriate option.</p>
|
||||||
|
{% set ns = namespace(contest=false) %}
|
||||||
{% if order.karaoke_songs %}
|
{% if order.karaoke_songs %}
|
||||||
<h2>Your requests</h2>
|
<h2>Your requests</h2>
|
||||||
<table>
|
<table>
|
||||||
|
@ -13,7 +14,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
{% for song, data in order.karaoke_songs.items() %}
|
{% for song, data in order.karaoke_songs.items() %}
|
||||||
<tr>
|
<tr>
|
||||||
<td>{% if data['contest'] %}🎵{% else %}🏆{% endif %} {{song}}</td>
|
<td>{% if data['contest'] %}🏆{% set ns.contest = true %}{% else %}🎵{% endif %} {{song}}</td>
|
||||||
<td>{% if data['approved'] %}<span style="color:#090;">Approved</span>{% elif data['approved'] is none %}<span style="color:#990;">Pending</span>{% else %}<span style="color:#900;">Rejected</span>{% endif %}</td>
|
<td>{% if data['approved'] %}<span style="color:#090;">Approved</span>{% elif data['approved'] is none %}<span style="color:#990;">Pending</span>{% else %}<span style="color:#900;">Rejected</span>{% endif %}</td>
|
||||||
<td>{% if data['approved'] is none %}<a role="button" href="karaoke/delete/{{song|urlencode}}">Delete</a>{% endif %}</td>
|
<td>{% if data['approved'] is none %}<a role="button" href="karaoke/delete/{{song|urlencode}}">Delete</a>{% endif %}</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -24,7 +25,7 @@
|
||||||
<h3>Request a new song</h3>
|
<h3>Request a new song</h3>
|
||||||
<form method="POST" action="karaoke/add">
|
<form method="POST" action="karaoke/add">
|
||||||
<input type="text" name="song" placeholder="Insert Artist - Title here..." />
|
<input type="text" name="song" placeholder="Insert Artist - Title here..." />
|
||||||
<label style="margin-bottom:2em;" for="switch"><input type="checkbox" name="wants_contest" role="switch"> I want to partecipate in the contest</label>
|
<label style="margin-bottom:2em;" for="switch"><input type="checkbox" name="wants_contest" role="switch" {% if ns.contest %}disabled{% endif %}> {% if ns.contest %}<strike>{% endif %}This song is for the contest{% if ns.contest %}</strike> You already have a song for the contest!{% endif %}</label>
|
||||||
<input type="submit" value="Submit" />
|
<input type="submit" value="Submit" />
|
||||||
</form>
|
</form>
|
||||||
</details>
|
</details>
|
||||||
|
|
Loading…
Reference in New Issue