fixup! Switch to maud for templating
This commit is contained in:
parent
d24a363a63
commit
0dc09cef4f
|
@ -1,65 +0,0 @@
|
|||
{#
|
||||
SPDX-FileCopyrightText: 2024 Simon Bruder <simon@sbruder.de>
|
||||
|
||||
SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
#}
|
||||
|
||||
{% let branding = "li7y" -%}
|
||||
<!DOCTYPE html>
|
||||
<html class="h-100">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>{% block title %}{{ branding }}{% endblock %}</title>
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
|
||||
<link rel="stylesheet" href="/static/vendor/bootstrap.min.css">
|
||||
</head>
|
||||
<body class="d-flex flex-column h-100">
|
||||
<nav class="navbar navbar-expand-lg bg-body-secondary">
|
||||
<div class="container">
|
||||
<a class="navbar-brand" href="/">{{ branding }}</a>
|
||||
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbar-expander">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
|
||||
<div class="collapse navbar-collapse" id="navbar-expander">
|
||||
<ul class="navbar-nav me-auto mb-2 mb-md-0">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link{% if req.path() == "/" %} active{% endif %}" href="/">Home</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link{% if req.path() == "/items" %} active{% endif %}" href="/items">Items</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link{% if req.path() == "/item-classes" %} active{% endif %}" href="/item-classes">Item Classes</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<main class="container my-4">
|
||||
<div class="d-flex justify-content-between mb-3">
|
||||
<div>
|
||||
<h2>{% block page_title %}{% endblock %}</h2>
|
||||
</div>
|
||||
<div>
|
||||
{% block page_actions %}{% endblock %}
|
||||
</div>
|
||||
</div>
|
||||
{% block main %}{% endblock %}
|
||||
</main>
|
||||
|
||||
<footer class="mt-auto py-3 bg-body-tertiary text-body-tertiary">
|
||||
<div class="container">
|
||||
<p class="mb-0">li7y is free software, released under the terms of the AGPL v3</p>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
<script src="/static/vendor/bootstrap.bundle.min.js"></script>
|
||||
<script src="/static/app.js"></script>
|
||||
{# TODO this is not the best way, but it works for now #}
|
||||
{% block extra_scripts %}{% endblock %}
|
||||
</body>
|
||||
</html>
|
|
@ -1,52 +0,0 @@
|
|||
{#
|
||||
SPDX-FileCopyrightText: 2024 Simon Bruder <simon@sbruder.de>
|
||||
|
||||
SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
#}
|
||||
|
||||
{% extends "base.html" %}
|
||||
{% block title %}{% block page_title %}{{ item_class.name }}{% endblock %} – Edit Item Class – {{ branding }}{% endblock %}
|
||||
{% block main %}
|
||||
<form method="POST">
|
||||
<div class="mb-3">
|
||||
<label for="uuid" class="form-label">UUID</label>
|
||||
<input type="text" class="form-control" id="uuid" disabled required value="{{ item_class.id }}">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="name" class="form-label">Name</label>
|
||||
<input type="text" class="form-control" id="name" name="name" required value="{{ item_class.name }}">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="type" class="form-label">Type</label>
|
||||
<select class="form-select" id="type" name="type" required value="{{ item_class.type }}">
|
||||
{% for variant in ItemClassType::VARIANTS %}
|
||||
<option>{{ variant }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="parent" class="form-label">Parent</label>
|
||||
<input type="text" class="form-control" id="parent" name="parent"{% if let Some(parent) = item_class.parent %} value="{{ parent }}"{% else %} disabled{% endif %}>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary">Edit</button>
|
||||
</form>
|
||||
<script>
|
||||
(() => {
|
||||
document.getElementById("type").addEventListener("change", e => {
|
||||
console.log(e)
|
||||
let parentInput = document.getElementById("parent")
|
||||
switch (e.target.value) {
|
||||
case "generic":
|
||||
parentInput.disabled = true
|
||||
parentInput.value = ""
|
||||
break
|
||||
case "specific":
|
||||
parentInput.disabled = false
|
||||
break
|
||||
default:
|
||||
console.error("invalid type!")
|
||||
}
|
||||
})
|
||||
})()
|
||||
</script>
|
||||
{% endblock %}
|
Loading…
Reference in a new issue