From 3028fb92d90cf36e78d2de1246051b997f3bf4d3 Mon Sep 17 00:00:00 2001 From: FreneticScribbler Date: Mon, 13 Dec 2021 12:07:42 +0000 Subject: [PATCH] Fix up the copy button stuff --- .../templates/eventauthorisation_request.html | 20 +++++++++++++------ RIGS/templatetags/filters.py | 2 ++ templates/partials/button.html | 2 ++ 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/RIGS/templates/eventauthorisation_request.html b/RIGS/templates/eventauthorisation_request.html index 529d3f91..72dd2e9e 100644 --- a/RIGS/templates/eventauthorisation_request.html +++ b/RIGS/templates/eventauthorisation_request.html @@ -1,6 +1,7 @@ {% extends request.is_ajax|yesno:'base_ajax.html,base_rigs.html' %} {% load widget_tweaks %} {% load static %} +{% load button from filters %} {% block title %}Request Authorisation{% endblock %} @@ -22,19 +23,26 @@ {% block content %}
-
+

Send authorisation request email.

-

Pressing send will email the address provided. Please triple check everything before continuing.

+

Pressing send will email the address provided. Please triple check everything before continuing.

-
+
+ {% if object.person.email or object.organisation.email %}
+ {% if object.person.email %}
Person Email
-
{{ object.person.email }}
{% if object.person.email %}{% endif %} - +
{{ object.person.email }}{% button 'copy' id='#person-email' %}
+ {% endif %} + {% if object.organisation.email %}
Organisation Email
-
{{ object.organisation.email }}
{% if object.organisation.email %}{% endif %} +
{{ object.organisation.email }}{% button 'copy' id='#org-email' %}
+ {% endif %}
+ {% else %} +

No email addresses saved to the client ಠ_ಠ

+ {% endif %}
{% csrf_token %} diff --git a/RIGS/templatetags/filters.py b/RIGS/templatetags/filters.py index 5a4348aa..8a42a568 100644 --- a/RIGS/templatetags/filters.py +++ b/RIGS/templatetags/filters.py @@ -212,6 +212,8 @@ def button(type, url=None, pk=None, clazz="", icon=None, text="", id=None, style clazz += " btn-primary " icon = "fa-plus" text = "New" + elif type == 'copy': + return {'copy': True, 'id': id, 'style': style} elif type == 'search': return {'submit': True, 'class': 'btn-info', 'icon': 'fa-search', 'text': 'Search', 'id': id, 'style': style} elif type == 'submit': diff --git a/templates/partials/button.html b/templates/partials/button.html index e13f527a..3a353365 100644 --- a/templates/partials/button.html +++ b/templates/partials/button.html @@ -2,6 +2,8 @@ {% elif pk %} {{ text }} +{% elif copy %} + {% else %} {{ text }} {% endif %}