Rewrite edit blocs and themes

This commit is contained in:
2026-03-28 12:20:30 +01:00
committed by kitoy
parent 9497c64b09
commit 3a5edc30bb
32 changed files with 627 additions and 373 deletions

View File

@@ -0,0 +1,48 @@
<div>
<form class="sortblocs" action="/sortblocs" method="POST" id="myblocs">
<input id="csrf_token" name="csrf_token" type="hidden" value="{{ csrf_token() }}">
{% include 'admin/_blocs-list.html' %}
</form>
<hr/>
<button class="btn btn-outline-success" onclick="printForm()">+</button>
<div class="formAddBloc" id="addBloc">
<form action="/addBloc" method="POST" class="" >
<input id="csrf_token" name="csrf_token" type="hidden" value="{{ csrf_token() }}">
<h3>Créé un nouveau bloc</H3>
<br>
<label for="nom"><b>Nom du bloc </b></label><br/>
<input type="text" name="blocName" placeholder="Nom" id="blocName" required="">
<br>
<label for="link"><b>Type de bloc</b></label>
<br/>
<select id="blocType" name="blocType" size="8">
<option value="presentation">Présentation</option>
<option value="text">Texte libre</option>
<option value="gallery">Galerie</option>
<option value="external_link">Lien externe</option>
<option value="contact">Contact</option>
</select>
<br/>
<button type="submit" class="btn btn-success"
hx-post="/addBloc"
hx-swap="outerHTML"
hx-target="#myblocs"> Créer le bloc </button>
</form>
</div>
<hr/>
<button class="btn btn-success" type="submit" form="myblocs"> Enregister </button>
</div>

View File

@@ -0,0 +1,33 @@
<form class="sortblocs" action="/sortblocs" method="POST" id="myblocs">
<div id="myblocs" class="myblocs">
{% for item in myblocs.keys() %}
<div class="bloc" id="bloc-{{ item }}" style="margin-top: 10px;">
<button class="btn"> {{ item }} - {{ myblocs[item]['type'] }} </button>
<input class="input-menu" id="bloc-{{ item }}" name="{{ item }}" value="" style="display:none;">
<button class="btn btn-danger" onclick="deleteItem(this)"> x </button>
</div>
{% endfor %}
</div>
</form>
<script src="/static/vendors/Sortable/Sortable.min.js"></script>
<script type="text/javascript">
var elements = document.getElementsByClassName('myblocs');
for (var i = 0; i < elements.length; i++) {
new Sortable(elements[i], {
group: 'shared',
animation: 150,
invertSwap: true,
fallbackOnBody: true,
swapThreshold: 0.65,
})};
</script>

View File

@@ -0,0 +1,9 @@
{% for item in myblocs.keys() %}
<div class="bloc" id="bloc-{{ item }}" style="margin-top: 10px;">
<button class="btn"> {{ item }} - {{ myblocs[item]['type'] }} </button>
<input class="input-menu" id="bloc-{{ item }}" name="{{ item }}" value="" style="display:none;">
<button class="btn btn-danger" onclick="deleteItem(this)"> x </button>
</div>
{% endfor %}

View File

@@ -1,4 +1,5 @@
<form class="sortable" action="/editmenu" method="POST" hx-post="/editmenu" hx-swap="none">
<form class="sortable" action="/editmenu" method="POST" id="menuEdit">
<input id="csrf_token" name="csrf_token" type="hidden" value="{{ csrf_token() }}">
<div id="Menu" class="list">
{% for item in menu.keys() %}
@@ -31,14 +32,14 @@
</div>
<button class="btn btn-outline-success" onclick="openForm()">+</button>
<hr>
<button class="btn btn-success" type="submit"> Enregistrer </button>
<button class="btn btn-success" type="submit" form="menuEdit"> Enregistrer </button>
</form>
<div class="form-popup" id="myForm" style="display: none;">
<form action="/action_page.php" class="form-container">
<form class="form-container">
<h3>Nouvelle entrée</h3><br>
<label for="nom"><b>Nom</b></label>

View File

@@ -0,0 +1,35 @@
<!--
<form class="sortblocs" action="/createpage" method="POST" id="mypages">
<div id="myblocs" class="myblocs">
{% for item in mypages %}
<div class="page" id="page" style="margin-top: 10px;">
<button class="btn"> {{ }} - {{ myblocs[item]['type'] }} </button>
<input class="input-menu" id="bloc-{{ item }}" name="{{ item }}" value="" style="display:none;">
<button class="btn btn-danger" onclick="deleteItem(this)"> x </button>
</div>
{% endfor %}
</div>
</form>
-->
<script src="/static/vendors/Sortable/Sortable.min.js"></script>
<script type="text/javascript">
var elements = document.getElementsByClassName('page');
for (var i = 0; i < elements.length; i++) {
new Sortable(elements[i], {
group: 'shared',
animation: 150,
invertSwap: true,
fallbackOnBody: true,
swapThreshold: 0.65,
})};
</script>

View File

@@ -0,0 +1,24 @@
<!--
<form class="sortblocs" action="/createpage" method="POST" id="mypages">
<div id="myblocs" class="myblocs">
</div>
</form>
-->
<script src="/static/vendors/Sortable/Sortable.min.js"></script>
<script type="text/javascript">
var elements = document.getElementsByClassName('page');
for (var i = 0; i < elements.length; i++) {
new Sortable(elements[i], {
group: 'shared',
animation: 150,
invertSwap: true,
fallbackOnBody: true,
swapThreshold: 0.65,
})};
</script>

View File

@@ -0,0 +1,14 @@
<div class="container text-center">
<form method='POST' action='/login'>
{{ form.csrf_token }}
<h2 class="mb-4"> Entrez votre login et votre mot de passe : </h2>
{{ form.login(col=5, class="form-control form-control-lg text-center" ) }}
{{ form.passwd(col=5, class="form-control form-control-lg text-center" ) }}
<br />
{{ form.submit() }}
</form>
</div>