authentic/src/authentic2/apps/authenticators/templates/authentic2/authenticators/authenticators_order_form.html

47 lines
1.3 KiB
HTML

{% extends "authentic2/authenticators/authenticator_common.html" %}
{% load i18n gadjo %}
{% block breadcrumb %}
{{ block.super }}
<a href="#"></a>
{% endblock %}
{% block content %}
<form method="post" enctype="multipart/form-data">
<ul class="objects-list" id="authenticators-ordered-list">
{% for authenticator in authenticators %}
<li data-authenticator-id="{{ authenticator.pk }}">
<span class="handle"></span> {{ authenticator }}
</li>
{% endfor %}
</ul>
{% csrf_token %}
{{ form|with_template }}
<div class="buttons">
<button>{% trans "Save" %}</button>
<a class="cancel" href="{% url 'a2-manager-authenticators' %}">{% trans 'Cancel' %}</a>
</div>
<script>
$(function () {
function set_order_field_value () {
var new_order = $('#authenticators-ordered-list li').map(
function() { return $(this).data('authenticator-id'); }
).get().join();
$('#id_order').val(new_order);
}
set_order_field_value();
$('#authenticators-ordered-list').sortable({
handle: '.handle',
stop: function(event, ui) {
set_order_field_value();
}
}).sortable('refresh');
});
</script>
</form>
{% endblock %}