Browse Source

Moved product and transactions lists so they can be included

master
Niklas Brachmann 11 years ago
parent
commit
59f30ee34e
  1. 4
      cash/templates/cash/base.html
  2. 18
      cash/templates/cash/includes/product_list.html
  3. 24
      cash/templates/cash/includes/transaction_list.html
  4. 16
      cash/templates/cash/product_list.html
  5. 20
      cash/templates/cash/transaction_list.html

4
cash/templates/cash/base.html

@ -89,9 +89,7 @@ @@ -89,9 +89,7 @@
<div class="panel-body">
{% block content %}
<h1>{% trans "Overview" %}</h1>
<strong>{% blocktrans with firstname=user.first_name %}Welcome, {{ firstname }}!{% endblocktrans %}</strong>
<h1>{% blocktrans with firstname=user.first_name %}Welcome, {{ firstname }}!{% endblocktrans %}</h1>
{% endblock %}
</div>

18
cash/templates/cash/includes/product_list.html

@ -0,0 +1,18 @@ @@ -0,0 +1,18 @@
{% load static %}
{% load i18n %}
<div class="row">
{% for p in products %}
<div class="{{ class|default:"col-xs-6 col-md-3" }}">
<div class="thumbnail">
<img src="{% if p.image_thumbnail %}{{ p.image_thumbnail.url }}{% else %}{% static "images/no-image.png" %}{% endif %}" alt="{% trans "Product image" %}" style="width: 100%" />
<div class="caption">
<h3>{{ p.name }}</h3>
<h4>{{ p.price|floatformat:2 }} &euro;</h4>
<a class="btn btn-primary" href="{% url 'buy' p.id %}">{% trans "Buy" %}</a>
<a class="btn btn-default" href="{% url 'product' p.id %}">{% trans "Details" %}</a>
</div>
</div>
</div>
{% endfor %}
</div>

24
cash/templates/cash/includes/transaction_list.html

@ -0,0 +1,24 @@ @@ -0,0 +1,24 @@
{% load static %}
{% load i18n %}
<table class="table table-striped">
<thead>
<tr>
<th>{% trans "Date" %}</th>
<th>{% trans "Subject" %}</th>
<th class="hidden-xs">{% trans "Description" %}</th>
<th style="text-align: right;">{% trans "amount" context "money" %}</th>
</tr>
</thead>
<tbody>
{% for t in transactions %}
<tr>
<td class="visible-xs">{{ t.timestamp|date:'d.m.y' }}</td>
<td class="hidden-xs">{{ t.timestamp|date:'DATE_FORMAT' }}, {{ t.timestamp|date:'H:i' }}</td>
<td>{% trans t.subject %}<span class="visible-xs">{% if detailed %}<br/>{% trans t.description %}{% endif %}</span></td>
<td class="hidden-xs">{% trans t.description %}</td>
<td style="text-align: right; color: {% if t.amount < 0 %}red{% else %}green{% endif %}">{{ t.amount|floatformat:2 }} &euro;</td>
</tr>
{% endfor %}
</tbody>
</table>

16
cash/templates/cash/product_list.html

@ -16,20 +16,6 @@ @@ -16,20 +16,6 @@
<!-- Ugly workaround -->
<br/>
<div class="row">
{% for p in product_list %}
<div class="col-xs-6 col-md-3">
<div class="thumbnail">
<img src="{% if p.image_thumbnail %}{{ p.image_thumbnail.url }}{% else %}{% static "images/no-image.png" %}{% endif %}" alt="{% trans "Product image" %}" style="width: 100%" />
<div class="caption">
<h3>{{ p.name }}</h3>
<h4>{{ p.price|floatformat:2 }} &euro;</h4>
<a class="btn btn-primary" href="{% url 'buy' p.id %}">{% trans "Buy" %}</a>
<a class="btn btn-default" href="{% url 'product' p.id %}">{% trans "Details" %}</a>
</div>
</div>
</div>
{% endfor %}
</div>
{% include "cash/includes/product_list.html" with products=product_list only %}
{% endblock %}

20
cash/templates/cash/transaction_list.html

@ -17,25 +17,7 @@ @@ -17,25 +17,7 @@
<br/>
</div>
<table class="table table-striped">
<thead>
<tr>
<th>{% trans "Date" %}</th>
<th>{% trans "Subject" %}</th>
<th class="hidden-xs">{% trans "Description" %}</th>
<th style="text-align: right;">{% trans "amount" context "money" %}</th>
</tr>
</thead>
{% for t in transaction_list %}
<tr>
<td class="visible-xs">{{ t.timestamp|date:'d.m.y' }}</td>
<td class="hidden-xs">{{ t.timestamp|date:'DATE_FORMAT' }}, {{ t.timestamp|date:'H:i' }}</td>
<td>{% trans t.subject %}<span class="visible-xs">{% if detailed %}<br/>{% trans t.description %}{% endif %}</span></td>
<td class="hidden-xs">{% trans t.description %}</td>
<td style="text-align: right; color: {% if t.amount < 0 %}red{% else %}green{% endif %}">{{ t.amount|floatformat:2 }} &euro;</td>
</tr>
{% endfor %}
</table>
{% include "cash/includes/transaction_list.html" with transactions=transaction_list only %}
<ul class="pagination">
<li {% if not transaction_list.has_previous %}class="disabled"{% endif %}><a href="{% if transaction_list.has_previous %}{% if detailed %}{% url 'transactions_detailed' page=transaction_list.previous_page_number %}{% else %}{% url 'transactions' page=transaction_list.previous_page_number %}{% endif %}{% endif %}">&laquo;</a></li>

Loading…
Cancel
Save