Some more layouting
This commit is contained in:
parent
28cd6947a5
commit
75dee4ebbd
2 changed files with 11 additions and 8 deletions
|
@ -9,15 +9,15 @@
|
|||
{% if order.can_close(current_user.id) -%}
|
||||
<a class="btn btn-danger" href="{{ url_for('.close_order', id=order.id) }}">Close</a><br/>
|
||||
{%- endif %}</h3>
|
||||
Courrier: {{ order.courrier.username }}
|
||||
courrier: {{ order.courrier.username }}
|
||||
{% 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>
|
||||
{% endif %}
|
||||
<br/>
|
||||
Location: <a href="{{ order.location.website }}">{{ order.location.name }}</a><br/>
|
||||
Starttime: {{ order.starttime }}<br/>
|
||||
Stoptime: {{ order.stoptime }}<br/>
|
||||
Total price: {{ total_price|euro }}
|
||||
location: <a href="{{ order.location.website }}">{{ order.location.name }}</a><br/>
|
||||
opened on {{ order.starttime }}<br/>
|
||||
<b>status:</b> {% if order.stoptime %}{{ order.stoptime|countdown }}{% else %}open{% endif %}<br/>
|
||||
total price: {{ total_price|euro }}
|
||||
</div>
|
||||
{% if form -%}
|
||||
<div class="col-md-push-3 col-md-4 darker">
|
||||
|
|
|
@ -12,13 +12,16 @@ def euro(value):
|
|||
return result
|
||||
|
||||
@app.template_filter('countdown')
|
||||
def countdown(value):
|
||||
def countdown(value, only_positive=True, show_text=True):
|
||||
delta = value - datetime.now()
|
||||
if delta.total_seconds() < 0:
|
||||
if delta.total_seconds() < 0 and only_positive:
|
||||
return "closed"
|
||||
hours, remainder = divmod(delta.seconds, 3600)
|
||||
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)
|
||||
def handle404(e):
|
||||
|
|
Loading…
Reference in a new issue