Feat: Add ability to edit events for logged in users
This commit is contained in:
@@ -3,35 +3,35 @@
|
||||
{% block content %}
|
||||
<div class="row justify-content-center mt-4">
|
||||
<div class="col-md-8">
|
||||
<h2>Neues Event erstellen</h2>
|
||||
<form method="post" action="/event/add">
|
||||
{% if edit_mode %}<h2>Event bearbeiten</h2>{% else %}<h2>Neues Event erstellen</h2>{% endif %}
|
||||
{% if edit_mode %}<form method="post" action="/event/{{ event.id }}/edit">{% else %}<form method="post" action="/event/add">{% endif %}
|
||||
<div class="mb-3">
|
||||
<label for="eventName" class="form-label">Event Name</label>
|
||||
<input type="text" class="form-control" id="eventName" name="eventName" required>
|
||||
<input type="text" class="form-control" id="eventName" name="eventName" required {% if edit_mode %}value="{{ event.title }}"{% endif %}>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="eventTime" class="form-label">Datum und Uhrzeit</label>
|
||||
<input type="datetime-local" class="form-control" id="eventTime" name="eventTime" required>
|
||||
<input type="datetime-local" class="form-control" id="eventTime" name="eventTime" required {% if edit_mode %}value="{{ event.event_time }}"{% endif %}>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="registrationDeadline" class="form-label">Anmeldungs-Deadline</label>
|
||||
<input type="datetime-local" class="form-control" id="registrationDeadline" name="registrationDeadline">
|
||||
<input type="datetime-local" class="form-control" id="registrationDeadline" name="registrationDeadline" {% if edit_mode %}value="{{ event.registration_deadline }}"{% endif %}>
|
||||
<small class="form-text text-muted">Leer lassen für Sonntag Abend vor dem Event</small>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="recipeLink" class="form-label">Rezept-Link</label>
|
||||
<input type="text" class="form-control" id="recipeLink" name="recipeLink">
|
||||
<input type="text" class="form-control" id="recipeLink" name="recipeLink" {% if edit_mode %}value="{{ event.recipe_link }}"{% endif %}>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="eventDescription" class="form-label">Beschreibung</label>
|
||||
<textarea class="form-control" id="eventDescription" name="eventDescription" rows="3"></textarea>
|
||||
<textarea class="form-control" id="eventDescription" name="eventDescription" rows="3" {% if edit_mode %}value="{{ event.description }}"{% endif %}></textarea>
|
||||
</div>
|
||||
|
||||
<button type="submit" class="btn btn-primary">Event erstellen</button>
|
||||
<button type="submit" class="btn btn-primary">Event {% if edit_mode %}bearbeiten{% else %}erstellen{% endif %}</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
{% import "macros.j2" as macros %}
|
||||
{% macro teamEntries(event, work_type) -%}
|
||||
{% for entry in event.team | selectattr("work_type", "equalto", work_type)%}
|
||||
<div class="d-inline-flex align-items-center bg-light border rounded-pill px-3 py-1 m-1">
|
||||
@@ -34,9 +35,24 @@
|
||||
<i class="bi bi-book"></i> Original Rezept ansehen
|
||||
</a>
|
||||
{% endif %}
|
||||
<a href="/event/{{event.id}}/pdf" class="btn btn-secondary mb-2 w-100" target="_blank">
|
||||
<i class="bi bi-printer m-2"></i> Druckansicht
|
||||
</a>
|
||||
<div class="row w-100">
|
||||
<div class="col-6 p-1">
|
||||
<a href="/event/{{event.id}}/pdf" class="btn btn-secondary w-100" target="_blank">
|
||||
<i class="bi bi-printer m-2"></i> Druckansicht
|
||||
</a>
|
||||
</div>
|
||||
<div class="col-6 p-1">
|
||||
{% if user -%}
|
||||
<a href="/event/{{event.id}}/edit" class="btn btn-secondary w-100" target="_blank">
|
||||
<i class="bi bi-pen m-2"></i> Event bearbeiten
|
||||
</a>
|
||||
{% else -%}
|
||||
<button type="button" class="btn btn-secondary w-100" data-bs-toggle="modal" data-bs-target="#loginInfo">
|
||||
<i class="bi bi-pen m-2"></i> Event bearbeiten
|
||||
</button>
|
||||
{% endif -%}
|
||||
</div>
|
||||
</div>
|
||||
{% if user and user.admin %}
|
||||
<button type="button" class="btn btn-danger mb-2 w-100" data-bs-toggle="modal" data-bs-target="#deleteEvent">
|
||||
Event Löschen
|
||||
@@ -286,4 +302,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{ macros.login_info_modal() }}
|
||||
|
||||
{% endblock %}
|
||||
@@ -1,4 +1,5 @@
|
||||
{% extends "base.html" %}
|
||||
{% import "macros.j2" as macros %}
|
||||
{% block content %}
|
||||
<div class="row mt-4 mb-3">
|
||||
<div class="col d-flex justify-content-between align-items-center">
|
||||
@@ -8,7 +9,7 @@
|
||||
<i class="bi bi-plus-circle"></i> Neues Event erstellen
|
||||
</a>
|
||||
{% else %}
|
||||
<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#exampleModal">
|
||||
<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#loginInfo">
|
||||
<i class="bi bi-plus-circle"></i> Neues Event erstellen
|
||||
</button>
|
||||
{% endif %}
|
||||
@@ -48,22 +49,5 @@
|
||||
</div>
|
||||
|
||||
<!-- Modal -->
|
||||
<div class="modal fade" id="exampleModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h1 class="modal-title fs-5" id="exampleModalLabel">Bitte einloggen</h1>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
Einige Funktionen, wie das erstellen neuer Koch-Events, stehen nur zur Verfügung, wenn du in die Allmende-Cloud
|
||||
eingeloggt bist. Gehe dazu auf <a href="https://cloud.allmende-gufi.de">cloud.allmende-gufi.de</a> und logge dich ein.
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Verstanden</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{ macros.login_info_modal() }}
|
||||
{% endblock %}
|
||||
|
||||
|
||||
19
src/meal_manager/templates/macros.j2
Normal file
19
src/meal_manager/templates/macros.j2
Normal file
@@ -0,0 +1,19 @@
|
||||
{% macro login_info_modal() -%}
|
||||
<div class="modal fade" id="loginInfo" tabindex="-1" aria-labelledby="loginInfoLabel" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h1 class="modal-title fs-5" id="loginInfoLabel">Bitte einloggen</h1>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
Einige Funktionen, wie das Erstellen und Bearbeiten von Koch-Events, stehen nur zur Verfügung, wenn du in die Allmende-Cloud
|
||||
eingeloggt bist. Gehe dazu auf <a href="https://cloud.allmende-gufi.de">cloud.allmende-gufi.de</a> und logge dich ein.
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Verstanden</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{%- endmacro %}
|
||||
Reference in New Issue
Block a user