revamp invites and certificates screen
parent
72482e4f92
commit
414f17476f
File diff suppressed because one or more lines are too long
@ -1,5 +1,32 @@
|
||||
$(function () {
|
||||
var errorDiv = $('<div>').addClass('error-message');
|
||||
|
||||
function error(msg) {
|
||||
$('.title').after(errorDiv.text(msg));
|
||||
}
|
||||
|
||||
$('.actions .certificate-delete').click(function () {
|
||||
$(this).parents('li').first().find('.certificate-revoke').addClass('show')
|
||||
$(this).parents('.actions').hide().parents('li').first().find('.revoke-q').show();
|
||||
});
|
||||
|
||||
$('.revoke-q .no').click(function () {
|
||||
$(this).parents('.revoke-q').hide().parents('li').first().find('.actions').show();
|
||||
});
|
||||
|
||||
$('.revoke-q .yes').click(function () {
|
||||
var _this=this;
|
||||
|
||||
$.post('/panel/certificates/revoke', {
|
||||
name: $(_this).data('name')
|
||||
}, function (data) {
|
||||
if (data.success) {
|
||||
$(_this)
|
||||
.parents('li')
|
||||
.first()
|
||||
.remove();
|
||||
} else {
|
||||
error(data.error);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -1,55 +1,40 @@
|
||||
{% extends "base_bootstrap.html.twig" %}
|
||||
{% extends "panel.html.twig" %}
|
||||
|
||||
{% block head %}
|
||||
{{ parent() }}
|
||||
|
||||
<script src="/js/clipboard.min.js"></script>
|
||||
<script src="/js/invites.js"></script>
|
||||
<script src="/js/pages/invites.js"></script>
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<h2 id="certificates">Invites <small>You used {{ used_invites }} from your {{ max_invites == -1 ? 'infinite' : max_invites }} invites</small></h2>
|
||||
</div>
|
||||
{% if error %}
|
||||
<div class="row">
|
||||
<div class="alert alert-warning" role="alert">
|
||||
{{ error }}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="row">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Invite</th>
|
||||
<th>
|
||||
{% if max_invites > used_invites or max_invites == -1 %}
|
||||
<form action="/panel/invites/create" method="post">
|
||||
<button class="btn btn-default pull-right" type="submit">Create new invite</button>
|
||||
{% block panel_contents %}
|
||||
{% if user.getActiveCertificates()|length < user.getMaxKeys() %}
|
||||
<form class="invite-create" action="/panel/invites/create" method="post">
|
||||
<button type="submit">create</button>
|
||||
</form>
|
||||
{% endif %}
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
<div class="title">
|
||||
<h1>Invites</h1>
|
||||
<div class="undertone">You used {{ used_invites }} from your {{ max_invites == -1 ? 'infinite' : max_invites }} invites</div>
|
||||
</div>
|
||||
|
||||
<ul class="invites">
|
||||
{% for invite in invites %}
|
||||
<tr>
|
||||
<td>
|
||||
<li>
|
||||
<div class="text">
|
||||
<kbd>{{ invite.getInvite() }}</kbd>
|
||||
</td>
|
||||
<td>
|
||||
<button class="btn btn-default copy pull-right" data-clipboard-text="{{ invite.getInvite() }}">Copy</button>
|
||||
</td>
|
||||
</tr>
|
||||
{% else %}
|
||||
<tr>
|
||||
<td colspan="2">You don't have any invites :(</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="actions">
|
||||
<span>
|
||||
<a class="copy" data-clipboard-text="{{ invite.getInvite() }}">copy</a>
|
||||
</span>
|
||||
</div>
|
||||
</li>
|
||||
{% else %}
|
||||
<li>
|
||||
You don't have any invites
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endblock %}
|
||||
|
Loading…
Reference in New Issue