add Menu edit
This commit is contained in:
Binary file not shown.
@@ -1,62 +1 @@
|
|||||||
|
|
||||||
<form class="sortable" action="/editmenu" method="POST">
|
|
||||||
<div id="menu" class="list">
|
|
||||||
{% for item in menu.keys() %}
|
|
||||||
<div class="entry">
|
|
||||||
{% if menu[item] is mapping %}
|
|
||||||
|
|
||||||
{{item }}
|
|
||||||
|
|
||||||
{% for subitem in menu[item].keys() %}
|
|
||||||
<div class="entry n1">
|
|
||||||
{{ subitem }}
|
|
||||||
<input class="input" id="{{ item }}">
|
|
||||||
</div>
|
|
||||||
{% endfor %}
|
|
||||||
|
|
||||||
|
|
||||||
{% else %}
|
|
||||||
<div class="entry">
|
|
||||||
{{ item }}
|
|
||||||
<input class="input" value="{{ menu[item] }}">
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
{% endfor %}
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
|
|
||||||
<style>
|
|
||||||
.n1 > div {
|
|
||||||
background-color: lightblue;
|
|
||||||
padd ing-left: 50px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.n2 > div {
|
|
||||||
background-color: lightgreen;
|
|
||||||
padding-left: 50px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.list {
|
|
||||||
padding: 50px;
|
|
||||||
}
|
|
||||||
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<script src="/static/vendors/Sortable/Sortable.min.js"></script>
|
|
||||||
|
|
||||||
<script type="text/javascript">
|
|
||||||
var elements = document.getElementsByClassName('list');
|
|
||||||
|
|
||||||
for (var i = 0; i < elements.length; i++) {
|
|
||||||
|
|
||||||
new Sortable(elements[i], {
|
|
||||||
group: 'shared',
|
|
||||||
animation: 150,
|
|
||||||
fallbackOnBody: true,
|
|
||||||
swapThreshold: 0.65
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
|
|||||||
18
app/templates/edit-tools/css/toolbar.css
Normal file
18
app/templates/edit-tools/css/toolbar.css
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
|
||||||
|
<style>
|
||||||
|
.msginfo
|
||||||
|
{
|
||||||
|
color: white;
|
||||||
|
font-weight:bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.msginfo .success
|
||||||
|
{
|
||||||
|
background-color: green;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.msginfo .error{
|
||||||
|
background-color: red;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
17
app/templates/edit-tools/css/toolbar.css~
Normal file
17
app/templates/edit-tools/css/toolbar.css~
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
|
||||||
|
|
||||||
|
.msginfo
|
||||||
|
{
|
||||||
|
color: white;
|
||||||
|
font-weight:bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.msginfo .success
|
||||||
|
{
|
||||||
|
background-color: green;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.msginfo .error{
|
||||||
|
background-color: red
|
||||||
|
}
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
|
|
||||||
<script>
|
|
||||||
window.onload = function () {
|
|
||||||
|
|
||||||
var dropzoneOptions = {
|
|
||||||
dictDefaultMessage: 'Déposez vos images ici !',
|
|
||||||
paramName: "file",
|
|
||||||
maxFilesize: 8, // MB
|
|
||||||
acceptedFiles: "image/*",
|
|
||||||
url: "/upload-gallery/{{ bloc.name }}",
|
|
||||||
chunking: true,
|
|
||||||
forceChunking: true,
|
|
||||||
chunkSize: 1000000,
|
|
||||||
autoProcessQueue: true,
|
|
||||||
init: function () {
|
|
||||||
this.on("success", function (file) {
|
|
||||||
console.log("success > " + file.name);
|
|
||||||
setTimeout(() => { this.removeFile(file); }, 2000);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
var uploader = document.querySelector('#uploader');
|
|
||||||
var myDropzone = new Dropzone(uploader, dropzoneOptions);
|
|
||||||
console.log("Loaded");
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
|
|
||||||
|
|||||||
18
app/templates/edit-tools/toolbar.html
Normal file
18
app/templates/edit-tools/toolbar.html
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
|
||||||
|
<style>
|
||||||
|
.msginfo
|
||||||
|
{
|
||||||
|
color: white;
|
||||||
|
font-weight:bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.msginfo .success
|
||||||
|
{
|
||||||
|
background-color: green;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.msginfo .error{
|
||||||
|
background-color: red;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
35
app/templates/edit.html.tpl~
Normal file
35
app/templates/edit.html.tpl~
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
{% extends 'index.html.tpl' %}
|
||||||
|
|
||||||
|
{% block css %}
|
||||||
|
{% include 'edit-tools/css/dropzone' %}
|
||||||
|
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block body %}
|
||||||
|
|
||||||
|
{% include config.theme+'/_nav.html' %}
|
||||||
|
{% include config.theme+'/_navtool.html' %}
|
||||||
|
|
||||||
|
{% for bloc in myblocs.values() %}
|
||||||
|
|
||||||
|
{% if blocEdit == bloc.name %}
|
||||||
|
{% include config.theme+'/_'+bloc.type+'-edit.html' %}
|
||||||
|
{% else %}
|
||||||
|
{% include config.theme+'/_'+bloc.type+'.html' %}
|
||||||
|
|
||||||
|
<button class="btn btn-success btn-xl pull-right"
|
||||||
|
style="margin-top:-7rem; margin-right:1rem;"
|
||||||
|
hx-get="/edit/{{ bloc.name }}"
|
||||||
|
hx-target="#{{bloc.name}}"
|
||||||
|
hw-swap="none"
|
||||||
|
> Éditer </button>
|
||||||
|
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
{% include '_flash_msgs.html' %}
|
||||||
|
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block js %}
|
||||||
|
|
||||||
|
{% endblock %}
|
||||||
Reference in New Issue
Block a user