a
This commit is contained in:
@@ -9,13 +9,15 @@ def mainpage():
|
|||||||
@app.route('/submit', methods =['POST'])
|
@app.route('/submit', methods =['POST'])
|
||||||
def submit():
|
def submit():
|
||||||
value = request.form.get("query")
|
value = request.form.get("query")
|
||||||
|
time_value = request.form.get("time")
|
||||||
print(value)
|
print(value)
|
||||||
items.append(value)
|
items.append((value, time))
|
||||||
return redirect(url_for("mainpage"))
|
return redirect(url_for("mainpage"))
|
||||||
@app.route("/delete", methods=["POST"])
|
@app.route("/delete", methods=["POST"])
|
||||||
def delete():
|
def delete():
|
||||||
value = request.form.get("item")
|
value = request.form.get("item_name")
|
||||||
|
time_value = request.form.get("item_time")
|
||||||
if value in items:
|
if value in items:
|
||||||
items.remove(value)
|
items.remove((value, time_value))
|
||||||
print("Deleting:", value)
|
print("Deleting:", value)
|
||||||
return redirect(url_for("mainpage"))
|
return redirect(url_for("mainpage"))
|
||||||
@@ -1,67 +1,67 @@
|
|||||||
<!DOCTYPE html>
|
{% extends "base.html" %}
|
||||||
<html lang="fr">
|
{% block content %}
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8">
|
|
||||||
{% if og_title %} <meta property="og:title" content="{{ og_title }}"> {% endif %}
|
|
||||||
{% if og_description %} <meta property="og:description" content="{{ og_description }}"> {% endif %}
|
|
||||||
{% if og_image %}
|
|
||||||
<meta property="og:image" content="{{ og_image }}">
|
|
||||||
<meta property="og:image:width" content="1200">
|
|
||||||
<meta property="og:image:height" content="630">
|
|
||||||
{% endif %}
|
|
||||||
<title>{{ title if title else "Portfolio" }}</title>
|
|
||||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">
|
|
||||||
<link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}">
|
|
||||||
<style>
|
|
||||||
:root {
|
|
||||||
--bg-image: url('{{ url_for("static", filename="img/" ~ background) }}');
|
|
||||||
}
|
|
||||||
|
|
||||||
body {
|
<div class="container py-4">
|
||||||
background-image: var(--bg-image);
|
|
||||||
background-position: center top;
|
|
||||||
background-repeat: no-repeat;
|
|
||||||
background-color: #2c2c2c;
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
min-height: 100vh;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
|
|
||||||
<header>
|
<!-- Formulaire réduit avec sélection d'heure -->
|
||||||
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
|
<div class="card bg-dark bg-opacity-75 p-3 mb-4">
|
||||||
<div class="container">
|
<form method="post" action="/submit" class="row g-2 align-items-center justify-content-start">
|
||||||
<a class="navbar-brand" href="{{ url_for('mainpage') }}">BG Shutdown</a>
|
|
||||||
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
|
<!-- Champ texte -->
|
||||||
<span class="navbar-toggler-icon"></span>
|
<div class="col-md-4">
|
||||||
</button>
|
<input
|
||||||
<div class="collapse navbar-collapse" id="navbarNav">
|
type="text"
|
||||||
<ul class="navbar-nav ms-auto">
|
name="query"
|
||||||
<li class="nav-item">
|
class="form-control bg-dark text-white"
|
||||||
<a class="nav-link {% if title=='BG Shutdown' %}active{% endif %}" href="{{ url_for('mainpage') }}">Accueil</a>
|
placeholder="Enter text">
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
</nav>
|
|
||||||
</header>
|
|
||||||
|
|
||||||
<main class="container my-5">
|
<!-- Sélecteur d'heure -->
|
||||||
{% block content %}{% endblock %}
|
<div class="col-md-2">
|
||||||
</main>
|
<select name="time" class="form-select bg-dark text-white">
|
||||||
|
{% for hour in range(0, 24) %}
|
||||||
|
<option value="{{ '%02d:00'|format(hour) }}">{{ '%02d:00'|format(hour) }}</option>
|
||||||
|
<option value="{{ '%02d:30'|format(hour) }}">{{ '%02d:30'|format(hour) }}</option>
|
||||||
|
{% endfor %}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
<footer class="bg-dark text-center text-lg-start py-3 border-top">
|
<!-- Bouton submit -->
|
||||||
<div class="container d-flex justify-content-center align-items-center">
|
<div class="col-auto">
|
||||||
<p class="mb-0 text-light">
|
<button type="submit" class="btn btn-secondary">
|
||||||
Spirit
|
Submit
|
||||||
</p>
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</footer>
|
|
||||||
|
|
||||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL" crossorigin="anonymous"></script>
|
<!-- Tableau / Liste -->
|
||||||
</body>
|
<div class="card bg-dark bg-opacity-75 p-3">
|
||||||
</html>
|
<h5 class="text-white mb-3">Liste des éléments</h5>
|
||||||
|
<div class="table-items">
|
||||||
|
{% for item in items %}
|
||||||
|
<div class="d-flex justify-content-between align-items-center py-2">
|
||||||
|
<!-- Nom -->
|
||||||
|
<span class="text-white">{{ item.name }}</span>
|
||||||
|
|
||||||
|
<!-- Heure -->
|
||||||
|
<span class="text-white">{{ item.time }}</span>
|
||||||
|
|
||||||
|
<!-- Bouton supprimer -->
|
||||||
|
<form method="post" action="/delete" class="m-0 p-0">
|
||||||
|
<input type="hidden" name="item_name" value="{{ item.name }}">
|
||||||
|
<input type="hidden" name="item_time" value="{{ item.time }}">
|
||||||
|
<button type="submit" class="btn btn-sm btn-danger">×</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
{% if not loop.last %}
|
||||||
|
<hr class="border-secondary my-1">
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{% endblock %}
|
||||||
|
|||||||
Reference in New Issue
Block a user