mirror of
https://github.com/nottinghamtec/PyRIGS.git
synced 2026-01-17 13:32:15 +00:00
FEAT: Add buttons for some common defaults on audit form
TODO: Partialise those fragments and add them to the edit/create forms too.
This commit is contained in:
@@ -4,6 +4,16 @@
|
||||
|
||||
{% block content %}
|
||||
<script>
|
||||
function setAcquired(today) {
|
||||
var date = new Date(1970, 0, 1);
|
||||
if(today) {
|
||||
date = new Date();
|
||||
}
|
||||
$('#id_date_acquired').val([date.getFullYear(), ('0' + (date.getMonth()+1)).slice(-2), ('0' + date.getDate()).slice(-2)].join('-'));
|
||||
}
|
||||
function setLength(length) {
|
||||
$('#id_length').val(length);
|
||||
}
|
||||
function checkIfCableHidden() {
|
||||
if (document.getElementById("id_is_cable").checked) {
|
||||
document.getElementById("cable-table").hidden = false;
|
||||
@@ -49,9 +59,13 @@
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="{{ form.date_acquired.id_for_label }}" class="col-sm-2 control-label">Date Acquired</label>
|
||||
<div class="col-sm-10">
|
||||
<div class="col-sm-6">
|
||||
{% render_field form.date_acquired|add_class:'form-control' value=object.date_acquired %}
|
||||
</div>
|
||||
<div class="col-sm-4">
|
||||
<btn class="btn btn-default" onclick="setAcquired(true);">Today</btn>
|
||||
<btn class="btn btn-default" onclick="setAcquired(false);">Unknown</btn>
|
||||
</div>
|
||||
<!--- TODO Add buttons for 'today' and 'unknown' (sets to beginning of time)--->
|
||||
</div>
|
||||
<div class="form-group">
|
||||
@@ -85,12 +99,17 @@
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="{{ form.length.id_for_label }}" class="col-sm-2 control-label">Length</label>
|
||||
<div class="col-sm-10">
|
||||
<div class="col-sm-6">
|
||||
<div class="input-group">
|
||||
{% render_field form.length|add_class:'form-control' %}
|
||||
<span class="input-group-addon">{{ form.length.help_text }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-4">
|
||||
<btn class="btn btn-danger" onclick="setLength('5');">5m</btn>
|
||||
<btn class="btn btn-success" onclick="setLength('10');">10m</btn>
|
||||
<btn class="btn btn-info" onclick="setLength('20');">20m</btn>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="{{ form.csa.id_for_label }}" class="col-sm-2 control-label">Cross Sectional Area</label>
|
||||
|
||||
Reference in New Issue
Block a user