Browse Source

added colored status macro

php2python
Holger Frey 7 years ago
parent
commit
bfc782560d
  1. 16
      ordr2/templates/macros.jinja2
  2. 2
      ordr2/templates/orders/order_list.jinja2

16
ordr2/templates/macros.jinja2

@ -62,6 +62,21 @@ @@ -62,6 +62,21 @@
{%- endmacro %}
{% macro colored_status(status) -%}
{% if status.name == 'APPROVAL' %}
<span class="label label-info">
{% elif status.name == 'ORDERED' %}
<span class="label label-warning">
{% elif status.name == 'COMPLETED' %}
<span class="label label-success">
{% else %}
<span class="label label-important">
{% endif %}
{{ status.value|lower }}
</span>
{%- endmacro %}
{% macro pagination_helper(page, text=None, css_class='') -%}
{% set is_active = 'active' if page == context.pages.current %}
{% set is_disabled = 'disabled' if not page %}
@ -71,6 +86,7 @@ @@ -71,6 +86,7 @@
</li>
{%- endmacro %}}
{% macro pagination() -%}
{% if context.pages and context.pages.last > 1 %}
<div class="pagination pagination-centered">

2
ordr2/templates/orders/order_list.jinja2

@ -88,7 +88,7 @@ @@ -88,7 +88,7 @@
<td class="column-total">{{ '%.2f'|format(order.model.total_price) }} {{ order.model.currency }}</td>
<td class="column-account">{{ order.model.account }}</td>
<td class="column-category">{{ order.model.category.value|capitalize }}</td>
<td class="column-status">{{ order.model.status.value|capitalize }}</td>
<td class="column-status">{{ macros.colored_status(order.model.status) }}</td>
<td class="column-user">
<a href="{{ request.resource_url(context, query={'user': order.model.created_by}) }}" title="click to view all orders from user">{{ order.model.created_by }}</a>
</td>