restored some deleted stuff

This commit is contained in:
vabene1111
2025-07-03 16:29:54 +02:00
parent a5dde3d3c8
commit 7266ff8978
47 changed files with 31381 additions and 49 deletions

View File

@@ -123,46 +123,14 @@
{% endblock script %}
<script type="application/javascript">
localStorage.setItem('SCRIPT_NAME', "{% base_path request 'script' %}")
localStorage.setItem('BASE_PATH', "{% base_path request 'base' %}")
localStorage.setItem('STATIC_URL', "{% base_path request 'static_base' %}")
localStorage.setItem('DEBUG', "{% is_debug %}")
localStorage.setItem('USER_ID', "{{request.user.pk}}")
window.addEventListener("load", () => {
if ("serviceWorker" in navigator) {
navigator.serviceWorker.register("{% url 'service_worker' %}", {scope: "{% base_path request 'base' %}" + '/'}).then(function (reg) {
}).catch(function (err) {
console.warn('Error whilst registering service worker', err);
});
} else {
console.warn('service worker not in navigator');
}
});
</script>
<style>
@media screen and (max-width: 1000px) {
.navbar-collapse {
max-height: 60vh;
overflow-y: auto;
overflow-x: hidden;
}
.collapsing {
overflow-y: hidden;
overflow-x: hidden;
}
}
#id_base_container {
padding-bottom: env(safe-area-inset-bottom);
}
.fixed-bottom {
padding-bottom: max(0.5rem, calc(env(safe-area-inset-bottom) - 0.5rem)) !important;
}
</style>
</body>

View File

@@ -0,0 +1,27 @@
{% extends "base.html" %}
{% load crispy_forms_filters %}
{% load static %}
{% load i18n %}
{% block title %}{% trans "Cookbook Setup" %}{% endblock %}
{% block extra_head %}
{{ form.media }}
{% endblock %}
{% block content %}
<h1>{% trans 'Setup' %}</h1>
<p>{% blocktrans %}To start using this application you must first create a superuser account.{% endblocktrans %}</p>
<form action="." method="post">
{% csrf_token %}
{{ form|crispy }}
<button class="btn btn-success" type="submit"><i class="fas fa-save"></i> {% trans 'Create Superuser account' %}</button>
</form>
<script>
$('#id_name').focus()
</script>
{% endblock %}

View File

@@ -0,0 +1,119 @@
{% extends "base.html" %}
{% load crispy_forms_filters %}
{% load static %}
{% load i18n %}
{% block title %}{% trans "Overview" %}{% endblock %}
{% block content %}
<div style="text-align: center">
<h3 class="">{% trans 'Space' %}</h3>
<div class="row">
<div class="col col-md-12">
{% trans 'Recipes, foods, shopping lists and more are organized in spaces of one or more people.' %}
{% trans 'You can either be invited into an existing space or create your own one.' %}
</div>
</div>
{% if request.user.userspace_set.all|length > 0 %}
<div class="row mt-2">
<div class="col col-12">
<h5>{% trans 'Your Spaces' %}</h5>
</div>
</div>
<div class="row mt-2">
<div class="col col-12">
<div class="card-deck">
{% for us in request.user.userspace_set.all %}
<div class="card">
{% if us.space.image and us.space.image.is_image %}
<img style="height: 15vh; object-fit: cover" src="{{ us.space.image.file.url }}"
class="card-img-top" alt="Image">
{% else %}
<img style="height: 15vh; object-fit: cover" src="{% static 'assets/recipe_no_image.svg' %}"
class="card-img-top" alt="Image">
{% endif %}
<div class="card-body">
<h5 class="card-title"><a
href="{% url 'view_switch_space' us.space.id %}">{{ us.space.name }}</a>
</h5>
{# {% if us.active %}#}
{# <i class="far fa-dot-circle fa-fw"></i>#}
{# {% else %}#}
{# <i class="far fa-circle fa-fw"></i>#}
{# {% endif %}#}
<p class="card-text"><small
class="text-muted">{% trans 'Owner' %}: {{ us.space.created_by }}</small>
{% if us.space.created_by != us.user %}
<p class="card-text"><small
class="text-muted"><a
href="{% url 'delete_user_space' us.pk %}">{% trans 'Leave Space' %}</a></small>
{% endif %}
<!--TODO add direct link to management page -->
</p>
</div>
</div>
{% endfor %}
</div>
</div>
</div>
{% endif %}
<div class="row" style="margin-top: 2vh">
<div class="col col-md-12">
<div class="card-group">
<div class="card">
<div class="card-header">
{% trans 'Join Space' %}
</div>
<div class="card-body">
<h5 class="card-title">{% trans 'Join an existing space.' %}</h5>
<p class="card-text"
style="height: 64px">{% trans 'To join an existing space either enter your invite token or click on the invite link the space owner send you.' %}</p>
<form method="POST" action="{% url 'view_space_overview' %}">
{% csrf_token %}
{{ join_form | crispy }}
<input type="submit" class="btn btn-primary" value="{% trans 'Join Space' %}"/>
</form>
</div>
</div>
<div class="card">
<div class="card-header">
{% trans 'Create Space' %}
</div>
<div class="card-body">
<h5 class="card-title">{% trans 'Create your own recipe space.' %}</h5>
<p class="card-text"
style="height: 64px">{% trans 'Start your own recipe space and invite other users to it.' %}</p>
<form method="POST" action="{% url 'view_space_overview' %}">
{% csrf_token %}
{{ create_form | crispy }}
<input type="submit" class="btn btn-primary" value="{% trans 'Create Space' %}"/>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
{% endblock %}