1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00
Files
netbox-community-netbox/netbox/templates/users/api_tokens.html
Robin Schneider 0ad9b83623 Closes #5503: ISO 8601 date in UI and alternative format as tooltip
With this commit all dates in the UI are now consistently displayed.

I changed the long date format as suggested by @xkilian and confirmed by my own
research.

* DATETIME_FORMAT
 * Before July 20, 2020 4:52 p.m.
 * Now 20th July, 2020 16:52

"20th July, 2020" would be spoken as "the 20th of July, 2020" but the "the" and
"of" are never written.

The only exception is `object_list.html`. I tried it but there it does not
work so easily because the dates are passed to Jinja as SafeString.
2021-07-02 22:22:37 +02:00

67 lines
3.0 KiB
HTML

{% extends 'users/base.html' %}
{% load helpers %}
{% block title %}API Tokens{% endblock %}
{% block usercontent %}
<div class="row">
<div class="col-md-12">
{% for token in tokens %}
<div class="panel panel-{% if token.is_expired %}danger{% else %}default{% endif %}">
<div class="panel-heading">
<div class="pull-right noprint">
<a class="btn btn-xs btn-success copy-token" data-clipboard-target="#token_{{ token.pk }}">Copy</a>
<a href="{% url 'user:token_edit' pk=token.pk %}" class="btn btn-xs btn-warning">Edit</a>
<a href="{% url 'user:token_delete' pk=token.pk %}" class="btn btn-xs btn-danger">Delete</a>
</div>
<i class="mdi mdi-key"></i>
<samp><span id="token_{{ token.pk }}">{{ token.key }}</span></samp>
{% if token.is_expired %}
<span class="label label-danger">Expired</span>
{% endif %}
</div>
<div class="panel-body">
<div class="row">
<div class="col-md-4">
<small class="text-muted">Created</small><br />
{{ token.created|annotated_date }}
</div>
<div class="col-md-4">
<small class="text-muted">Expires</small><br />
{% if token.expires %}
{{ token.expires|annotated_date }}
{% else %}
<span>Never</span>
{% endif %}
</div>
<div class="col-md-4">
<small class="text-muted">Create/edit/delete operations</small><br />
{% if token.write_enabled %}
<span class="label label-success">Enabled</span>
{% else %}
<span class="label label-danger">Disabled</span>
{% endif %}
</div>
</div>
{% if token.description %}
<br /><span>{{ token.description }}</span>
{% endif %}
</div>
</div>
{% empty %}
<p>You do not have any API tokens.</p>
{% endfor %}
<a href="{% url 'user:token_add' %}" class="btn btn-primary">
<span class="mdi mdi-plus-thick" aria-hidden="true"></span>
Add a token
</a>
</div>
</div>
{% endblock %}
{% block javascript %}
<script type="text/javascript">
new ClipboardJS('.copy-token');
</script>
{% endblock %}