Revoke + Logging

This commit is contained in:
Raphael Michel
2018-09-19 13:57:51 +02:00
parent 1aca5fb6ff
commit 17e09c601e
6 changed files with 82 additions and 3 deletions

View File

@@ -8,6 +8,10 @@
<legend>{% trans "Connect a new device" %}</legend>
{% endif %}
<form class="form-horizontal" action="" method="post">
{% if device %}
<div class="row">
<div class="col-xs-12 col-lg-10">
{% endif %}
{% csrf_token %}
{% bootstrap_form_errors form %}
{% bootstrap_field form.name layout="control" %}
@@ -19,5 +23,19 @@
</button>
</div>
{% if device %}
</div>
<div class="col-xs-12 col-lg-2">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">
{% trans "Device history" %}
</h3>
</div>
{% include "pretixcontrol/includes/logs.html" with obj=device %}
</div>
</div>
</div>
{% endif %}
</form>
{% endblock %}

View File

@@ -0,0 +1,21 @@
{% extends "pretixcontrol/organizers/base.html" %}
{% load i18n %}
{% load bootstrap3 %}
{% block inner %}
<h2>{% trans "Revoke device access:" %} {{ device.name }}</h2>
<form action="" method="post" class="form-horizontal">
{% csrf_token %}
<p>
<strong>{% blocktrans %}Are you sure you want remove access for this device?{% endblocktrans %}</strong>
{% trans "All data of this device will stay available, but you can't use the device any more." %}
</p>
<div class="form-group submit-group">
<a href="{% url "control:organizer.devices" organizer=request.organizer.slug%}" class="btn btn-default btn-cancel">
{% trans "Cancel" %}
</a>
<button type="submit" class="btn btn-danger btn-save">
{% trans "Revoke" %}
</button>
</div>
</form>
{% endblock %}

View File

@@ -81,6 +81,10 @@
<a href="{% url "control:organizer.device.connect" organizer=request.organizer.slug device=d.id %}"
class="btn btn-primary btn-sm"><i class="fa fa-link"></i>
{% trans "Connect" %}</a>
{% elif d.api_token %}
<a href="{% url "control:organizer.device.revoke" organizer=request.organizer.slug device=d.id %}"
class="btn btn-default btn-sm">
{% trans "Revoke access" %}</a>
{% endif %}
<a href="{% url "control:organizer.device.edit" organizer=request.organizer.slug device=d.id %}"
class="btn btn-default btn-sm"><i class="fa fa-edit"></i></a>