aboutsummaryrefslogtreecommitdiff
path: root/ihatemoney/templates
diff options
context:
space:
mode:
author0livd <github@destras.fr>2017-09-04 15:44:20 +0200
committerAlexis Metaireau <alexis@notmyidea.org>2017-09-04 15:44:20 +0200
commit7a918c93498c2eb4f85b3b0198c03f3c2edf51fe (patch)
tree885fe498c3f27acb8fc73f5d37765c7e42669762 /ihatemoney/templates
parentee1ecbf3e747daa711744a05027a667a302cc7e9 (diff)
downloadihatemoney-mirror-7a918c93498c2eb4f85b3b0198c03f3c2edf51fe.zip
ihatemoney-mirror-7a918c93498c2eb4f85b3b0198c03f3c2edf51fe.tar.gz
ihatemoney-mirror-7a918c93498c2eb4f85b3b0198c03f3c2edf51fe.tar.bz2
Enhance the dashboard. (#262)
* Update to a more flexible admin authentication * Admin can now access any project * Add delete and edit options in the dashboard * Add a link to the dashboard in the nav bar This is a rework of the changes proposed by @Olivd, so they can apply on top of the latest master without trouble. All credit goes to him for the code.
Diffstat (limited to 'ihatemoney/templates')
-rw-r--r--ihatemoney/templates/admin.html12
-rw-r--r--ihatemoney/templates/authenticate.html6
-rw-r--r--ihatemoney/templates/dashboard.html12
-rw-r--r--ihatemoney/templates/home.html6
-rw-r--r--ihatemoney/templates/layout.html3
5 files changed, 27 insertions, 12 deletions
diff --git a/ihatemoney/templates/admin.html b/ihatemoney/templates/admin.html
new file mode 100644
index 0000000..031d27c
--- /dev/null
+++ b/ihatemoney/templates/admin.html
@@ -0,0 +1,12 @@
+{% extends "layout.html" %}
+{% block content %}
+<h2>Authentication</h2>
+
+{% if is_admin_auth_enabled %}
+<form class="form-horizontal" method="POST" accept-charset="utf-8">
+ {{ forms.admin(form) }}
+</form>
+{% else %}
+<div class="alert alert-danger">{{ _("Administration tasks are currently disabled.") }}</div>
+{% endif %}
+{% endblock %}
diff --git a/ihatemoney/templates/authenticate.html b/ihatemoney/templates/authenticate.html
index f241c48..98914d0 100644
--- a/ihatemoney/templates/authenticate.html
+++ b/ihatemoney/templates/authenticate.html
@@ -7,13 +7,7 @@
to") }} <a href="{{ url_for(".create_project", project_id=create_project) }}">{{ _("create it") }}</a>{{ _("?") }}
</p>
{% endif %}
-{% if admin_auth %}
-<form class="form-horizontal" method="POST" accept-charset="utf-8">
- {{ forms.admin(form) }}
-</form>
-{% else %}
<form class="form-horizontal" method="POST" accept-charset="utf-8">
{{ forms.authenticate(form) }}
</form>
-{% endif %}
{% endblock %}
diff --git a/ihatemoney/templates/dashboard.html b/ihatemoney/templates/dashboard.html
index 3f50915..b1220bd 100644
--- a/ihatemoney/templates/dashboard.html
+++ b/ihatemoney/templates/dashboard.html
@@ -1,8 +1,8 @@
{% extends "layout.html" %}
{% block content %}
-
+{% if is_admin_dashboard_activated %}
<table id="bill_table" class="table table-striped">
- <thead><tr><th>{{ _("Project") }}</th><th>{{ _("Number of members") }}</th><th>{{ _("Number of bills") }}</th><th>{{_("Newest bill")}}</th><th>{{_("Oldest bill")}}</th></tr></thead>
+ <thead><tr><th>{{ _("Project") }}</th><th>{{ _("Number of members") }}</th><th>{{ _("Number of bills") }}</th><th>{{_("Newest bill")}}</th><th>{{_("Oldest bill")}}</th><th>{{_("Actions")}}</th></tr></thead>
<tbody>{% for project in projects|sort(attribute='name') %}
<tr class="{{ loop.cycle("odd", "even") }}">
<td>{{ project.name }}</td><td>{{ project.members | count }}</td><td>{{ project.get_bills().count() }}</td>
@@ -13,9 +13,15 @@
<td></td>
<td></td>
{% endif %}
+ <td class="project-actions">
+ <a class="edit" href="{{ url_for(".edit_project", project_id=project.id) }}" title="{{ _("edit") }}">{{ _('edit') }}</a>
+ <a class="delete" href="{{ url_for(".delete_project", project_id=project.id) }}" title="{{ _("delete") }}">{{ _('delete') }}</a>
+ </td>
</tr>
{% endfor %}
</tbody>
</table>
+{% else %}
+<div class="alert alert-danger">{{ _("The Dashboard is currently deactivated.") }}</div>
+{% endif %}
{% endblock %}
-
diff --git a/ihatemoney/templates/home.html b/ihatemoney/templates/home.html
index 9bfe467..a628ecc 100644
--- a/ihatemoney/templates/home.html
+++ b/ihatemoney/templates/home.html
@@ -28,9 +28,7 @@
</form>
</div>
<div class="col-xs-12 col-sm-5 col-md-3 offset-sm-1">
- {% if is_admin_mode_enabled %}
- <a href="{{ url_for(".create_project") }}">...{{ _("or create a new one") }}</a>
- {% else %}
+ {% if is_public_project_creation_allowed %}
<form id="creation-form" class="form-horizontal" action="{{ url_for(".create_project") }}" method="post">
<fieldset class="form-group">
<legend>...{{ _("or create a new one") }}</legend>
@@ -40,6 +38,8 @@
<button class="btn" type="submit">{{ _("let's get started") }}</button>
</div>
</form>
+ {% else %}
+ <a href="{{ url_for(".create_project") }}">...{{ _("or create a new one") }}</a>
{% endif %}
</main>
</div>
diff --git a/ihatemoney/templates/layout.html b/ihatemoney/templates/layout.html
index 36f01f8..8510911 100644
--- a/ihatemoney/templates/layout.html
+++ b/ihatemoney/templates/layout.html
@@ -64,6 +64,9 @@
{% endif %}
<li class="nav-item{% if g.lang == "fr" %} active{% endif %}"><a class="nav-link" href="{{ url_for(".change_lang", lang="fr") }}">fr</a></li>
<li class="nav-item{% if g.lang == "en" %} active{% endif %}"><a class="nav-link" href="{{ url_for(".change_lang", lang="en") }}">en</a></li>
+ {% if g.show_admin_dashboard_link %}
+ <li class="nav-item{% if request.url_rule.endpoint == "main.dashboard" %} active{% endif %}"><a class="nav-link" href="{{ url_for(".dashboard") }}">{{ _("Dashboard") }}</a></li>
+ {% endif %}
</ul>
</div>
</nav>