Skip to content
Snippets Groups Projects
Commit 90e2cc69 authored by Martin Burchell's avatar Martin Burchell
Browse files

Merge branch 'staging' into date_fix

parents 755cac78 dc96d993
No related branches found
No related tags found
No related merge requests found
......@@ -6,7 +6,7 @@
{% block maincontent %}
<h2>{% trans "View data" %}</h2>
<form action="{% url "data-view-process" %}" method="post">{% csrf_token %}
<form action="{% url "data-view-process" %}" method="post" class="view-items-form">{% csrf_token %}
{% with pagination_class="pull-left" %}
{% render_table table %}
......@@ -20,3 +20,54 @@
</form>
{% endblock maincontent %}
{% block lastjs %}
<script type="text/javascript">
(function ($) {
var selectors = {
td_input : '.view-items-form td.delete > input',
th_delete : '.view-items-form th.delete'
};
function addCheckbox(selector, check_id) {
var check = $('<input>', {
type: 'checkbox',
id: check_id
}),
label = $('<label>', {
for: check_id
});
label.html(
$(selector).html()
);
$(selector).html("")
.append(check)
.append(label);
}
function toggleSelection(e) {
var checked = $(e.target).prop("checked");
$(selectors.td_input).prop("checked", checked);
}
function setSelectAll(e) {
var checked = $(selectors.td_input + ':checked').length,
all = $(selectors.td_input).length,
checked_all = all === checked;
$(selectors.th_delete + ' input').prop("checked", checked_all);
}
function init() {
addCheckbox(selectors.th_delete, 'select-all-items');
$(selectors.th_delete + ' input').on('change', toggleSelection);
$(selectors.td_input).on('change', setSelectAll);
}
init();
})(jQuery);
</script>
{% endblock lastjs %}
......@@ -63,6 +63,9 @@ html, body {
}
/* ------------- table & pagination ---------------- */
th label {
padding-left: .25em;
}
.current {
margin-left: 1em;
margin-right: 1em;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment