Skip to content

Commit

Permalink
Indentation and template blocks for voucher list template
Browse files Browse the repository at this point in the history
I had to copy more HTML than I would've liked to customize the actions
dropdown. So I gave the template proper indendation and guessed what
template blocks could be useful for extending.
  • Loading branch information
maiksprenger committed Nov 12, 2015
1 parent e52b3ba commit 144a6ed
Showing 1 changed file with 75 additions and 65 deletions.
140 changes: 75 additions & 65 deletions src/oscar/templates/oscar/dashboard/vouchers/voucher_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,75 +22,85 @@
{% endblock %}

{% block header %}
<div class="page-header">
<a href="{% url 'dashboard:voucher-create' %}" class="btn btn-primary btn-lg pull-right"><i class="icon-plus"></i> {% trans "Create new voucher" %}</a>
<h1>{% trans "Vouchers" %}</h1>
</div>
<div class="page-header">
<a href="{% url 'dashboard:voucher-create' %}" class="btn btn-primary btn-lg pull-right"><i class="icon-plus"></i> {% trans "Create new voucher" %}</a>
<h1>{% trans "Vouchers" %}</h1>
</div>
{% endblock header %}


{% block dashboard_content %}
<div class="table-header">
<h3><i class="icon-search icon-large"></i>{% trans "Search" %}</h3>
</div>
<div class="well">
<form action="." method="get" class="form-inline">
{% include 'dashboard/partials/form_fields_inline.html' with form=form %}
<button type="submit" class="btn btn-primary" data-loading-text="{% trans 'Searching...' %}">{% trans "Search" %}</button>
<a href="{% url 'dashboard:voucher-list' %}" class="btn btn-default">{% trans "Reset" %}</a>
</form>
</div>
{% block page_head %}
<div class="table-header">
<h3><i class="icon-search icon-large"></i>{% trans "Search" %}</h3>
</div>
<div class="well">
<form action="." method="get" class="form-inline">
{% include 'dashboard/partials/form_fields_inline.html' with form=form %}
<button type="submit" class="btn btn-primary" data-loading-text="{% trans 'Searching...' %}">{% trans "Search" %}</button>
<a href="{% url 'dashboard:voucher-list' %}" class="btn btn-default">{% trans "Reset" %}</a>
</form>
</div>
{% endblock page_head %}

<table class="table table-striped table-bordered table-hover">
{% if description != "All vouchers" %}
<caption><i class="icon-money icon-large"></i>{{ description }}</caption>
{% endif %}
{% if vouchers %}
<tr>
<th>{% trans "Name" %}</th>
<th>{% trans "Code" %}</th>
<th>{% trans "Status" %}</th>
<th>{% anchor 'num_basket_additions' _("Num baskets") %}</th>
<th>{% anchor 'num_orders' _("Num orders") %}</th>
<th>{% anchor 'date_created' _("Date created") %}</th>
<th></th>
</tr>
{% for voucher in vouchers %}
<tr>
<td><a href="{% url 'dashboard:voucher-stats' voucher.id %}">{{ voucher.name }}</a></td>
<td>
<span class="label label-inverse">{{ voucher.code }}</span>
</td>
<td>
{% if voucher.is_active %}
<span class="label label-success">{% trans "Active" %}</span>
{% else %}
<span class="label">{% trans "Inactive" %}</span>
{% endif %}
</td>
<td>{{ voucher.num_basket_additions }}</td>
<td>{{ voucher.num_orders }}</td>
<td>{{ voucher.date_created }}</td>
<td>
<div class="btn-toolbar">
<div class="btn-group">
<button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown" aria-expanded="true">
{% trans "Actions" %}
<span class="caret"></span>
</button>
<ul class="dropdown-menu pull-right">
<li><a href="{% url 'dashboard:voucher-stats' pk=voucher.id %}">{% trans "Stats" %}</a></li>
<li><a href="{% url 'dashboard:voucher-update' pk=voucher.id %}">{% trans "Edit" %}</a></li>
<li><a href="{% url 'dashboard:voucher-delete' pk=voucher.id %}">{% trans "Delete" %}</a></li>
</ul>
</div>
</div>
</td>
</tr>
{% endfor %}
{% else %}
<tr><td>{% trans "No vouchers found." %}</td></tr>
{% endif %}
</table>
{% block voucher_table %}
<table class="table table-striped table-bordered table-hover">
{% if description != "All vouchers" %}
<caption><i class="icon-money icon-large"></i>{{ description }}</caption>
{% endif %}
{% if vouchers %}
{% block table_head %}
<tr>
<th>{% trans "Name" %}</th>
<th>{% trans "Code" %}</th>
<th>{% trans "Status" %}</th>
<th>{% anchor 'num_basket_additions' _("Num baskets") %}</th>
<th>{% anchor 'num_orders' _("Num orders") %}</th>
<th>{% anchor 'date_created' _("Date created") %}</th>
<th></th>
</tr>
{% endblock table_head %}
{% for voucher in vouchers %}
{% block table_row %}
<tr>
<td><a href="{% url 'dashboard:voucher-stats' voucher.id %}">{{ voucher.name }}</a></td>
<td>
<span class="label label-inverse">{{ voucher.code }}</span>
</td>
<td>
{% if voucher.is_active %}
<span class="label label-success">{% trans "Active" %}</span>
{% else %}
<span class="label">{% trans "Inactive" %}</span>
{% endif %}
</td>
<td>{{ voucher.num_basket_additions }}</td>
<td>{{ voucher.num_orders }}</td>
<td>{{ voucher.date_created }}</td>
<td>
{% block row_actions %}
<div class="btn-toolbar">
<div class="btn-group">
<button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown" aria-expanded="true">
{% trans "Actions" %}
<span class="caret"></span>
</button>
<ul class="dropdown-menu pull-right">
<li><a href="{% url 'dashboard:voucher-stats' pk=voucher.id %}">{% trans "Stats" %}</a></li>
<li><a href="{% url 'dashboard:voucher-update' pk=voucher.id %}">{% trans "Edit" %}</a></li>
<li><a href="{% url 'dashboard:voucher-delete' pk=voucher.id %}">{% trans "Delete" %}</a></li>
</ul>
</div>
</div>
{% endblock row_actions %}
</td>
</tr>
{% endblock table_row %}
{% endfor %}
{% else %}
<tr><td>{% trans "No vouchers found." %}</td></tr>
{% endif %}
</table>
{% endblock voucher_table %}
{% include "dashboard/partials/pagination.html" %}
{% endblock dashboard_content %}

0 comments on commit 144a6ed

Please sign in to comment.