First push
This commit is contained in:
148
ACC/cfgs/templates/cfgs/confEdit.html
Normal file
148
ACC/cfgs/templates/cfgs/confEdit.html
Normal file
@@ -0,0 +1,148 @@
|
||||
{% extends "main.html" %}
|
||||
{% block content %}
|
||||
|
||||
<style>
|
||||
#cfg-wrapper {
|
||||
height:100%;
|
||||
position:relative;
|
||||
}
|
||||
|
||||
#cfg-inner-wrapper {
|
||||
height:100%;
|
||||
padding-top: 100px;
|
||||
}
|
||||
|
||||
#cfgs {
|
||||
height:100px;
|
||||
margin-top:-100px;
|
||||
}
|
||||
|
||||
#cfg {
|
||||
height: 100%;
|
||||
overflow: auto;
|
||||
<!--margin-left: 200px;-->
|
||||
padding-left: 30px;
|
||||
<!--border-left: 1px solid #9e9e9e;-->
|
||||
}
|
||||
|
||||
sidenav {
|
||||
position: fixed!important;
|
||||
width:200px;
|
||||
padding-left:10px;
|
||||
}
|
||||
|
||||
input[type=submit] {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.container {
|
||||
padding: 20px 16px;
|
||||
}
|
||||
</style>
|
||||
|
||||
{% load django_bootstrap_breadcrumbs %}
|
||||
{% block breadcrumbs %}
|
||||
{% clear_breadcrumbs %}
|
||||
{% for b, u in path %}
|
||||
{% breadcrumb_raw_safe b u %}
|
||||
{% endfor %}
|
||||
{% endblock %}
|
||||
|
||||
{% load django_bootstrap5 %}
|
||||
{% bootstrap_css %}
|
||||
{% bootstrap_javascript %}
|
||||
|
||||
<div id="cfg-wrapper" class="container">
|
||||
<div class="card" style="height:100%; border:none">
|
||||
<div id="cfg-inner-wrapper">
|
||||
|
||||
<header id="cfgs">
|
||||
{% render_breadcrumbs %}
|
||||
</header>
|
||||
|
||||
{% if form is not None %}
|
||||
<div id="cfg">
|
||||
<!--<div>-->
|
||||
<!--<h6 style="font-weight:bold">{{request.path}}</h6>-->
|
||||
<form action="" method="post" style="padding-right:20px">
|
||||
|
||||
{% csrf_token %}
|
||||
{% bootstrap_form form %}
|
||||
</form>
|
||||
<!--</div>-->
|
||||
</div>
|
||||
{% endif%}
|
||||
|
||||
{% if forms is not None %}
|
||||
<div id="cfg">
|
||||
{% for frm in forms %}
|
||||
<div id="form{{forloop.counter0}}" class="card" style="display:none">
|
||||
<!--<h6 style="font-weight:bold">{{request.path}}/{{forloop.counter0}}</h6>-->
|
||||
<form action="" method="post" style="padding-right:20px">
|
||||
|
||||
{% csrf_token %}
|
||||
<!--{{ frm }}-->
|
||||
{% bootstrap_form frm %}
|
||||
<input type="hidden" name="_id" value="{{forloop.counter0}}">
|
||||
</form>
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
||||
<input id="prevbutton" type="button" value="Previous" class="btn btn-primary" disabled/>
|
||||
<input id="nextbutton" type="button" value="Next" class="btn btn-primary" disabled/>
|
||||
<input id="removebutton" type="button" class="btn btn-danger" value="Remove" disabled/>
|
||||
<input id="addbutton" type="button" value="Add" class="btn btn-success" disabled/>
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var form_id = 0
|
||||
|
||||
function handleButtons(new_form_id) {
|
||||
form_id = new_form_id
|
||||
$("div[id^='form']").hide();
|
||||
$("#form"+new_form_id).show();
|
||||
|
||||
if (new_form_id>0) $("#prevbutton").prop('disabled', false);
|
||||
else $("#prevbutton").prop('disabled', true);
|
||||
|
||||
if ($('#form1').length) $("#removebutton").prop('disabled', false);
|
||||
else $("#removebutton").prop('disabled', true);
|
||||
|
||||
if ($('#form'+(new_form_id+1)).length) {
|
||||
$("#nextbutton").prop('disabled', false);
|
||||
$("#addbutton").prop('disabled', true);
|
||||
} else {
|
||||
$("#nextbutton").prop('disabled', true);
|
||||
$("#addbutton").prop('disabled', false);
|
||||
}
|
||||
}
|
||||
|
||||
$("#prevbutton").click(function (){handleButtons(form_id-1)})
|
||||
$("#nextbutton").click(function (){handleButtons(form_id+1)})
|
||||
$("#addbutton").click(function() {
|
||||
window.location = '{{request.path}}'+'/add';
|
||||
})
|
||||
$("#removebutton").click(function() {
|
||||
window.location = '{{request.path}}'+'/remove/'+form_id;
|
||||
})
|
||||
|
||||
handleButtons(form_id)
|
||||
</script>
|
||||
|
||||
{% endif %}
|
||||
|
||||
|
||||
<script>
|
||||
$(function() { $(":input").change(function() {
|
||||
$.post( '', $(this.form).serialize(), function(data) {
|
||||
alert('server response'+data);
|
||||
}, 'json' );
|
||||
})
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
88
ACC/cfgs/templates/cfgs/confSelect.html
Normal file
88
ACC/cfgs/templates/cfgs/confSelect.html
Normal file
@@ -0,0 +1,88 @@
|
||||
{% extends "main.html" %}
|
||||
{% block content %}
|
||||
|
||||
<style>
|
||||
tr:hover {
|
||||
background-color: #d3d3d3;
|
||||
}
|
||||
.container {
|
||||
padding: 20px 16px;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
{% load django_bootstrap5 %}
|
||||
{% bootstrap_css %}
|
||||
{% bootstrap_javascript %}
|
||||
|
||||
<div class="container">
|
||||
<div class="card">
|
||||
<h6 style="font-weight:bold">Create new config</h6>
|
||||
<form action="/cfgs/create" method="post">
|
||||
{% csrf_token %}
|
||||
{% bootstrap_form form %}
|
||||
<input type="submit" value="Create" class="btn btn-success">
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="container">
|
||||
<div class="card">
|
||||
<h6 style="font-weight:bold">Existing configs</h6>
|
||||
<table>
|
||||
<tr><td style="font-weight:bold">Name</td><td style="font-weight:bold">Actions</td><td></td><td></td></tr>
|
||||
{% for cfg in cfgs %}
|
||||
<tr>
|
||||
<td style="width: 200px">
|
||||
<form id="cfgform{{forloop.counter0}}" style="margin: 0" action="/cfgs/rename" method="post">{% csrf_token %}
|
||||
<input hidden name="cfg" value="{{cfg}}">
|
||||
<i id="rename{{forloop.counter0}}" type="button"
|
||||
style="vertical-align: middle; color: blue"
|
||||
title="Rename" class="material-icons">edit</i>
|
||||
<input id="cfgname{{forloop.counter0}}" name="cfgname"
|
||||
oldvalue={{cfg}} value={{cfg}} style="width: 150px" readonly>
|
||||
</form>
|
||||
</td>
|
||||
<td>
|
||||
<form style="margin: 0" action="/cfgs/clone" method="post">{% csrf_token %}
|
||||
<input hidden name="cfg" value="{{cfg}}">
|
||||
<a href="/cfgs/{{cfg}}" class="btn btn-primary">Edit</a>
|
||||
</form>
|
||||
</td>
|
||||
<td>
|
||||
<form style="margin: 0" action="/cfgs/clone" method="post">{% csrf_token %}
|
||||
<input hidden name="cfg" value="{{cfg}}">
|
||||
<input type="submit" value="Clone" class="btn btn-success">
|
||||
</form>
|
||||
</td>
|
||||
<td>
|
||||
<form style="margin: 0" action="/cfgs/delete" method="post">{% csrf_token %}
|
||||
<input hidden name="cfg" value="{{cfg}}">
|
||||
<input type="submit" value="Delete" class="btn btn-danger">
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
<script>
|
||||
$("#rename{{forloop.counter0}}").click(function (){
|
||||
var cfg = $("#cfgname{{forloop.counter0}}");
|
||||
var ro = cfg.prop('readonly');
|
||||
cfg.prop('readonly', !ro);
|
||||
if (ro) {
|
||||
$(this).css('color','red');
|
||||
cfg.prop('oldvalue', cfg.val());
|
||||
cfg.prop('type', 'text');
|
||||
cfg.focus()
|
||||
} else {
|
||||
$(this).css('color','blue');
|
||||
if (cfg.prop('oldvalue') != cfg.val()) {
|
||||
$("#cfgform{{forloop.counter0}}").submit();
|
||||
}
|
||||
}
|
||||
})
|
||||
</script>
|
||||
{% endfor %}
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
Reference in New Issue
Block a user