summaryrefslogtreecommitdiffstats
path: root/bitvend/templates
diff options
context:
space:
mode:
Diffstat (limited to 'bitvend/templates')
-rw-r--r--bitvend/templates/_formathelpers.html13
-rw-r--r--bitvend/templates/_helpers.html (renamed from bitvend/templates/_formhelpers.html)41
-rw-r--r--bitvend/templates/base.html12
-rw-r--r--bitvend/templates/index.html15
-rw-r--r--bitvend/templates/transactions.html38
5 files changed, 94 insertions, 25 deletions
diff --git a/bitvend/templates/_formathelpers.html b/bitvend/templates/_formathelpers.html
deleted file mode 100644
index eafaf70..0000000
--- a/bitvend/templates/_formathelpers.html
+++ /dev/null
@@ -1,13 +0,0 @@
-{% macro format_currency(amount, color=True, precision=2) -%}
-{%- if amount == None -%}
-None
-{%- else -%}
-<span class="amount{% if amount < 0 and color %} amount-negative{% endif %}" data-original="{{ amount }}">
- {{ format_currency_raw(amount, precision) }}
-</span>
-{%- endif %}
-{%- endmacro %}
-
-{% macro format_currency_raw(amount, precision=0) -%}
-{{ ("%%.%sf" | format(precision) | format(amount/100)) }}SOG
-{%- endmacro %}
diff --git a/bitvend/templates/_formhelpers.html b/bitvend/templates/_helpers.html
index ac037cb..d0f7bcb 100644
--- a/bitvend/templates/_formhelpers.html
+++ b/bitvend/templates/_helpers.html
@@ -1,3 +1,16 @@
+{% macro format_currency(amount, color=True, precision=2) -%}
+{%- if amount == None -%}
+None
+{%- else -%}
+<span class="amount{% if amount < 0 and color %} amount-negative{% endif %}" data-original="{{ amount }}">
+ {{ format_currency_raw(amount, precision) }}
+</span>
+{%- endif %}
+{%- endmacro %}
+
+{% macro format_currency_raw(amount, precision=0) -%}
+{{ ("%%.%sf" | format(precision) | format(amount/100)) }}SOG
+{%- endmacro %}
{% macro render_field(field, prefix=None, suffix=None, layout=True, label=True) %}
{% if field.type == 'HiddenField' %}
{{ field(**kwargs) }}
@@ -56,3 +69,31 @@
</div>
{% endif %}
{% endmacro %}
+
+{% macro render_pagination(pagination) %}
+ <ul class="pagination text-center">
+ {% if pagination.has_prev %}
+ <li><a href="{{ url_for_other_page(pagination.page - 1) }}">&laquo;</a></li>
+ {% else %}
+ <li class="disabled"><a>&laquo;</a></li>
+ {% endif %}
+
+ {%- for page in pagination.iter_pages() %}
+ {% if page %}
+ {% if page != pagination.page %}
+ <li><a href="{{ url_for_other_page(page) }}">{{ page }}</a></li>
+ {% else %}
+ <li class="active"><a href="{{ url_for_other_page(page) }}">{{ page }}</a></li>
+ {% endif %}
+ {% else %}
+ <li class="disabled"><a>…</a></li>
+ {% endif %}
+ {%- endfor %}
+
+ {% if pagination.has_next %}
+ <li><a href="{{ url_for_other_page(pagination.page + 1) }}">&raquo;</a></li>
+ {% else %}
+ <li class="disabled"><a>&raquo;</a></li>
+ {% endif %}
+ </ul>
+{% endmacro %}
diff --git a/bitvend/templates/base.html b/bitvend/templates/base.html
index a79f270..692a419 100644
--- a/bitvend/templates/base.html
+++ b/bitvend/templates/base.html
@@ -50,16 +50,8 @@
</div>
<div class="navbar-collapse collapse" id="navbar-main">
<p class="navbar-text navbar-nav">
- {% if mdb_online %}
- <span class="label label-success">mdb: online</span>
- {% else %}
- <span class="label label-danger">mdb: offline</span>
- {% endif %}
- {% if proc_online %}
- <span class="label label-success">payments: online</span>
- {% else %}
- <span class="label label-danger">payments: offline</span>
- {% endif %}
+ <span class="label {% if mdb_online %}label-success{% else %}label-danger{% endif %}">mdb</span>
+ <span class="label {% if proc_online %}label-success{% else %}label-danger{% endif %}">bitcoin</span>
</p>
{% if current_user.is_authenticated %}
diff --git a/bitvend/templates/index.html b/bitvend/templates/index.html
index e66f9a4..afd89b3 100644
--- a/bitvend/templates/index.html
+++ b/bitvend/templates/index.html
@@ -1,7 +1,6 @@
{% extends "base.html" %}
-{% from "_formathelpers.html" import format_currency %}
-{% from "_formhelpers.html" import render_field, render_submit %}
+{% from "_helpers.html" import format_currency, render_field, render_submit %}
{% block content %}
{% if not mdb_online or not proc_online %}
@@ -47,6 +46,18 @@
</div>
</div>
</form>
+
+ <h3 class="page-header">Hall of Shame</h3>
+ <table class="table table-hover table-striped">
+ <thead><tr>
+ <th>Name</th><th>Balance</th>
+ </tr></thead>
+ {% for user in hallofshame %}
+ <tr><td>{{ user }}</td><td>{{ format_currency(user.balance) }}</td></tr>
+ {% else %}
+ <tr><td colspan=2 class="placeholder">Wow! Nobody's due!</td></tr>
+ {% endfor %}
+ </table>
</div>
<div class="col-sm-8">
<h3 class="page-header">Latest transactions</h3>
diff --git a/bitvend/templates/transactions.html b/bitvend/templates/transactions.html
new file mode 100644
index 0000000..7ee0a2f
--- /dev/null
+++ b/bitvend/templates/transactions.html
@@ -0,0 +1,38 @@
+{% extends "base.html" %}
+
+{% from "_helpers.html" import format_currency, render_pagination %}
+
+{% block content %}
+ <table class="table table-hover table-striped">
+ <thead>
+ <tr>
+ <th>Type</th>
+ <th>Amount</th>
+ <th>Date</th>
+ </tr>
+ </thead>
+
+ {% for tx in transactions.items %}
+ <tr{% if not tx.finished %} style="opacity: 0.5"{% endif %}>
+ <td>
+ {{ tx.type }} {% if not tx.finished %}<i>(processing)</i>{% endif %}
+ <small>
+ {% if tx.type == 'transfer' and tx.amount > 0 %}
+ from <b>{{ tx.related_user }}</b>
+ {% elif tx.type == 'transfer' and tx.amount < 0 %}
+ to <b>{{ tx.related }}</b>
+ {% elif tx.type == 'purchase' and tx.product_id %}
+ of product <b>{{ tx.product_id }}</b>
+ {% endif %}
+ </small>
+ </td>
+ <td>{{ format_currency(tx.amount) }}</td>
+ <td>{{ tx.created }}</td>
+ </tr>
+ {% else %}
+ <tr><td colspan=3 class="placeholder">Nothing to see here...</td></tr>
+ {% endfor %}
+ </table>
+
+ {{ render_pagination(transactions) }}
+{% endblock %}