Some more layouting

This commit is contained in:
Feliciaan De Palmenaer 2015-03-28 23:21:43 +01:00
parent 28cd6947a5
commit 75dee4ebbd
2 changed files with 11 additions and 8 deletions

View file

@ -9,15 +9,15 @@
{% if order.can_close(current_user.id) -%} {% if order.can_close(current_user.id) -%}
<a class="btn btn-danger" href="{{ url_for('.close_order', id=order.id) }}">Close</a><br/> <a class="btn btn-danger" href="{{ url_for('.close_order', id=order.id) }}">Close</a><br/>
{%- endif %}</h3> {%- endif %}</h3>
Courrier: {{ order.courrier.username }} courrier: {{ order.courrier.username }}
{% if order.courrier == None and not current_user.is_anonymous() %} {% if order.courrier == None and not current_user.is_anonymous() %}
<a href="{{ url_for('.volunteer', id=order.id) }}" class="btn btn-primary btn-sm">Volunteer</a> <a href="{{ url_for('.volunteer', id=order.id) }}" class="btn btn-primary btn-sm">Volunteer</a>
{% endif %} {% endif %}
<br/> <br/>
Location: <a href="{{ order.location.website }}">{{ order.location.name }}</a><br/> location: <a href="{{ order.location.website }}">{{ order.location.name }}</a><br/>
Starttime: {{ order.starttime }}<br/> opened on {{ order.starttime }}<br/>
Stoptime: {{ order.stoptime }}<br/> <b>status:</b> {% if order.stoptime %}{{ order.stoptime|countdown }}{% else %}open{% endif %}<br/>
Total price: {{ total_price|euro }} total price: {{ total_price|euro }}
</div> </div>
{% if form -%} {% if form -%}
<div class="col-md-push-3 col-md-4 darker"> <div class="col-md-push-3 col-md-4 darker">

View file

@ -12,13 +12,16 @@ def euro(value):
return result return result
@app.template_filter('countdown') @app.template_filter('countdown')
def countdown(value): def countdown(value, only_positive=True, show_text=True):
delta = value - datetime.now() delta = value - datetime.now()
if delta.total_seconds() < 0: if delta.total_seconds() < 0 and only_positive:
return "closed" return "closed"
hours, remainder = divmod(delta.seconds, 3600) hours, remainder = divmod(delta.seconds, 3600)
minutes, seconds = divmod(remainder, 60) minutes, seconds = divmod(remainder, 60)
return 'closes in %02d:%02d:%02d' % (hours, minutes, seconds) time = '%02d:%02d:%02d' % (hours, minutes, seconds)
if show_text:
return 'closes in ' + time
return time
@app.errorhandler(404) @app.errorhandler(404)
def handle404(e): def handle404(e):