From 7a918c93498c2eb4f85b3b0198c03f3c2edf51fe Mon Sep 17 00:00:00 2001 From: 0livd Date: Mon, 4 Sep 2017 15:44:20 +0200 Subject: 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. --- ihatemoney/templates/admin.html | 12 ++++++++++++ ihatemoney/templates/authenticate.html | 6 ------ ihatemoney/templates/dashboard.html | 12 +++++++++--- ihatemoney/templates/home.html | 6 +++--- ihatemoney/templates/layout.html | 3 +++ 5 files changed, 27 insertions(+), 12 deletions(-) create mode 100644 ihatemoney/templates/admin.html (limited to 'ihatemoney/templates') 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 %} +

Authentication

+ +{% if is_admin_auth_enabled %} +
+ {{ forms.admin(form) }} +
+{% else %} +
{{ _("Administration tasks are currently disabled.") }}
+{% 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") }} {{ _("create it") }}{{ _("?") }}

{% endif %} -{% if admin_auth %} -
- {{ forms.admin(form) }} -
-{% else %}
{{ forms.authenticate(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 %} - + {% for project in projects|sort(attribute='name') %} @@ -13,9 +13,15 @@ {% endif %} + {% endfor %}
{{ _("Project") }}{{ _("Number of members") }}{{ _("Number of bills") }}{{_("Newest bill")}}{{_("Oldest bill")}}
{{ _("Project") }}{{ _("Number of members") }}{{ _("Number of bills") }}{{_("Newest bill")}}{{_("Oldest bill")}}{{_("Actions")}}
{{ project.name }}{{ project.members | count }}{{ project.get_bills().count() }} + {{ _('edit') }} + {{ _('delete') }} +
+{% else %} +
{{ _("The Dashboard is currently deactivated.") }}
+{% 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 @@
- {% if is_admin_mode_enabled %} - ...{{ _("or create a new one") }} - {% else %} + {% if is_public_project_creation_allowed %}
...{{ _("or create a new one") }} @@ -40,6 +38,8 @@
+ {% else %} + ...{{ _("or create a new one") }} {% endif %} 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 %} + {% if g.show_admin_dashboard_link %} + + {% endif %} -- cgit v1.1