exchanged Bootstrap with Bulma

This commit is contained in:
Johannes Erwerle 2026-09-14 18:41:10 +02:00
parent a0b69596c8
commit 9b971b0941
11 changed files with 157 additions and 113 deletions

View file

@ -31,7 +31,7 @@ ALLOWED_HOSTS = [
INSTALLED_APPS = [
"webui",
"crispy_forms",
"crispy_bootstrap5",
"crispy_bulma",
"django.contrib.admin",
"django.contrib.auth",
"django.contrib.contenttypes",
@ -40,9 +40,9 @@ INSTALLED_APPS = [
"django.contrib.staticfiles",
]
CRISPY_ALLOWED_TEMPLATE_PACKS = "bootstrap5"
CRISPY_ALLOWED_TEMPLATE_PACKS = "bulma"
CRISPY_TEMPLATE_PACK = "bootstrap5"
CRISPY_TEMPLATE_PACK = "bulma"
MIDDLEWARE = [
"django.middleware.security.SecurityMiddleware",

View file

@ -1,86 +1,78 @@
<!doctype html>
<html lang="en">
<head>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.8/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-sRIl4kxILFvY47J16cr9ZwB07vP4J8+LH7qKQnuqkuIAvNWLzeN8tE5YBujZqJLB" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma@1.0.4/css/bulma.min.css">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Community Backup</title>
</head>
<body style="display: flex; flex-direction: column; height: 100vh">
<header class="bg-body-tertiary">
<div class="container p-2">
<nav class="navbar navbar-expand-lg">
<div class="container-fluid">
<a class="navbar-brand" href="/" >Community Backup</a>
<div class="navbar-nav">
{% if request.user.is_authenticated %}
<a class="nav-link" href="{% url 'borg_list' %}">Borg Repositories</a>
<div class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">
{{ user.username }}
</a>
<ul class="dropdown-menu">
<li><form method=post action="{% url 'logout' %}?next={% url 'landing' %}">
{% csrf_token %}
<button type="submit" class="btn dropdown-item">Logout</button>
</form></li>
<li><a class="dropdown-item" href="{% url 'password_change' %}">Change Password</a></li>
{% if user.is_staff %}
<li><hr class="dropdown-divider"></li>
<li><a class="dropdown-item" href="{% url 'admin:index' %}">Admin</a></li>
{% endif %}
</ul>
</div>
{% else %}
<a class="btn nav-item" type="button" href="{% url 'login' %}?next={% url 'landing' %}">Login</a>
<a class="btn nav-item" type="button" href="{% url 'register' %}">Register</a>
{% endif %}
</div>
</nav>
<nav class="navbar" role="navigation" aria-label="main navigation" >
<div class="navbar-brand">
<a class="navbar-item" href="/">Community Backup</a>
</div>
</header>
<main class="container p-2" style="flex: 1 1 auto">
{% block content %}
{% endblock %}
</main>
<footer class="bg-body-tertiary">
<div class="container p-2">
<div class="row">
<div class="col-3">
<ul class="nav flex-column">
<li class="nav-item">
<a class="nav-link" href="{% url 'imprint' %}">Imprint</a>
</li>
</ul>
</div>
<div class="col-3">
<ul class="nav flex-column">
<li class="nav-item">
<a class="nav-link" href="https://git.srvspace.net/jo/community-backup">Source Code</a>
</li>
</ul>
</div>
<div class="col-3">
<ul class="nav flex-column">
<li class="nav-item">
<a class="nav-link disabled">Community Backup v{{ RELEASE_VERSION }}</a>
</li>
</ul>
</div>
{% if ADDITIONAL_FOOTER_NAV_ITEMS %}
<div class="col-3">
<ul class="nav flex-column">
{% for item in ADDITIONAL_FOOTER_NAV_ITEMS %}
<li class="nav-item">
{{item|safe}}
</li>
{% endfor %}
</ul>
</div>
<div class="navbar-menu">
<div class="navbar-start"></div>
<div class="navbar-end">
{% if request.user.is_authenticated %}
<a class="navbar-item" href="{% url 'borg_list' %}">Borg Repositories</a>
<div class="navbar-item has-dropdown is-hoverable">
<a class="navbar-link">
{{ user.username }}
</a>
<div class="navbar-dropdown is-right">
<form method=post action="{% url 'logout' %}?next={% url 'landing' %}">
{% csrf_token %}
<button type="submit" class="navbar-item">Logout</button>
</form>
<a class="navbar-item" href="{% url 'password_change' %}">Change Password</a>
{% if user.is_staff %}
<hr class="navbar-divider">
<a class="navbar-item" href="{% url 'admin:index' %}">Admin</a>
{% endif %}
</div>
</div>
{% else %}
<div class="navbar-item">
<div class="buttons">
<a class="button is-primary" type="button" href="{% url 'login' %}?next={% url 'landing' %}">Login</a>
<a class="button is-light" type="button" href="{% url 'register' %}">Register</a>
</div>
</div>
{% endif %}
</div>
</div>
</nav>
<main class="container">
{% block content %}
{% endblock %}
</main>
<footer class="footer">
<div class="columns">
<div class="column">
<a href="{% url 'imprint' %}">Imprint</a>
</div>
<div class="column">
<a href="https://git.srvspace.net/jo/community-backup">Source Code</a>
</div>
<div class="column">
Community Backup v{{ RELEASE_VERSION }}
</div>
{% if ADDITIONAL_FOOTER_NAV_ITEMS %}
<div class="column">
<ul>
{% for item in ADDITIONAL_FOOTER_NAV_ITEMS %}
<li>
{{item|safe}}
</li>
{% endfor %}
</ul>
</div>
{% endif %}
</div>
</footer>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.8/dist/js/bootstrap.bundle.min.js" integrity="sha384-FKyoEForCGlyvwx9Hj09JcYn3nv7wiPVlz7YYwJrWVcXK/BmnVDxM+D2scQbITxI" crossorigin="anonymous"></script>
</body>
</html>

View file

@ -4,7 +4,7 @@
<div class="d-flex">
<h1>Your Borg Repositories</h1>
<div class="p-2 ms-auto">
<a class="btn btn-primary" href="{% url 'borg_add' %}" role="button">Add Repository</a>
<a class="button is-primary" href="{% url 'borg_add' %}" role="button">Add Repository</a>
</div>
</div>
@ -13,7 +13,8 @@
<b>Always use encrypted backups!</b></p>
</row>
<table class="table table-striped table-hover">
<section>
<table class="table is-striped is-fullwidth is-hoverable">
<thead>
<th>Name</th>
<th>Key</th>
@ -28,29 +29,31 @@
<td style="word-break: break-all"><code>{{ repo.truncated_key }}</code></td>
<td style="word-break: break-all"><code>{{ repo.repo_url }}</code></td>
<td>{% if repo.used_quota < 0 %}not initialized{% else %}{{ repo.used_quota }}/{{ repo.quota }} GB{% endif %}</td>
<td><a href="{% url 'borg_update' pk=repo.pk %}" class="btn btn-warning btn-sm">Edit</a>
<a href="{% url 'borg_delete' pk=repo.pk %}" class="btn btn-danger btn-sm">Delete</a></td>
<td><a href="{% url 'borg_update' pk=repo.pk %}" class="button is-warning is-small">Edit</a>
<a href="{% url 'borg_delete' pk=repo.pk %}" class="button is-danger is-small">Delete</a></td>
</tr>
{% endfor %}
</tbody>
</table>
</section>
{% if BORG_SERVER_PUBKEYS %}
<section>
<div class="card">
<div class="card-header">
<h4>Borg Server Public Keys</h4>
</div>
<ul class="list-group list-group-flush">
<header class="card-header">
<p class="card-header-title">Borg Server Public Keys</p>
</header>
<div class="card-content">
{% for key, fingerprint in BORG_SERVER_PUBKEYS %}
<li class="list-group-item">
<span style="word-break: break-all"><code>{{ key }}</code></span><br>
<span style="word-break: break-all"><code>{{ fingerprint }}</code></span>
</li>
{% if not forloop.last %}
<hr>
{% endif %}
{% endfor %}
</ul>
</div>
</div>
</section>
{% endif %}
{% endblock %}

View file

@ -1,7 +1,7 @@
{% extends "base.html" %}
{% block content %}
<row class="text-center p-2">
<row class="p-2">
<h1>Welcome to Community Backup!</h1>
</row>

View file

@ -1 +0,0 @@
Hello at the login template

View file

@ -9,20 +9,10 @@
{% endfor %}
{% endif %}
{% if next %}
{% if user.is_authenticated %}
<p>Your account doesn't have access to this page. To proceed,
please login with an account that has access.</p>
{% else %}
<p>Please login to see this page.</p>
{% endif %}
{% endif %}
<form method="post" action="{% url 'register' %}">
{% csrf_token %}
{{ form|crispy }}
<input class="btn btn-primary" type="submit" value="Register">
<input type="hidden" name="next" value="{{ next }}">
<input class="button is-primary" type="submit" value="Register">
</form>
{% endblock %}

View file

@ -19,7 +19,7 @@
<form method="post" action="{% url 'login' %}">
{% csrf_token %}
{{ form|crispy }}
<input class="btn btn-primary" type="submit" value="login">
<input class="button is-primary" type="submit" value="Login">
<input type="hidden" name="next" value="{{ next }}">
</form>

View file

@ -5,7 +5,7 @@
<form method="post">{% csrf_token %}
<p>Are you sure you want to delete "{{ object.name }}"?</p>
{{ form }}
<input class="btn btn-danger" type="submit" value="Confirm">
<input class="button is-danger" type="submit" value="Confirm">
</form>
{% endblock %}

View file

@ -6,9 +6,9 @@
{% csrf_token %}
{{ form|crispy }}
{% if form.initial %}
<input class="btn btn-primary" type="submit" value="Save">
<input class="button is-primary" type="submit" value="Save">
{% else %}
<input class="btn btn-primary" type="submit" value="Add">
<input class="button is-primary" type="submit" value="Add">
{% endif %}
</form>
{% endblock %}