The user is no longer correctly stored in the session, and I'm not sure why not.
132 lines
3.1 KiB
HTML
132 lines
3.1 KiB
HTML
{% extends "base.html" %}
|
|
<!-- File list-intentions-Intentions.html generated 2018-07-01T22:15:35.404Z by adl.to-selmer-templates.
|
|
See [Application Description Language](https://github.com/simon-brooke/adl).-->
|
|
|
|
|
|
{% block back-links %}
|
|
<div>
|
|
<div class='back-link-container'>
|
|
{% ifunequal params.offset "0" %}
|
|
<a id='prev-selector' class='back-link'>
|
|
Previous
|
|
</a>
|
|
{% else %}
|
|
<a id='back-link' class='back-link' href='{{servlet-context}}/admin'>
|
|
Back
|
|
</a>
|
|
{% endifunequal %}
|
|
</div>
|
|
</div>
|
|
|
|
{% endblock %}
|
|
{% block big-links %}
|
|
<div>
|
|
<div class='big-link-container'>
|
|
<a id='next-selector' role='button' class='big-link'>
|
|
Next
|
|
</a>
|
|
</div>
|
|
<div class='big-link-container'>
|
|
<a href='form-intentions-Intention' class='big-link'>
|
|
Add a new Intention
|
|
</a>
|
|
</div>
|
|
</div>
|
|
|
|
{% endblock %}
|
|
{% block content %}
|
|
<form id='list-intentions-Intentions' class='list' action='{{servlet-context}}/list-intentions-Intentions' method='POST'>
|
|
{% csrf-field %}
|
|
<input id='offset' type='hidden' value='{{params.offset|default:0}}'/>
|
|
<input id='limit' type='hidden' value='{{params.limit|default:50}}'/>
|
|
<table caption='intentions'>
|
|
<thead>
|
|
<tr>
|
|
<th>
|
|
visit_id
|
|
</th>
|
|
<th>
|
|
elector_id
|
|
</th>
|
|
<th>
|
|
option_id
|
|
</th>
|
|
<th>
|
|
locality
|
|
</th>
|
|
</tr>
|
|
<tr>
|
|
<th>
|
|
<input id='visit_id_expanded' type='text' name='visit_id_expanded' value='{{ params.visit_id_expanded }}'/>
|
|
</th>
|
|
<th>
|
|
<input id='elector_id_expanded' type='text' name='elector_id_expanded' value='{{ params.elector_id_expanded }}'/>
|
|
</th>
|
|
<th>
|
|
<input id='option_id_expanded' type='text' name='option_id_expanded' value='{{ params.option_id_expanded }}'/>
|
|
</th>
|
|
<th>
|
|
<input id='locality' type='number' name='locality' value='{{ params.locality }}'/>
|
|
</th>
|
|
<th>
|
|
<input type='submit' id='search-widget' value='Search'/>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% for record in records %}
|
|
<tr>
|
|
<td>
|
|
<a href='form-visits-Visit?id={{ record.visit_id }}'>
|
|
{{ record.visit_id_expanded }}
|
|
</a>
|
|
</td>
|
|
<td>
|
|
<a href='form-electors-Elector?id={{ record.elector_id }}'>
|
|
{{ record.elector_id_expanded }}
|
|
</a>
|
|
</td>
|
|
<td>
|
|
<a href='form-options-Option?id={{ record.option_id }}'>
|
|
{{ record.option_id_expanded }}
|
|
</a>
|
|
</td>
|
|
<td>
|
|
{{ record.locality }}
|
|
</td>
|
|
<td>
|
|
<a href='form-intentions-Intention?Id={{ record.Id }}'>
|
|
View
|
|
</a>
|
|
</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</form>
|
|
|
|
{% endblock %}
|
|
{% block extra-script %}
|
|
|
|
var form = document.getElementById('list-intentions-Intentions');
|
|
var ow = document.getElementById('offset');
|
|
var lw = document.getElementById('limit');
|
|
form.addEventListener('submit', function() {
|
|
ow.value='0';
|
|
});
|
|
|
|
{% ifunequal offset 0 %}
|
|
document.getElementById('prev-selector').addEventListener('click', function () {
|
|
ow.value=(parseInt(ow.value)-parseInt(lw.value));
|
|
console.log('Updated offset to ' + ow.value);
|
|
form.submit();
|
|
});
|
|
{% endifunequal %}
|
|
|
|
document.getElementById('next-selector').addEventListener('click', function () {
|
|
ow.value=(parseInt(ow.value)+parseInt(lw.value));
|
|
console.log('Updated offset to ' + ow.value);
|
|
form.submit();
|
|
});
|
|
{% endblock %}
|