diff options
Diffstat (limited to 'ishtar_common/templates')
-rw-r--r-- | ishtar_common/templates/ishtar/gis_token_list.html | 90 | ||||
-rw-r--r-- | ishtar_common/templates/navbar.html | 3 |
2 files changed, 93 insertions, 0 deletions
diff --git a/ishtar_common/templates/ishtar/gis_token_list.html b/ishtar_common/templates/ishtar/gis_token_list.html new file mode 100644 index 000000000..ca4389076 --- /dev/null +++ b/ishtar_common/templates/ishtar/gis_token_list.html @@ -0,0 +1,90 @@ +{% extends "base.html" %} +{% load i18n l10n %} + +{% block content %} +{% localize off %} +{% if user_request %} +<script type="text/javascript"> + $(document).ready(function(){ + $("#qgis-code-button").click(function(){ + navigator.clipboard.writeText($("#qgis-code").html()); + display_info("{% trans 'Key copied to clipboard.' %}"); + }); + $("#qgis-instance-button").click(function(){ + navigator.clipboard.writeText($("#qgis-instance").html()); + display_info("{% trans 'Instance address copied to clipboard.' %}"); + }); + var timer = $("#expire-seconds").text(); + var intervalId = window.setInterval(function(){ + timer -= 1; + if (timer >= 0){ + $("#expire-seconds").html(timer); + } else { + location.reload(); + } + }, 1000); + }); +</script> +{% endif %} +<h2>{{page_name}}</h2> +<div class='form'> + <div class="row justify-content-center"> + {% if user_request %} + <div class="alert alert-info show" role="alert"> + <i class="fa fa-info-circle" aria-hidden="true"></i> + <span>{% trans "Put instance name and code in the QGIS plugin." %} {{expiry}}</span> + <div class='m-1'><big><strong>{% trans "Ishtar instance" %}</strong> + <button id="qgis-instance-button" class="btn btn-secondary text-monospace" data-toggle="tooltip" data-placement="bottom" title="{% trans 'Copy instance name to clipboard' %}"><i class="fa fa-clipboard" aria-hidden="true"></i> <span id='qgis-instance'>{{instance}}</span></button></big></div> + <div class='m-1'><big><strong>{% trans "Code" %} ({{user_request.access_type_label}})</strong> + <button id="qgis-code-button" class="btn btn-secondary text-monospace" data-toggle="tooltip" data-placement="bottom" title="{% trans 'Copy code to clipboard' %}"><i class="fa fa-clipboard" aria-hidden="true"></i> <span id='qgis-code'>{{user_request.key}}</span></button></big></div> + </div> + {% else %} + <form method="post" action="{% url 'gis-request-key' %}"> + {% csrf_token %} + <div class="form-row"> + {% with field=request_form.access_type %} + {% include "blocks/bs_field_snippet.html" %} + {% endwith %} + {% with field=request_form.comment %} + {% include "blocks/bs_field_snippet.html" %} + {% endwith %} + {% with field=request_form.limit_date %} + {% include "blocks/bs_field_snippet.html" %} + {% endwith %} + <div class="form-group col-12 text-center"> + <button type='submit' class="btn btn-success mt-2"> + <i class="fa fa-plus"></i> {% trans 'GIS connection' %} + </button> + </div> + </div> + </form> + {% endif %} + </div> + {% if object_list %} + <hr> + <div class="row justify-content-center"> + <table class="table table-striped w-50"> + <tr> + <th>{% trans "Access type (limit date)" %}</th> + <th>{% trans "Comment" %}</th> + <th>{% trans "Last access (IP)" %}</th> + <th>{% trans "Delete" %}</th> + </tr> + {% for access in object_list %} + <tr> + <td>{{access.access_type_label}}{% if access.limit_date %} ({{access.limit_date|date:"DATE_FORMAT"|default:"-"}}){% endif %}</td> + <td>{{access.comment|default:"-"}}</td> + <td>{{access.last_access|date:"DATE_FORMAT"}} ({{access.last_ip|default:"-"}})</td> + <td> + <a class="btn btn-danger btn-sm" title="{% trans 'Delete' %}" href="{% url 'gis-token-delete' access.key %}" + onclick='return confirm("{% trans 'Are you sure?' %}")'> + <i class="fa fa-trash"></i></a> + </td> + </tr> + {% endfor %} + </table> + </div> + {% endif %} +{% endlocalize %} +{% endblock %} + diff --git a/ishtar_common/templates/navbar.html b/ishtar_common/templates/navbar.html index 3e7190645..79023100a 100644 --- a/ishtar_common/templates/navbar.html +++ b/ishtar_common/templates/navbar.html @@ -33,6 +33,9 @@ <a class="dropdown-item" href="{% url 'password_change' %}"> {% trans "Change password" %} </a> + {% if SITE_PROFILE.gis_connector %}<a class="dropdown-item" href="{% url 'gis-token-list' %}"> + {% trans "GIS connections" %} + </a>{% endif %} <a class="dropdown-item" href="{% url 'changelog' %}"> {% trans "Changelog" %} </a> |