=== removed file 'lava_server/templates/linaro_django_xmlrpc/_base.html'
@@ -1,25 +0,0 @@
-{% extends "layouts/content_with_sidebar.html" %}
-{% load i18n %}
-
-
-{% block title %}
-{{ block.super }} | {% trans "XML-RPC" %}
-{% endblock %}
-
-
-{% block navigation %}
-<div id="lava-server-extension-navigation">
- <ul>
- <li><a class="lava-back" href="{% url lava.home %}"
- >{% trans "Back to LAVA" %}</a></li>
- <li><a href="{% url lava.api_help %}">{% trans "API Help" %}</a></li>
- <li><a href="{% url linaro_django_xmlrpc.views.tokens %}">{% trans "Authentication Tokens" %}</a></li>
- </ul>
-</div>
-{% endblock %}
-
-
-{% block breadcrumbs %}
-{{ block.super }}
-<li><a href="{% url lava.api_help %}">{% trans "Available Methods" %}</a></li>
-{% endblock %}
=== modified file 'lava_server/templates/linaro_django_xmlrpc/api.html'
@@ -1,13 +1,30 @@
-{% extends "linaro_django_xmlrpc/_base.html" %}
+{% extends "layouts/content.html" %}
{% load markup %}
{% load i18n %}
-{% block title %}{{ block.super }} | {% trans "XML-RPC Handler" %}{% endblock %}
+{% block title %}
+{{ block.super }} | {% trans "XML-RPC" %}
+{% endblock %}
{% block breadcrumbs %}
{{ block.super }}
+<li><a href="{% url lava.home %}">{% trans "LAVA" %}</a></li>
+<li>{% trans "API" %}</a></li>
+<li><a href="{% url lava.api_help %}">{% trans "Available Methods" %}</a></li>
+{% endblock %}
+
+
+{% block navigation %}
+<div id="lava-extension-navigation">
+ <ul>
+ <li><a class="lava-back" href="{% url lava.home %}"
+ >{% trans "Back to LAVA" %}</a></li>
+ <li><a href="{% url lava.api_help %}">{% trans "API Help" %}</a></li>
+ <li><a href="{% url linaro_django_xmlrpc.views.tokens %}">{% trans "Authentication Tokens" %}</a></li>
+ </ul>
+</div>
{% endblock %}
=== modified file 'lava_server/templates/linaro_django_xmlrpc/authtoken_confirm_delete.html'
@@ -1,12 +1,19 @@
-{% extends "linaro_django_xmlrpc/_base.html" %}
+{% extends "layouts/form.html" %}
{% load i18n %}
-{% block title %}{{ block.super }} | {% trans "API Tokens" %} | {% trans "Delete Token" %} {{ token.pk }}{% endblock %}
+{% block title %}
+{{ block.super }}
+| {% trans "API" %}
+| {% trans "Authentication Tokens" %}
+| {% trans "Delete Token" %} {{ token.pk }}
+{% endblock %}
{% block breadcrumbs %}
{{ block.super }}
+<li><a href="{% url lava.home %}">{% trans "LAVA" %}</a></li>
+<li>{% trans "API" %}</a></li>
<li><a
href="{% url linaro_django_xmlrpc.views.tokens %}"
>{% trans "Authentication Tokens" %}</a></li>
@@ -16,22 +23,21 @@
{% endblock %}
-
-{% block content %}
-<form action="" method="POST">
- {% csrf_token %}
- <p>Would you like to delete {{ token }}
- {% if token.description %}
- with description “{{ token.description }}”?
- {% else %}
- with no description?
- {% endif %}
- </p>
- <input type="submit" value="Yes, Delete"/>
-</form>
-<script type="text/javascript">
- $(document).ready(function() {
- $("input[type=submit]").button();
- });
-</script>
+{% block form_header %}
+<p>Would you like to delete {{ token }}
+{% if token.description %}
+with description “{{ token.description }}”?
+{% else %}
+with no description?
+{% endif %}
+</p>
+{% endblock %}
+
+
+{% block form_footer %}
+<h2>Continue</h2>
+<input type="submit" value="Delete"/>
+or <a
+ href="{% url linaro_django_xmlrpc.views.tokens %}"
+ >cancel</a>
{% endblock %}
=== modified file 'lava_server/templates/linaro_django_xmlrpc/create_token.html'
@@ -1,36 +1,38 @@
-{% extends "linaro_django_xmlrpc/_base.html" %}
+{% extends "layouts/form.html" %}
{% load i18n %}
-{% block title %}{{ block.super }} | {% trans "API Tokens" %} | {% trans "Create" %}{% endblock %}
+{% block title %}
+{{ block.super }}
+| {% trans "API" %}
+| {% trans "Authentication Tokens" %}
+| {% trans "Create" %}
+{% endblock %}
{% block breadcrumbs %}
{{ block.super }}
-<li><a href="{% url linaro_django_xmlrpc.views.tokens %}">{% trans "Authentication Tokens" %}</a></li>
-<li><a href="{% url linaro_django_xmlrpc.views.create_token %}">{% trans "Create Token" %}</a></li>
+<li><a
+ href="{% url lava.home %}"
+ >{% trans "LAVA" %}</a></li>
+<li>{% trans "API" %}</li>
+<li><a
+ href="{% url linaro_django_xmlrpc.views.tokens %}"
+ >{% trans "Authentication Tokens" %}</a></li>
+<li><a
+ href="{% url linaro_django_xmlrpc.views.create_token %}"
+ >{% trans "Create Token" %}</a></li>
{% endblock %}
-{% block content %}
+{% block form_header %}
<h1>Create new authentication token</h1>
-<p>
- It makes sense to create a token for each script you want to give
- access to LAVA, so you can delete a particular token if you suspect
- it has been compromised without disrupting other scripts.
-</p>
-<p>
- You can give each token a description, so you can know which is
- which.
-</p>
-<form action="{% url linaro_django_xmlrpc.views.create_token %}" method="POST">
- {% csrf_token %}
- <p>
- <label for="id_description">Description:</label>
- <input id="id_description" name="description" style="width: 80ex"/>
- </p>
- <p>
- <button type="submit" value="Create Token">Create Token</button>
- </p>
-</form>
+{% endblock %}
+
+
+{% block form_footer %}
+{{ block.super }}
+or <a
+ href="{% url linaro_django_xmlrpc.views.tokens %}"
+ >cancel</a>
{% endblock %}
=== modified file 'lava_server/templates/linaro_django_xmlrpc/edit_token.html'
@@ -1,13 +1,22 @@
-{% extends "linaro_django_xmlrpc/_base.html" %}
+{% extends "layouts/form.html" %}
{% load i18n %}
-{% block title %}{{ block.super }} | {% trans "API Tokens" %} | {% trans "Edit Token" %} {{ token.pk }}{% endblock %}
+{% block title %}
+{{ block.super }}
+| {% trans "API" %}
+| {% trans "Authentication Tokens" %}
+| {% trans "Edit Token" %} {{ token.pk }}
+{% endblock %}
{% block breadcrumbs %}
{{ block.super }}
<li><a
+ href="{% url lava.home %}"
+ >{% trans "LAVA" %}</a></li>
+<li>{% trans "API" %}</li>
+<li><a
href="{% url linaro_django_xmlrpc.views.tokens %}"
>{% trans "Authentication Tokens" %}</a></li>
<li><a
@@ -16,21 +25,14 @@
{% endblock %}
-{% block content %}
+{% block form_header %}
<h1>Edit token {{ token.pk }}</h1>
-<form action="{% url linaro_django_xmlrpc.views.edit_token token.pk %}" method="POST">
- {% csrf_token %}
- <p>
- <label for="id_description">Description:</label>
- <input id="id_description" name="description" style="width: 80ex" value="{{ token.description }}"/>
- </p>
- <p>
- <input type="submit" value='{% trans "Save" %}'/>
- </p>
-</form>
-<script type="text/javascript">
- $(document).ready(function() {
- $("input[type=submit]").button();
- });
-</script>
+{% endblock %}
+
+
+{% block form_footer %}
+{{ block.super }}
+or <a
+ href="{% url linaro_django_xmlrpc.views.tokens %}"
+ >cancel</a>
{% endblock %}
=== modified file 'lava_server/templates/linaro_django_xmlrpc/tokens.html'
@@ -1,4 +1,4 @@
-{% extends "linaro_django_xmlrpc/_base.html" %}
+{% extends "layouts/content_with_sidebar.html" %}
{% load i18n %}
@@ -8,75 +8,76 @@
{% endblock %}
-{% block title %}{{ block.super }} | {% trans "API Tokens" %}{% endblock %}
+{% block title %}{{ block.super }} | {% trans "API" %} | {% trans "Authentication Tokens" %}{% endblock %}
{% block breadcrumbs %}
{{ block.super }}
+<li><a href="{% url lava.home %}">{% trans "LAVA" %}</a></li>
+<li>{% trans "API" %}</a></li>
<li><a
href="{% url linaro_django_xmlrpc.views.tokens %}"
>{% trans "Authentication Tokens" %}</a></li>
{% endblock %}
+{% block sidebar %}
+<h3>Actions</h3>
+<ul>
+ <li><a href="{% url linaro_django_xmlrpc.views.create_token %}">Create new token</a></li>
+</ul>
+{% endblock %}
+
+
{% block content %}
-<script type="text/javascript" charset="utf-8">
- $(document).ready(function() {
- $('#tokens').dataTable({
- bJQueryUI: true,
- sPaginationType: "full_numbers",
- aaSorting: [[1, "desc"]],
- });
- $('#tokens tbody td a').button();
- $('button').button();
+<h2>Authentication Tokens</h2>
+<p>Authentication tokens allow scripts using <a
+ href="https://launchpad.net/lava-tool">lava-tool</a> to securely access LAVA
+resources. You can create and use any number of tokens simultaneously. If you
+believe a token is compromised you can quickly remove it. Anyone using that
+token will no longer be able to authenticate as You in the system.</p>
+<h2>Your tokens</h2>
+{% for token in token_list %}
+<h3>Token {{ token.pk }}</h3>
+<dl>
+ <dt>Description:</dt>
+ <dd><a
+ href="{% url linaro_django_xmlrpc.views.edit_token token.pk %}"
+ >{{token.description|default:"empty"}}</a></dd>
+ <dt>Created on:</dt>
+ <dd>{{token.created_on|date}}</dd>
+ <dt>Last used:</dt>
+ <dd>
+ {% if token.last_used_on %}
+ {{token.last_used_on|timesince }} ago
+ {% else %}
+ <em>It was not used yet</em>
+ {% endif %}
+ </dd>
+ <dt>Secret:</dt>
+ <dd>
+ <span id="notice_{{ forloop.counter }}">The secret is currently hidden.</span>
+ <div class="console" style="display:none;" id="secret_{{ forloop.counter }}">
+ <code>{{ token.secret }}</code>
+ </div>
+ </dd>
+</dl>
+<ul>
+ <li><a
+ href="#"
+ id="button_{{ forloop.counter }}"
+ >display this token</a></li>
+ <li><a
+ href="{% url linaro_django_xmlrpc.views.delete_token token.pk %}"
+ >delete this token</a></li>
+</ul>
+<script type="text/javascript">
+ $("#button_{{ forloop.counter }}").click(function() {
+ $("#secret_{{ forloop.counter }}").toggle();
+ $("#notice_{{ forloop.counter }}").toggle();
});
-</script>
-<table id="tokens" class="demo_jui display">
- <caption>
- Available authentication tokens for {{ request.user.username }}
- </caption>
- <thead>
- <tr>
- <th>ID</th>
- <th>{% trans "Description" %}</th>
- <th>{% trans "Created On" %}</th>
- <th>{% trans "Last Used On" %}</th>
- <th style="width: 128ex">{% trans "Secret" %}</th>
- <th>{% trans "Actions" %}</th>
- </tr>
- </thead>
- <tbody>
- {% for token in token_list %}
- <tr>
- <td>{{ token.pk }}</td>
- <td>{{ token.description|default:"empty" }}</td>
- <td>{{ token.created_on|date }}</td>
- <td>{{ token.last_used_on|default_if_none:"Never" }}</td>
- <td>
- <code style="display:none; overflow:auto;" id="secret_{{ forloop.counter }}">{{ token.secret }}</code>
- </td>
- <td>
- <a href="{% url linaro_django_xmlrpc.views.delete_token token.pk %}">{% trans "Delete" %}</a>
- <a href="{% url linaro_django_xmlrpc.views.edit_token token.pk %}">{% trans "Edit" %}</a>
- <button id="button_{{ forloop.counter }}">{% trans "Toggle" %}</button>
- <script type="text/javascript">
- $("#button_{{ forloop.counter }}").click(function() {
- $("#secret_{{ forloop.counter }}").toggle();
- });
- </script>
- </td>
- </tr>
- {% endfor %}
- </tbody>
-</table>
-{% endblock %}
-
-
-{% block sidebar %}
-<p>
- Authentication tokens allow scripts
- using <a href="https://launchpad.net/lava-tool">lava-tool</a> to
- securely access LAVA resources.
-</p>
-<p>You can <a href="{% url linaro_django_xmlrpc.views.create_token %}">create a new authentication token</a>.</p>
+</script>
+{% empty %}
+<p>You don't have any tokens yet.</p>
+{% endfor %}
{% endblock %}