update show to DetailViews, add UpdateViews and CreateView

This commit is contained in:
2023-01-02 17:38:43 +00:00
parent 7ab97c91b7
commit 3793aa914c
17 changed files with 893 additions and 393 deletions

View File

@@ -2,7 +2,7 @@ from ckeditor_uploader.widgets import CKEditorUploadingWidget
from taggit.models import Tag
from django import forms
from django.forms.widgets import CheckboxInput
from django.forms.widgets import CheckboxInput, DateTimeInput
from django.utils import timezone
from django.utils.dates import MONTHS
@@ -167,3 +167,89 @@ class PostSearchForm(forms.Form):
self.fields["year"].choices = year_choices
except:
pass
class NewsUpdateForm(forms.ModelForm):
class Meta:
model = News
fields = [
"title",
"status",
"body",
]
labels = {
"title": "Titel",
"image": "Hintergrundbild",
"body": "Text",
}
widgets = {"body": CKEditorUploadingWidget(config_name="default")}
class EventUpdateForm(forms.ModelForm):
class Meta:
model = Event
fields = [
"title",
"status",
"event_start",
"event_end",
"event_place",
]
labels = {
"title": "Titel",
"event_start": "Start des Events",
"event_end": "Ende des Events",
"event_place": "Ort des Events",
}
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs) # to get the self.fields set
self.fields["event_start"].required = True
self.fields["event_end"].required = False
if "event_place" in self.fields:
self.fields["event_place"].required = True
class FetMeetingCreateForm(forms.ModelForm):
class Meta:
model = FetMeeting
fields = ["event_start", "event_end", "event_place"]
labels = {
"event_start": "Start der Sitzung",
"event_end": "Ende der Sitzung",
"event_place": "Ort der Sitzung",
}
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs) # to get the self.fields set
self.fields["event_start"].required = True
self.fields["event_end"].required = False
self.fields["event_place"].initial = "FET"
class FetMeetingUpdateForm(forms.ModelForm):
class Meta:
model = FetMeeting
fields = ["event_start", "event_end", "event_place"]
labels = {
"event_start": "Start der Sitzung",
"event_end": "Ende der Sitzung",
"event_place": "Ort der Sitzung",
}
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs) # to get the self.fields set
self.fields["event_start"].required = True
self.fields["event_end"].required = False
self.fields["event_place"].initial = "FET"

View File

@@ -138,7 +138,7 @@ class Post(models.Model):
)
def get_absolute_url(self):
return reverse("posts:show", kwargs={"id": self.slug})
return reverse("posts:post-detail", kwargs={"slug": self.slug})
def save(self, *args, **kwargs):
# save the post with some defaults
@@ -150,13 +150,6 @@ class Post(models.Model):
super().save(*args, **kwargs)
self.tags.set(
[
*re.findall(r"\#([\d\w-]+)", str(self.subtitle)),
*re.findall(r"\#([\d\w-]+)", str(self.title)),
]
)
@property
def agenda_html(self):
"Agenda HTML from Etherpad Pad"

View File

@@ -10,7 +10,13 @@ urlpatterns = [
path("", views.index, name="index"),
# fet calendar (path have to be ahead show)
path("fet_calendar.ics", views.calendar, name="calendar"),
path("<str:id>", views.show, name="show"),
path(
"fetmeeting-create/",
views.FetMeetingCreateView.as_view(),
name="fetmeeting-create",
),
path("<slug:slug>/", views.PostDetailView.as_view(), name="post-detail"),
path("<slug:slug>/update/", views.PostUpdateView.as_view(), name="post-update"),
re_path(
r"^(?P<id>[-\w]+)/agenda.pdf$",
views.show_pdf_agenda,

View File

@@ -1,16 +1,26 @@
import logging
from django.conf import settings
from django.contrib.auth.mixins import LoginRequiredMixin
from django.http import HttpResponse, Http404
from django.shortcuts import render
from django.template.loader import render_to_string
from django.utils import timezone
from django.views.generic.edit import CreateView, UpdateView
from django.views.generic.detail import DetailView
from authentications.decorators import authenticated_user
from documents.etherpadlib import add_ep_cookie
from fet2020.utils import add_log_action
from members.models import Member
from .forms import PostSearchForm
from .models import Event, FileUpload, Post
from .forms import (
EventUpdateForm,
FetMeetingCreateForm,
FetMeetingUpdateForm,
NewsUpdateForm,
PostSearchForm,
)
from .models import Event, FetMeeting, FileUpload, Post
from .utils import render_to_pdf
@@ -88,56 +98,14 @@ def tags(request, tag=""):
return render(request, "posts/tag.html", context)
def __get_post_object(id=None, public=True):
post = None
class PostDetailView(DetailView):
model = Post
try:
if id.isdigit() or id is int:
post = Post.objects.published(public).get(id=int(id))
elif id != "" and id is not None:
post = Post.objects.published(public).get(slug=id)
except Exception:
logger.info("Wrong id '{}'".format(id))
raise Http404("wrong post id")
return post
def show(request, id=None):
public_only = not request.user.is_authenticated
post = __get_post_object(id, public_only)
# files
files = FileUpload.objects.filter(post=post)
# author
author = None
author_image = None
post_author = Member.all_members.filter(username=post.author).first()
if post_author:
author = post_author
author_image = post_author.image["avatar"].url
related_posts = post.tags.similar_objects()
# list of non 'is_hidden' posts for related_posts
for obj in related_posts:
if not obj.published:
related_posts.remove(obj)
context = {
"post": post,
"files": files,
"author": author,
"author_image": author_image,
"next": __next(post, public_only),
"previous": __previous(post, public_only),
"related_posts": related_posts[:4],
}
response = render(request, "posts/show.html", context)
def get(self, request, *args, **kwargs):
response = super().get(request, *args, **kwargs)
# check if etherpad server works
if post.agenda_link or post.protocol_link:
if self.object.agenda_link or self.object.protocol_link:
try:
response = add_ep_cookie(request, response)
except Exception as e:
@@ -145,6 +113,183 @@ def show(request, id=None):
return response
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
# files
files = FileUpload.objects.filter(post=self.object)
# author
author = None
author_image = None
post_author = Member.all_members.filter(username=self.object.author).first()
if post_author:
author = post_author
author_image = post_author.image["avatar"].url
related_posts = self.object.tags.similar_objects()
# list of non 'is_hidden' posts for related_posts
for obj in related_posts:
if not obj.published:
related_posts.remove(obj)
context = {
"post": self.object,
"files": files,
"author": author,
"author_image": author_image,
"next": self.post_next(),
"previous": self.post_previous(),
"related_posts": related_posts[:4],
}
return context
def get_queryset(self):
self.public_only = not self.request.user.is_authenticated
return Post.objects.published(self.public_only)
def get_template_names(self):
template_name = "posts/news/detail.html"
if self.object.post_type == "E":
template_name = "posts/event/detail.html"
elif self.object.post_type == "F":
template_name = "posts/fetmeeting/detail.html"
return template_name
def post_next(self):
"""
Helper function for getting next post
"""
posts = Post.objects.date_sorted_list(self.public_only).filter(
post_type=self.object.post_type
)
qs = posts.filter(date__lt=self.object.date)
if not qs:
qs = posts[:1]
return qs.first().slug
def post_previous(self):
"""
Helper function for getting previous post
"""
posts = (
Post.objects.date_sorted_list(self.public_only)
.filter(post_type=self.object.post_type)
.reverse()
)
qs = posts.filter(date__gt=self.object.date)
if not qs:
qs = posts[:1]
return qs.first().slug
class PostUpdateView(LoginRequiredMixin, UpdateView):
model = Post
def form_valid(self, form):
model = "news"
if self.object.post_type == "E":
model = "event"
elif self.object.post_type == "F":
model = "fetmeeting"
add_log_action(self.request, form, "posts", model, False)
return super().form_valid(form)
def get_form_class(self):
form_class = NewsUpdateForm
if self.object.post_type == "E":
form_class = EventUpdateForm
elif self.object.post_type == "F":
form_class = FetMeetingUpdateForm
return form_class
def get_form_kwargs(self):
kwargs = super().get_form_kwargs()
try:
q = kwargs["data"]
_mutable = q._mutable
q._mutable = True
event_start_0 = q.pop("event_start_0")[0]
event_start_1 = q.pop("event_start_1")[0]
q.update({"event_start": f"{event_start_0} {event_start_1}"})
event_end_0 = q.pop("event_end_0")[0]
event_end_1 = q.pop("event_end_1")[0]
q.update({"event_end": f"{event_end_0} {event_end_1}"})
q._mutable = _mutable
except Exception as e:
pass
return kwargs
def get_template_names(self):
template_name = "posts/news/update.html"
if self.object.post_type == "E":
template_name = "posts/event/update.html"
elif self.object.post_type == "F":
template_name = "posts/fetmeeting/update.html"
return template_name
class FetMeetingCreateView(LoginRequiredMixin, CreateView):
model = FetMeeting
template_name = "posts/fetmeeting/create.html"
form_class = FetMeetingCreateForm
def form_valid(self, form):
form.instance.author = self.request.user
add_log_action(self.request, form, "posts", "fetmeeting", True)
return super().form_valid(form)
def get_form_kwargs(self):
kwargs = super().get_form_kwargs()
try:
q = kwargs["data"]
_mutable = q._mutable
q._mutable = True
event_start_0 = q.pop("event_start_0")[0]
event_start_1 = q.pop("event_start_1")[0]
q.update({"event_start": f"{event_start_0} {event_start_1}"})
event_end_0 = q.pop("event_end_0")[0]
event_end_1 = q.pop("event_end_1")[0]
q.update({"event_end": f"{event_end_0} {event_end_1}"})
q._mutable = _mutable
except Exception as e:
pass
return kwargs
def show_pdf_agenda(request, id):
post = Post.objects.published(True).get(slug=id)
html = post.agenda_html
return show_pdf(request, html, post.slug + "-agenda")
@authenticated_user
def show_pdf_protocol(request, id):
post = Post.objects.published(True).get(slug=id)
html = post.protocol_html
return show_pdf(request, html, post.slug + "-protokoll")
def show_pdf(request, html, filename):
rendered = render_to_string(
@@ -170,62 +315,3 @@ def show_pdf(request, html, filename):
response["Content-Disposition"] = content
return response
def show_pdf_agenda(request, id):
post = __get_post_object(id)
html = post.agenda_html
return show_pdf(request, html, post.slug + "-agenda")
@authenticated_user
def show_pdf_protocol(request, id):
post = __get_post_object(id)
html = post.protocol_html
return show_pdf(request, html, post.slug + "-protokoll")
def __next(post=None, public=True):
"""
Helper function for getting next post
"""
posts = None
d = post.slug
if post:
posts = Post.objects.date_sorted_list(public).filter(post_type=post.post_type)
if posts:
for k, v in enumerate(posts):
if post.slug == v.slug:
if (k + 1) < len(posts):
d = posts[k + 1].slug
else:
d = posts[0].slug
break
return d
def __previous(post=None, public=True):
"""
Helper function for getting previous post
"""
posts = None
d = post.slug
if post:
posts = Post.objects.date_sorted_list(public).filter(post_type=post.post_type)
if posts:
for k, v in enumerate(posts):
if post.slug == v.slug:
if k < 1:
d = posts[len(posts) - 1].slug
else:
d = posts[k - 1].slug
break
return d

View File

@@ -0,0 +1,10 @@
<label class="block">
<span class="text-gray-700 dark:text-gray-200">{{ field.label }}</span>
{% if field.errors %}
<div class="alert alert-danger">
<div class="alert-body">{{ field.errors }}</div>
</div>
{% endif %}
{{ media }}
{{ field }}
</label>

View File

@@ -0,0 +1,13 @@
<label>
<span class="text-gray-700 dark:text-gray-200">{{ field.label }}</span>
{% if field.errors %}
<div class="alert alert-danger">
<div class="alert-body">{{ field.errors }}</div>
</div>
{% endif %}
<input type="date" id="id_{{ field.name }}_0" name="{{ field.name }}_0" value="{{ field.value|date:"Y-m-d" }}" {% if field.required %}required{% endif %} class="block w-full mt-1 rounded-md border-gray-300 dark:border-none shadow-sm focus:border-none focus:ring focus:ring-blue-200 dark:focus:ring-sky-700 focus:ring-opacity-50">
<input type="time" id="id_{{ field.name }}_1" name="{{ field.name }}_1" value="{{ field.value|time }}" {% if field.required %}required{% endif %} class="block w-full mt-1 rounded-md border-gray-300 dark:border-none shadow-sm focus:border-none focus:ring focus:ring-blue-200 dark:focus:ring-sky-700 focus:ring-opacity-50">
{% if field.help_text %}
<span class="text-gray-700 dark:text-gray-200">{{ field.help_text }}</span>
{% endif %}
</label>

View File

@@ -0,0 +1,7 @@
{% if form.non_field_errors %}
<div class="alert alert-danger">
<i class="alert-icon fa-solid fa-check-circle"></i>
<h2 class="alert-title">Fehler:</h2>
<div class="alert-body">{{ form.non_field_errors }}</div>
</div>
{% endif %}

View File

@@ -0,0 +1,13 @@
<label>
<span class="text-gray-700 dark:text-gray-200">{{ field.label }}</span>
{% if field.errors %}
<div class="alert alert-danger">
<div class="alert-body">{{ field.errors }}</div>
</div>
{% endif %}
<select id="id_{{ field.name }}" name="{{ field.name }}" {% if field.required %}required{% endif %} class="block w-full mt-1 rounded-md border-gray-300 dark:border-none shadow-sm focus:border-none focus:ring focus:ring-blue-200 dark:focus:ring-sky-700 focus:ring-opacity-50">
{% for elem in field %}
{{ elem }}
{% endfor %}
</select>
</label>

View File

@@ -0,0 +1,12 @@
<label class="block">
<span class="text-gray-700 dark:text-gray-200">{{ field.label }}</span>
{% if field.errors %}
<div class="alert alert-danger">
<div class="alert-body">{{ field.errors }}</div>
</div>
{% endif %}
<input type="text" id="id_{{ field.name }}" name="{{ field.name }}" value="{{ field.value }}" {% if field.required %}required{% endif %} class="mt-1 block w-full rounded-md border-gray-300 dark:border-none shadow-sm focus:border-none focus:ring focus:ring-blue-200 dark:focus:ring-sky-700 focus:ring-opacity-50">
{% if field.help_text %}
<span class="text-gray-700 dark:text-gray-200">{{ field.help_text }}</span>
{% endif %}
</label>

View File

@@ -0,0 +1,107 @@
{% extends 'posts/show.html' %}
{% load post_helpers %}
{% block title %}{{ post.title }}{% endblock %}
{% block prev_text_big %}Vorheriges<br>Event{% endblock %}
{% block next_text_big %}Nächstes<br>Event{% endblock %}
{% block prev_text %}Vorheriges Event{% endblock %}
{% block next_text %}Nächstes Event{% endblock %}
{% block update_button_desktop %}
{% if request.user.is_authenticated %}
<a href="{% url 'posts:post-update' post.slug %}" class="hidden sm:block btn-small btn-primary">
<i class="fa-solid fa-pen-to-square mr-1"></i>Event bearbeiten
</a>
{% endif %}
{% endblock %}
{% block event_details_desktop %}
<div class="hidden lg:block absolute top-0 right-0 bg-white dark:bg-gray-900 rounded-bl p-2 bg-opacity-80 dark:bg-opacity-70 gap-2">
<div class="items-center lg:flex gap-2">
<i class="flex-none fa-solid fa-calendar-day fa-fw text-gray-800 dark:text-gray-200"></i>
<span class="flex-1 text-sm text-gray-800 dark:text-gray-200">
Event-Start: {{ post.event_start|date }} um {{ post.event_start|time }} Uhr<br>
Event-Ende: {{ post.event_end|date }} um {{ post.event_end|time }} Uhr
</span>
</div>
{% if post.event_place %}
<div class="items-center lg:flex gap-2">
<i class="flex-none fa-solid fa-location-dot fa-fw text-gray-800 dark:text-gray-200"></i>
<span class="flex-1 text-sm text-gray-800 dark:text-gray-200">
Event-Ort: {{ post.event_place }}
</span>
</div>
{% endif %}
</div>
<div class="hidden absolute top-0 right-0 bg-white dark:bg-gray-900 rounded-bl p-2 bg-opacity-80 dark:bg-opacity-70 items-center gap-2">
<i class="flex-none fa-solid fa-calendar-day text-gray-800 dark:text-gray-200"></i>
<span class="flex-1 text-sm text-gray-800 dark:text-gray-200">
Event-Start: {{ post.event_start|date }} um {{ post.event_start|time }} Uhr<br>
Event-Ende: {{ post.event_end|date }} um {{ post.event_end|time }} Uhr<br>
{% if post.event_place %}
Event-Ort: {{ post.event_place }}
{% endif %}
</span>
</div>
{% endblock %}
{% block post_body %}
{% if post.body %}
{{ post.body|safe|tags_to_url }}
{% endif %}
{% endblock %}
{% block event_details_mobile %}
<hr class="lg:hidden -mx-4 border-gray-200 dark:border-gray-800 dark:border my-4">
<div class="lg:hidden">
<h2 class="text-gray-800 dark:text-gray-200 font-medium"><i class="fa-solid fa-calendar-days mr-2 text-gray-400 dark:text-gray-500"></i>Termindetails:</h2>
<ul class="text-base text-gray-700 dark:text-gray-300 my-1">
<li>Start: {{ post.event_start|date }} um {{ post.event_start|time }} Uhr</li>
<li>Ende: {{ post.event_end|date }} um {{ post.event_end|time }} Uhr</li>
{% if post.event_place %}
<li>Ort: {{ post.event_place }}</li>
{% endif %}
</ul>
</div>
{% endblock %}
{% block files_buttons %}
{% for file in files %}
<div class="w-full my-2 flex items-center gap-4 text-gray-700 dark:text-gray-300" x-data="options">
<span class="flex-1">{{ file.title }}</span>
<div class="relative">
<button class="sm:hidden px-2 py-1 border border-gray-300 dark:border-gray-700 rounded" @click="openShowOptions">
<i class="fa-solid fa-ellipsis-vertical fa-fw"></i>
</button>
<ul class="z-10 absolute top-0 right-0 sm:flex flex-row sm:static flex-none border dark:border-2 border-gray-300 dark:border-gray-700 rounded divide-y-2 sm:divide-y-0 sm:divide-x divide-gray-300 dark:divide-gray-700 bg-gray-100 dark:bg-gray-800 shadow sm:bg-transparent sm:shadow-none"
@click.outside="closeShowOptions"
x-show="getShowOptions"
x-transition:enter="transition ease-out duration-300"
x-transition:enter-start="transform origin-right opacity-0 scale-95"
x-transition:enter-end="transform origin-right opacity-100 scale-100"
x-transition:leave="transition ease-in duration-150"
x-transition:leave-start="transform origin-right opacity-100 scale-100"
x-transition:leave-end="transform origin-right opacity-0 scale-95"
>
<li class="block sm:inline-block group hover:bg-gray-200 dark:hover:bg-gray-800 hover:text-gray-800 dark:hover:text-gray-200">
<a href="{{ file.file_field.url }}" class="inline-flex items-center px-2 py-1" target="_blank">
<i class="fa-solid fa-file-pdf fa-fw text-red-800 dark:text-red-500 md:text-inherit group-hover:text-red-800 dark:group-hover:text-red-500"></i>
<span class="ml-2 sm:ml-1">Download</span>
</a>
</li>
</ul>
</div>
</div>
{% endfor %}
{% endblock %}
{% block update_button_mobile %}
{% if request.user.is_authenticated %}
<a href="{% url 'posts:post-update' post.slug %}" class="sm:hidden block w-full btn btn-primary mt-4">
<i class="fa-solid fa-pen-to-square mr-1"></i>Event bearbeiten
</a>
{% endif %}
{% endblock %}

View File

@@ -0,0 +1,30 @@
{% extends 'base.html' %}
{% load static %}
{% block title %}{{ object.title }} bearbeiten{% endblock %}
{% block content %}
<!-- Main Content -->
<main class="container mx-auto w-full px-4 my-8 flex-1">
<h1 class="page-title">{{ object.title }} von {{ object.date }} bearbeiten</h1>
<div class="w-full h-full flex-1 flex justify-center items-center">
<form action="" method="POST" class="w-full max-w-prose sm:px-28 sm:py-4 grid grid-cols-1 gap-y-3 sm:gap-y-6 text-gray-900">
{% csrf_token %}
{% include "baseform/non_field_errors.html" %}
{% include "baseform/text.html" with field=form.title %}
{% include "baseform/select.html" with field=form.status %}
{% include "baseform/date_time.html" with field=form.event_start %}
{% include "baseform/date_time.html" with field=form.event_end %}
{% include "baseform/text.html" with field=form.event_place %}
<div class="flex flex-col-reverse sm:flex-row gap-3 justify-end pt-4 sm:pt-0">
<a href="{% url 'admin:posts_event_change' object.id %}" class="block btn btn-secondary-proprietary">Event im Admin bearbeiten</a>
<input type="submit" class="block btn btn-primary" value="Bearbeiten">
</div>
</form>
</div>
</main>
{% endblock %}

View File

@@ -0,0 +1,27 @@
{% extends 'base.html' %}
{% load static %}
{% block title %}Fachschaftssitzung erstellen{% endblock %}
{% block content %}
<!-- Main Content -->
<main class="container mx-auto w-full px-4 my-8 flex-1">
<h1 class="page-title">Fachschaftssitzung erstellen</h1>
<div class="w-full h-full flex-1 flex justify-center items-center">
<form action="" method="POST" class="w-full max-w-prose sm:px-28 sm:py-4 grid grid-cols-1 gap-y-3 sm:gap-y-6 text-gray-900">
{% csrf_token %}
{% include "baseform/non_field_errors.html" %}
{% include "baseform/date_time.html" with field=form.event_start %}
{% include "baseform/date_time.html" with field=form.event_end %}
{% include "baseform/text.html" with field=form.event_place %}
<div class="flex flex-col-reverse sm:flex-row gap-3 justify-end pt-4 sm:pt-0">
<input type="submit" class="block btn btn-primary" value="Hinzufügen">
</div>
</form>
</div>
</main>
{% endblock %}

View File

@@ -0,0 +1,222 @@
{% extends 'posts/show.html' %}
{% load flatpages %}
{% block title %}{{ post.title }} vom {{ post.event_start|date }}{% endblock %}
{% block prev_text_big %}Vorherige<br>Sitzung{% endblock %}
{% block next_text_big %}Nächste<br>Sitzung{% endblock %}
{% block prev_text %}Vorherige Sitzung{% endblock %}
{% block next_text %}Nächste Sitzung{% endblock %}
{% block update_button_desktop %}
{% if request.user.is_authenticated %}
<a href="{% url 'posts:post-update' post.slug %}" class="hidden sm:block btn-small btn-primary">
<i class="fa-solid fa-pen-to-square mr-1"></i>FET Sitzung bearbeiten
</a>
{% endif %}
{% endblock %}
{% block event_details_desktop %}
<div class="hidden lg:block absolute top-0 right-0 bg-white dark:bg-gray-900 rounded-bl p-2 bg-opacity-80 dark:bg-opacity-70 gap-2">
<div class="items-center lg:flex gap-2">
<i class="flex-none fa-solid fa-calendar-day fa-fw text-gray-800 dark:text-gray-200"></i>
<span class="flex-1 text-sm text-gray-800 dark:text-gray-200">
Event-Start: {{ post.event_start|date }} um {{ post.event_start|time }} Uhr<br>
Event-Ende: {{ post.event_end|date }} um {{ post.event_end|time }} Uhr
</span>
</div>
{% if post.event_place %}
<div class="items-center lg:flex gap-2">
<i class="flex-none fa-solid fa-location-dot fa-fw text-gray-800 dark:text-gray-200"></i>
<span class="flex-1 text-sm text-gray-800 dark:text-gray-200">
Event-Ort: {{ post.event_place }}
</span>
</div>
{% endif %}
</div>
<div class="hidden absolute top-0 right-0 bg-white dark:bg-gray-900 rounded-bl p-2 bg-opacity-80 dark:bg-opacity-70 items-center gap-2">
<i class="flex-none fa-solid fa-calendar-day text-gray-800 dark:text-gray-200"></i>
<span class="flex-1 text-sm text-gray-800 dark:text-gray-200">
Event-Start: {{ post.event_start|date }} um {{ post.event_start|time }} Uhr<br>
Event-Ende: {{ post.event_end|date }} um {{ post.event_end|time }} Uhr<br>
{% if post.event_place %}
Event-Ort: {{ post.event_place }}
{% endif %}
</span>
</div>
{% endblock %}
{% block post_body %}
{% if post.has_agenda %}
<h2>Agenda</h2>
{{ post.agenda_html|safe }}
{% endif %}
{% if request.user.is_authenticated and post.has_protocol %}
<hr>
<h2>Protokoll</h2>
{{ post.protocol_html|safe }}
{% endif %}
{% endblock %}
{% block event_details_mobile %}
<hr class="lg:hidden -mx-4 border-gray-200 dark:border-gray-800 dark:border my-4">
<div class="lg:hidden">
<h2 class="text-gray-800 dark:text-gray-200 font-medium"><i class="fa-solid fa-calendar-days mr-2 text-gray-400 dark:text-gray-500"></i>Termindetails:</h2>
<ul class="text-base text-gray-700 dark:text-gray-300 my-1">
<li>Start: {{ post.event_start|date }} um {{ post.event_start|time }} Uhr</li>
<li>Ende: {{ post.event_end|date }} um {{ post.event_end|time }} Uhr</li>
{% if post.event_place %}
<li>Ort: {{ post.event_place }}</li>
{% endif %}
</ul>
</div>
{% endblock %}
{% block docu_buttons %}
{% if request.user.is_authenticated %}
{% if post.has_agenda or post.has_protocol %}
<hr class="-mx-4 border-gray-200 dark:border-gray-800 dark:border my-4">
<h2 class="text-gray-800 dark:text-gray-200 font-medium"><i class="fa-solid fa-inbox mr-2 text-gray-400 dark:text-gray-500"></i>Dokument(e):</h2>
{% endif %}
{% if post.has_agenda %}
<div class="w-full my-2 flex items-center gap-4 text-gray-700 dark:text-gray-300" x-data="options">
<span class="flex-1">Agenda</span>
<div class="relative">
<button class="sm:hidden px-2 py-1 border border-gray-300 dark:border-gray-700 rounded" @click="openShowOptions">
<i class="fa-solid fa-ellipsis-vertical fa-fw"></i>
</button>
<ul class="z-10 absolute top-0 right-0 sm:flex flex-row sm:static flex-none border dark:border-2 border-gray-300 dark:border-gray-700 rounded divide-y-2 sm:divide-y-0 sm:divide-x divide-gray-300 dark:divide-gray-700 bg-gray-100 dark:bg-gray-800 shadow sm:bg-transparent sm:shadow-none"
@click.outside="closeShowOptions"
x-show="getShowOptions"
x-transition:enter="transition ease-out duration-300"
x-transition:enter-start="transform origin-right opacity-0 scale-95"
x-transition:enter-end="transform origin-right opacity-100 scale-100"
x-transition:leave="transition ease-in duration-150"
x-transition:leave-start="transform origin-right opacity-100 scale-100"
x-transition:leave-end="transform origin-right opacity-0 scale-95"
>
<li class="block sm:inline-block group hover:bg-gray-100 dark:hover:bg-gray-800 hover:text-gray-800 dark:hover:text-gray-200">
<a href="{{ post.agenda_link }}" class="inline-flex items-center px-2 py-1">
<i class="fa-solid fa-file-signature fa-fw text-proprietary dark:text-proprietary-light md:text-inherit group-hover:text-proprietary dark:group-hover:text-proprietary-light"></i>
<span class="ml-2 sm:ml-1">Bearbeiten</span>
</a>
</li>
{% if post.filename_agenda %}
<li class="block sm:inline-block group hover:bg-gray-200 dark:hover:bg-gray-800 hover:text-gray-800 dark:hover:text-gray-200">
<a href="{% url 'posts:show_pdf_agenda' post.slug %}" class="inline-flex items-center px-2 py-1">
<i class="fa-solid fa-file-pdf fa-fw text-red-800 dark:text-red-500 md:text-inherit group-hover:text-red-800 dark:group-hover:text-red-500"></i>
<span class="ml-2 sm:ml-1">Download</span>
</a>
</li>
{% endif %}
</ul>
</div>
</div>
{% endif %}
{% if post.has_protocol %}
<div class="w-full my-2 flex items-center gap-4 text-gray-700 dark:text-gray-300" x-data="options">
<span class="flex-1">Protokoll</span>
<div class="relative">
<button class="sm:hidden px-2 py-1 border border-gray-300 dark:border-gray-700 rounded" @click="openShowOptions">
<i class="fa-solid fa-ellipsis-vertical fa-fw"></i>
</button>
<ul class="z-10 absolute top-0 right-0 sm:flex flex-row sm:static flex-none border dark:border-2 border-gray-300 dark:border-gray-700 rounded divide-y-2 sm:divide-y-0 sm:divide-x divide-gray-300 dark:divide-gray-700 bg-gray-100 dark:bg-gray-800 shadow sm:bg-transparent sm:shadow-none"
@click.outside="closeShowOptions"
x-show="getShowOptions"
x-transition:enter="transition ease-out duration-300"
x-transition:enter-start="transform origin-right opacity-0 scale-95"
x-transition:enter-end="transform origin-right opacity-100 scale-100"
x-transition:leave="transition ease-in duration-150"
x-transition:leave-start="transform origin-right opacity-100 scale-100"
x-transition:leave-end="transform origin-right opacity-0 scale-95"
>
<li class="block sm:inline-block group hover:bg-gray-100 dark:hover:bg-gray-800 hover:text-gray-800 dark:hover:text-gray-200">
<a href="{{ post.protocol_link }}" class="inline-flex items-center px-2 py-1"><i class="fa-solid fa-file-signature fa-fw text-proprietary dark:text-proprietary-light md:text-inherit group-hover:text-proprietary dark:group-hover:text-proprietary-light"></i>
<span class="ml-2 sm:ml-1">Bearbeiten</span>
</a>
</li>
{% if post.filename_protocol %}
<li class="block sm:inline-block group hover:bg-gray-200 dark:hover:bg-gray-800 hover:text-gray-800 dark:hover:text-gray-200">
<a href="{% url 'posts:show_pdf_protocol' post.slug %}" class="inline-flex items-center px-2 py-1">
<i class="fa-solid fa-file-pdf fa-fw text-red-800 dark:text-red-500 md:text-inherit group-hover:text-red-800 dark:group-hover:text-red-500"></i>
<span class="ml-2 sm:ml-1">Download</span>
</a>
</li>
{% endif %}
</ul>
</div>
</div>
{% endif %}
{% get_flatpages '/bs/' for user as pages %}
{% if pages %}
<div class="w-full my-2 flex items-center gap-4 text-gray-700 dark:text-gray-300" x-data="options">
<span class="flex-1">{{ pages.first.title }}</span>
<div class="relative">
<button class="sm:hidden px-2 py-1 border border-gray-300 dark:border-gray-700 rounded" @click="openShowOptions">
<i class="fa-solid fa-ellipsis-vertical fa-fw"></i>
</button>
<ul class="z-10 absolute top-0 right-0 sm:flex flex-row sm:static flex-none border dark:border-2 border-gray-300 dark:border-gray-700 rounded divide-y-2 sm:divide-y-0 sm:divide-x divide-gray-300 dark:divide-gray-700 bg-gray-100 dark:bg-gray-800 shadow sm:bg-transparent sm:shadow-none"
@click.outside="closeShowOptions"
x-show="getShowOptions"
x-transition:enter="transition ease-out duration-300"
x-transition:enter-start="transform origin-right opacity-0 scale-95"
x-transition:enter-end="transform origin-right opacity-100 scale-100"
x-transition:leave="transition ease-in duration-150"
x-transition:leave-start="transform origin-right opacity-100 scale-100"
x-transition:leave-end="transform origin-right opacity-0 scale-95"
>
<li class="block sm:inline-block group hover:bg-gray-100 dark:hover:bg-gray-800 hover:text-gray-800 dark:hover:text-gray-200">
<a href="{{ pages.first.url }}" class="inline-flex items-center px-2 py-1"><i class="fa-solid fa-file-lines fa-fw text-proprietary dark:text-proprietary-light md:text-inherit group-hover:text-proprietary dark:group-hover:text-proprietary-light"></i>
<span class="ml-2 sm:ml-1">Übersicht</span>
</a>
</li>
</ul>
</div>
</div>
{% endif %}
{% endif %}
{% endblock %}
{% block files_buttons %}
{% for file in files %}
<div class="w-full my-2 flex items-center gap-4 text-gray-700 dark:text-gray-300" x-data="options">
<span class="flex-1">{{ file.title }}</span>
<div class="relative">
<button class="sm:hidden px-2 py-1 border border-gray-300 dark:border-gray-700 rounded" @click="openShowOptions">
<i class="fa-solid fa-ellipsis-vertical fa-fw"></i>
</button>
<ul class="z-10 absolute top-0 right-0 sm:flex flex-row sm:static flex-none border dark:border-2 border-gray-300 dark:border-gray-700 rounded divide-y-2 sm:divide-y-0 sm:divide-x divide-gray-300 dark:divide-gray-700 bg-gray-100 dark:bg-gray-800 shadow sm:bg-transparent sm:shadow-none"
@click.outside="closeShowOptions"
x-show="getShowOptions"
x-transition:enter="transition ease-out duration-300"
x-transition:enter-start="transform origin-right opacity-0 scale-95"
x-transition:enter-end="transform origin-right opacity-100 scale-100"
x-transition:leave="transition ease-in duration-150"
x-transition:leave-start="transform origin-right opacity-100 scale-100"
x-transition:leave-end="transform origin-right opacity-0 scale-95"
>
<li class="block sm:inline-block group hover:bg-gray-200 dark:hover:bg-gray-800 hover:text-gray-800 dark:hover:text-gray-200">
<a href="{{ file.file_field.url }}" class="inline-flex items-center px-2 py-1" target="_blank">
<i class="fa-solid fa-file-pdf fa-fw text-red-800 dark:text-red-500 md:text-inherit group-hover:text-red-800 dark:group-hover:text-red-500"></i>
<span class="ml-2 sm:ml-1">Download</span>
</a>
</li>
</ul>
</div>
</div>
{% endfor %}
{% endblock %}
{% block update_button_mobile %}
{% if request.user.is_authenticated %}
<a href="{% url 'posts:post-update' post.slug %}" class="sm:hidden block w-full btn btn-primary mt-4">
<i class="fa-solid fa-pen-to-square mr-1"></i>FET Sitzung bearbeiten
</a>
{% endif %}
{% endblock %}

View File

@@ -0,0 +1,28 @@
{% extends 'base.html' %}
{% load static %}
{% block title %}{{ object.title }} bearbeiten{% endblock %}
{% block content %}
<!-- Main Content -->
<main class="container mx-auto w-full px-4 my-8 flex-1">
<h1 class="page-title">{{ object.title }} von {{ object.date }} bearbeiten</h1>
<div class="w-full h-full flex-1 flex justify-center items-center">
<form action="" method="POST" class="w-full max-w-prose sm:px-28 sm:py-4 grid grid-cols-1 gap-y-3 sm:gap-y-6 text-gray-900">
{% csrf_token %}
{% include "baseform/non_field_errors.html" %}
{% include "baseform/date_time.html" with field=form.event_start %}
{% include "baseform/date_time.html" with field=form.event_end %}
{% include "baseform/text.html" with field=form.event_place %}
<div class="flex flex-col-reverse sm:flex-row gap-3 justify-end pt-4 sm:pt-0">
<a href="{% url 'admin:posts_fetmeeting_change' object.id %}" class="block btn btn-secondary-proprietary">Fachschaftssitzung im Admin bearbeiten</a>
<input type="submit" class="block btn btn-primary" value="Bearbeiten">
</div>
</form>
</div>
</main>
{% endblock %}

View File

@@ -0,0 +1,62 @@
{% extends 'posts/show.html' %}
{% load post_helpers %}
{% block title %}{{ post.title }}{% endblock %}
{% block update_button_desktop %}
{% if request.user.is_authenticated %}
<a href="{% url 'posts:post-update' post.slug %}" class="hidden sm:block btn-small btn-primary">
<i class="fa-solid fa-pen-to-square mr-1"></i>Artikel bearbeiten
</a>
{% endif %}
{% endblock %}
{% block post_body %}
{% if post.body %}
{{ post.body|safe|tags_to_url }}
{% endif %}
{% endblock %}
{% block files_buttons %}
{% if files %}
<hr class="-mx-4 border-gray-200 dark:border-gray-800 dark:border my-4">
<h2 class="text-gray-800 dark:text-gray-200 font-medium"><i class="fa-solid fa-inbox mr-2 text-gray-400 dark:text-gray-500"></i>Dokument(e):</h2>
{% for file in files %}
<div class="w-full my-2 flex items-center gap-4 text-gray-700 dark:text-gray-300" x-data="options">
<span class="flex-1">{{ file.title }}</span>
<div class="relative">
<button class="sm:hidden px-2 py-1 border border-gray-300 dark:border-gray-700 rounded" @click="openShowOptions">
<i class="fa-solid fa-ellipsis-vertical fa-fw"></i>
</button>
<ul class="z-10 absolute top-0 right-0 sm:flex flex-row sm:static flex-none border dark:border-2 border-gray-300 dark:border-gray-700 rounded divide-y-2 sm:divide-y-0 sm:divide-x divide-gray-300 dark:divide-gray-700 bg-gray-100 dark:bg-gray-800 shadow sm:bg-transparent sm:shadow-none"
@click.outside="closeShowOptions"
x-show="getShowOptions"
x-transition:enter="transition ease-out duration-300"
x-transition:enter-start="transform origin-right opacity-0 scale-95"
x-transition:enter-end="transform origin-right opacity-100 scale-100"
x-transition:leave="transition ease-in duration-150"
x-transition:leave-start="transform origin-right opacity-100 scale-100"
x-transition:leave-end="transform origin-right opacity-0 scale-95"
>
<li class="block sm:inline-block group hover:bg-gray-200 dark:hover:bg-gray-800 hover:text-gray-800 dark:hover:text-gray-200">
<a href="{{ file.file_field.url }}" class="inline-flex items-center px-2 py-1" target="_blank">
<i class="fa-solid fa-file-pdf fa-fw text-red-800 dark:text-red-500 md:text-inherit group-hover:text-red-800 dark:group-hover:text-red-500"></i>
<span class="ml-2 sm:ml-1">Download</span>
</a>
</li>
</ul>
</div>
</div>
{% endfor %}
{% endif %}
{% endblock %}
{% block update_button_mobile %}
{% if request.user.is_authenticated %}
<a href="{% url 'posts:post-update' post.slug %}" class="sm:hidden block w-full btn btn-primary mt-4">
<i class="fa-solid fa-pen-to-square mr-1"></i>Artikel bearbeiten
</a>
{% endif %}
{% endblock %}

View File

@@ -0,0 +1,26 @@
{% extends 'base.html' %}
{% block title %}{{ object.title }} bearbeiten{% endblock %}
{% block content %}
<!-- Main Content -->
<main class="container mx-auto w-full px-4 my-8 flex-1">
<h1 class="page-title">News '{{ object.title }}' bearbeiten</h1>
<div class="w-full h-full flex-1 flex justify-center items-center">
<form action="" method="POST" class="w-full max-w-prose sm:px-28 sm:py-4 grid grid-cols-1 gap-y-3 sm:gap-y-6 text-gray-900">
{% csrf_token %}
{% include "baseform/non_field_errors.html" %}
{% include "baseform/text.html" with field=form.title %}
{% include "baseform/select.html" with field=form.status %}
{% include "baseform/body.html" with field=form.body media=form.media %}
<div class="flex flex-col-reverse sm:flex-row gap-3 justify-end pt-4 sm:pt-0">
<a href="{% url 'admin:posts_news_change' object.id %}" class="block btn btn-secondary-proprietary">News im Admin bearbeiten</a>
<input type="submit" class="block btn btn-primary" value="Bearbeiten">
</div>
</form>
</div>
</main>
{% endblock %}

View File

@@ -1,10 +1,7 @@
{% extends 'base.html' %}
{% load flatpages %}
{% load post_helpers %}
{% block title %}News{% endblock %}
{% block extraheader %}
<meta content="{{ post.imageurl }}" property="og:image">
<meta content="{{ post.title }}" property="og:title">
@@ -15,7 +12,7 @@
{% block content %}
<!-- Main Content -->
<main class="container mx-auto w-full flex-1 my-8 sm:flex flex-col sm:px-4">
<a href="{% url 'posts:show' previous %}" class="hidden z-20 fixed left-0 top-1/2 -mt-8 p-2 xl:flex items-center text-gray-400 dark:text-gray-300 rounded-md"
<a href="{% url 'posts:post-detail' previous %}" class="hidden z-20 fixed left-0 top-1/2 -mt-8 p-2 xl:flex items-center text-gray-400 dark:text-gray-300 rounded-md"
x-data="prevArticleButton"
@mouseleave="closeShowPrevArticleButton"
@mouseover="openShowPrevArticleButton"
@@ -29,9 +26,9 @@
x-transition:leave="transition ease-in duration-150"
x-transition:leave-start="opacity-100 transform scale-100"
x-transition:leave-end="opacity-0 bg-opacity-0 transform scale-100"
>Vorheriger<br>Artikel</span>
>{% block prev_text_big %}Vorheriger<br>Artikel{% endblock %}</span>
</a>
<a href="{% url 'posts:show' next %}" class="hidden z-20 fixed right-0 top-1/2 -mt-8 p-2 xl:flex items-center text-gray-400 dark:text-gray-300 rounded-md"
<a href="{% url 'posts:post-detail' next %}" class="hidden z-20 fixed right-0 top-1/2 -mt-8 p-2 xl:flex items-center text-gray-400 dark:text-gray-300 rounded-md"
x-data="nextArticleButton"
@mouseleave="closeShowNextArticleButton"
@mouseover="openShowNextArticleButton"
@@ -44,7 +41,7 @@
x-transition:leave="transition ease-in duration-150"
x-transition:leave-start="opacity-100 transform scale-100"
x-transition:leave-end="opacity-0 bg-opacity-0 transform scale-100"
>Nächster<br>Artikel</span>
>{% block next_text_big %}Nächster<br>Artikel{% endblock %}</span>
<i class="fa-solid fa-chevron-right text-5xl -m-2 p-2 bg-gray-100 dark:bg-gray-700 rounded-md"></i>
</a>
<section>
@@ -54,297 +51,72 @@
<li class="inline-block py-1 px-2 bg-sky-100 dark:bg-sky-900 rounded-full"><a href="{% url 'posts:tags' t %}">#{{ t }}</a></li>
{% endfor %}
</ul>
<h1 class="px-4 sm:px-0 text-lg sm:text-xl lg:text-3xl text-center sm:text-left font-medium text-gray-900 dark:text-gray-100 font-serif tracking-wider leading-normal" style="line-height: 1.5;">{{ post.title|tags_to_url }}</h1>
<h1 class="px-4 sm:px-0 text-lg sm:text-xl lg:text-3xl text-center sm:text-left font-medium text-gray-900 dark:text-gray-100 font-serif tracking-wider leading-normal" style="line-height: 1.5;">{{ post.title }}</h1>
<div class="mx-auto max-w-max sm:mx-0 sm:max-w-none sm:flex justify-between items-center">
<div class="max-w-max flex flex-row justify-center sm:justify-start gap-2 self-center md:self-start">
{% if author_image and author %}
<img class="hidden sm:block w-12 rounded-full" src="{{ author_image }}" alt="Portraitfoto von {{ author.firstname }}">
<div class="sm:flex flex-col justify-evenly text-gray-600 dark:text-gray-300 text-sm sm:text-base">
<a href="{% url 'members:member' author.id %}" class="underline">{{ author.firstname }}</a>
<span class="sm:hidden"> am </span>
<span>{{ post.date|date:"d. F Y" }}</span>
</div>
{% elif post.author %}
<div class="sm:flex flex-col justify-evenly text-gray-600 dark:text-gray-300 text-sm sm:text-base">
<a class="underline">{{ post.author|capfirst }}</a>
<span class="sm:hidden"> am </span>
<span>{{ post.date|date:"d. F Y" }}</span>
</div>
{% else %}
<div class="sm:flex flex-col justify-evenly text-gray-600 dark:text-gray-300 text-sm sm:text-base">
<a class="underline">fet.at Redaktion</a>
<span class="sm:hidden"> am </span>
<span>{{ post.date|date:"d. F Y" }}</span>
</div>
{% endif %}
</div>
{% if request.user.is_authenticated %}
{% if post.post_type == 'N' %}
<a href="{% url 'admin:posts_news_change' post.id %}" class="hidden sm:block btn-small btn-primary">
<i class="fa-solid fa-pen-to-square mr-1"></i>Artikel bearbeiten
</a>
{% elif post.post_type == 'E' %}
<a href="{% url 'admin:posts_event_change' post.id %}" class="hidden sm:block btn-small btn-primary">
<i class="fa-solid fa-pen-to-square mr-1"></i>Event bearbeiten
</a>
{% elif post.post_type == 'F' %}
<a href="{% url 'admin:posts_fetmeeting_change' post.id %}" class="hidden sm:block btn-small btn-primary">
<i class="fa-solid fa-pen-to-square mr-1"></i>FET Sitzung bearbeiten
</a>
{% endif %}
{% endif %}
</div>
{% block update_button_desktop %}
{% endblock %}
</div>
</div>
<!-- <img src="img/article-cover-3.jpg" alt="" class="h-44 sm:h-56 lg:h-64 xl:h-80 w-full object-cover sm:rounded-md max-w-5xl mx-auto"> -->
<div class="relative w-full h-44 sm:h-56 md:h-60 lg:h-64 xl:h-96 bg-center bg-no-repeat bg-cover sm:rounded-md mx-auto" style="background-image: url('{{ post.imageurl }}');">
{% if post.post_type != 'N' %}
<div class="hidden lg:block absolute top-0 right-0 bg-white dark:bg-gray-900 rounded-bl p-2 bg-opacity-80 dark:bg-opacity-70 gap-2">
<div class="items-center lg:flex gap-2">
<i class="flex-none fa-solid fa-calendar-day fa-fw text-gray-800 dark:text-gray-200"></i>
<span class="flex-1 text-sm text-gray-800 dark:text-gray-200">
Event-Start: {{ post.event_start|date }} um {{ post.event_start|time }} Uhr<br>
Event-Ende: {{ post.event_end|date }} um {{ post.event_end|time }} Uhr
</span>
</div>
{% if post.event_place %}
<div class="items-center lg:flex gap-2">
<i class="flex-none fa-solid fa-location-dot fa-fw text-gray-800 dark:text-gray-200"></i>
<span class="flex-1 text-sm text-gray-800 dark:text-gray-200">
Event-Ort: {{ post.event_place }}
</span>
</div>
{% endif %}
</div>
<div class="hidden absolute top-0 right-0 bg-white dark:bg-gray-900 rounded-bl p-2 bg-opacity-80 dark:bg-opacity-70 items-center gap-2">
<i class="flex-none fa-solid fa-calendar-day text-gray-800 dark:text-gray-200"></i>
<span class="flex-1 text-sm text-gray-800 dark:text-gray-200">
Event-Start: {{ post.event_start|date }} um {{ post.event_start|time }} Uhr<br>
Event-Ende: {{ post.event_end|date }} um {{ post.event_end|time }} Uhr<br>
{% if post.event_place %}
Event-Ort: {{ post.event_place }}
{% endif %}
</span>
</div>
{% endif %}
{% block event_details_desktop %}
{% endblock %}
</div>
</section>
<section class="mx-4 z-10">
<article class="p-4 mt-4 sm:-mt-16 xl:-mt-24 w-full max-w-prose mx-auto bg-white dark:bg-gray-900 rounded dark:border-2 dark:border-gray-800">
<!-- <div class="w-full flex justify-end">
<div class="hidden lg:block max-w-max text-sm text-gray-600">
Event-Start: 23. August 2021 um 18:00 Uhr<br>
Event-Ende: 23. August 2021 um 20:00 Uhr
</div>
</div> -->
<div class="db-page-content-left big-first-letter">
<!-- Content from DB here: -->
{% if post.has_agenda %}
<h2>Agenda</h2>
{{ post.agenda_html|safe }}
{% elif post.body %}
{{ post.body|safe|tags_to_url }}
{% endif %}
{% if request.user.is_authenticated and post.has_protocol %}
<hr>
<h2>Protokoll</h2>
{{ post.protocol_html|safe }}
{% endif %}
{% block post_body %}
{% endblock %}
</div>
{% if post.post_type != 'N' %}
<hr class="lg:hidden -mx-4 border-gray-200 dark:border-gray-800 dark:border my-4">
<div class="lg:hidden">
<h2 class="text-gray-800 dark:text-gray-200 font-medium"><i class="fa-solid fa-calendar-days mr-2 text-gray-400 dark:text-gray-500"></i>Termindetails:</h2>
<ul class="text-base text-gray-700 dark:text-gray-300 my-1">
<li>Start: {{ post.event_start|date }} um {{ post.event_start|time }} Uhr</li>
<li>Ende: {{ post.event_end|date }} um {{ post.event_end|time }} Uhr</li>
{% if post.event_place %}
<li>Ort: {{ post.event_place }}</li>
{% endif %}
</ul>
</div>
{% endif %}
{% block event_details_mobile %}
{% endblock %}
{% if post.has_agenda or post.has_protocol %}
{% if request.user.is_authenticated %}
<hr class="-mx-4 border-gray-200 dark:border-gray-800 dark:border my-4">
<h2 class="text-gray-800 dark:text-gray-200 font-medium"><i class="fa-solid fa-inbox mr-2 text-gray-400 dark:text-gray-500"></i>Dokument(e):</h2>
{% endif %}
{% elif files %}
<hr class="-mx-4 border-gray-200 dark:border-gray-800 dark:border my-4">
<h2 class="text-gray-800 dark:text-gray-200 font-medium"><i class="fa-solid fa-inbox mr-2 text-gray-400 dark:text-gray-500"></i>Dokument(e):</h2>
{% endif %}
{% block docu_buttons %}
{% endblock %}
{% if request.user.is_authenticated %}
{% if post.has_agenda %}
<div class="w-full my-2 flex items-center gap-4 text-gray-700 dark:text-gray-300" x-data="options">
<span class="flex-1">Agenda</span>
<div class="relative">
<button class="sm:hidden px-2 py-1 border border-gray-300 dark:border-gray-700 rounded" @click="openShowOptions">
<i class="fa-solid fa-ellipsis-vertical fa-fw"></i>
</button>
<ul class="z-10 absolute top-0 right-0 sm:flex flex-row sm:static flex-none border dark:border-2 border-gray-300 dark:border-gray-700 rounded divide-y-2 sm:divide-y-0 sm:divide-x divide-gray-300 dark:divide-gray-700 bg-gray-100 dark:bg-gray-800 shadow sm:bg-transparent sm:shadow-none"
@click.outside="closeShowOptions"
x-show="getShowOptions"
x-transition:enter="transition ease-out duration-300"
x-transition:enter-start="transform origin-right opacity-0 scale-95"
x-transition:enter-end="transform origin-right opacity-100 scale-100"
x-transition:leave="transition ease-in duration-150"
x-transition:leave-start="transform origin-right opacity-100 scale-100"
x-transition:leave-end="transform origin-right opacity-0 scale-95"
>
<li class="block sm:inline-block group hover:bg-gray-100 dark:hover:bg-gray-800 hover:text-gray-800 dark:hover:text-gray-200">
<a href="{{ post.agenda_link }}" class="inline-flex items-center px-2 py-1">
<i class="fa-solid fa-file-signature fa-fw text-proprietary dark:text-proprietary-light md:text-inherit group-hover:text-proprietary dark:group-hover:text-proprietary-light"></i>
<span class="ml-2 sm:ml-1">Bearbeiten</span>
</a>
</li>
{% if post.filename_agenda %}
<li class="block sm:inline-block group hover:bg-gray-200 dark:hover:bg-gray-800 hover:text-gray-800 dark:hover:text-gray-200">
<a href="{% url 'posts:show_pdf_agenda' post.slug %}" class="inline-flex items-center px-2 py-1">
<i class="fa-solid fa-file-pdf fa-fw text-red-800 dark:text-red-500 md:text-inherit group-hover:text-red-800 dark:group-hover:text-red-500"></i>
<span class="ml-2 sm:ml-1">Download</span>
</a>
</li>
{% endif %}
</ul>
</div>
</div>
{% endif %}
{% if post.has_protocol %}
<div class="w-full my-2 flex items-center gap-4 text-gray-700 dark:text-gray-300" x-data="options">
<span class="flex-1">Protokoll</span>
<div class="relative">
<button class="sm:hidden px-2 py-1 border border-gray-300 dark:border-gray-700 rounded" @click="openShowOptions">
<i class="fa-solid fa-ellipsis-vertical fa-fw"></i>
</button>
<ul class="z-10 absolute top-0 right-0 sm:flex flex-row sm:static flex-none border dark:border-2 border-gray-300 dark:border-gray-700 rounded divide-y-2 sm:divide-y-0 sm:divide-x divide-gray-300 dark:divide-gray-700 bg-gray-100 dark:bg-gray-800 shadow sm:bg-transparent sm:shadow-none"
@click.outside="closeShowOptions"
x-show="getShowOptions"
x-transition:enter="transition ease-out duration-300"
x-transition:enter-start="transform origin-right opacity-0 scale-95"
x-transition:enter-end="transform origin-right opacity-100 scale-100"
x-transition:leave="transition ease-in duration-150"
x-transition:leave-start="transform origin-right opacity-100 scale-100"
x-transition:leave-end="transform origin-right opacity-0 scale-95"
>
<li class="block sm:inline-block group hover:bg-gray-100 dark:hover:bg-gray-800 hover:text-gray-800 dark:hover:text-gray-200">
<a href="{{ post.protocol_link }}" class="inline-flex items-center px-2 py-1"><i class="fa-solid fa-file-signature fa-fw text-proprietary dark:text-proprietary-light md:text-inherit group-hover:text-proprietary dark:group-hover:text-proprietary-light"></i>
<span class="ml-2 sm:ml-1">Bearbeiten</span>
</a>
</li>
{% if post.filename_protocol %}
<li class="block sm:inline-block group hover:bg-gray-200 dark:hover:bg-gray-800 hover:text-gray-800 dark:hover:text-gray-200">
<a href="{% url 'posts:show_pdf_protocol' post.slug %}" class="inline-flex items-center px-2 py-1">
<i class="fa-solid fa-file-pdf fa-fw text-red-800 dark:text-red-500 md:text-inherit group-hover:text-red-800 dark:group-hover:text-red-500"></i>
<span class="ml-2 sm:ml-1">Download</span>
</a>
</li>
{% endif %}
</ul>
</div>
</div>
{% endif %}
{% if post.post_type == 'F' %}
{% get_flatpages '/bs/' for user as pages %}
{% if pages %}
<div class="w-full my-2 flex items-center gap-4 text-gray-700 dark:text-gray-300" x-data="options">
<span class="flex-1">{{ pages.first.title }}</span>
<div class="relative">
<button class="sm:hidden px-2 py-1 border border-gray-300 dark:border-gray-700 rounded" @click="openShowOptions">
<i class="fa-solid fa-ellipsis-vertical fa-fw"></i>
</button>
<ul class="z-10 absolute top-0 right-0 sm:flex flex-row sm:static flex-none border dark:border-2 border-gray-300 dark:border-gray-700 rounded divide-y-2 sm:divide-y-0 sm:divide-x divide-gray-300 dark:divide-gray-700 bg-gray-100 dark:bg-gray-800 shadow sm:bg-transparent sm:shadow-none"
@click.outside="closeShowOptions"
x-show="getShowOptions"
x-transition:enter="transition ease-out duration-300"
x-transition:enter-start="transform origin-right opacity-0 scale-95"
x-transition:enter-end="transform origin-right opacity-100 scale-100"
x-transition:leave="transition ease-in duration-150"
x-transition:leave-start="transform origin-right opacity-100 scale-100"
x-transition:leave-end="transform origin-right opacity-0 scale-95"
>
<li class="block sm:inline-block group hover:bg-gray-100 dark:hover:bg-gray-800 hover:text-gray-800 dark:hover:text-gray-200">
<a href="{{ pages.first.url }}" class="inline-flex items-center px-2 py-1"><i class="fa-solid fa-file-lines fa-fw text-proprietary dark:text-proprietary-light md:text-inherit group-hover:text-proprietary dark:group-hover:text-proprietary-light"></i>
<span class="ml-2 sm:ml-1">Übersicht</span>
</a>
</li>
</ul>
</div>
</div>
{% endif %}
{% endif %}
{% endif %}
{% for file in files %}
<div class="w-full my-2 flex items-center gap-4 text-gray-700 dark:text-gray-300" x-data="options">
<span class="flex-1">{{ file.title }}</span>
<div class="relative">
<button class="sm:hidden px-2 py-1 border border-gray-300 dark:border-gray-700 rounded" @click="openShowOptions">
<i class="fa-solid fa-ellipsis-vertical fa-fw"></i>
</button>
<ul class="z-10 absolute top-0 right-0 sm:flex flex-row sm:static flex-none border dark:border-2 border-gray-300 dark:border-gray-700 rounded divide-y-2 sm:divide-y-0 sm:divide-x divide-gray-300 dark:divide-gray-700 bg-gray-100 dark:bg-gray-800 shadow sm:bg-transparent sm:shadow-none"
@click.outside="closeShowOptions"
x-show="getShowOptions"
x-transition:enter="transition ease-out duration-300"
x-transition:enter-start="transform origin-right opacity-0 scale-95"
x-transition:enter-end="transform origin-right opacity-100 scale-100"
x-transition:leave="transition ease-in duration-150"
x-transition:leave-start="transform origin-right opacity-100 scale-100"
x-transition:leave-end="transform origin-right opacity-0 scale-95"
>
<li class="block sm:inline-block group hover:bg-gray-200 dark:hover:bg-gray-800 hover:text-gray-800 dark:hover:text-gray-200">
<a href="{{ file.file_field.url }}" class="inline-flex items-center px-2 py-1" target="_blank">
<i class="fa-solid fa-file-pdf fa-fw text-red-800 dark:text-red-500 md:text-inherit group-hover:text-red-800 dark:group-hover:text-red-500"></i>
<span class="ml-2 sm:ml-1">Download</span>
</a>
</li>
</ul>
</div>
</div>
{% endfor %}
{% block files_buttons %}
{% endblock %}
<hr class="-mx-4 border-gray-200 dark:border-gray-800 dark:border my-4">
<div class="-m-4 flex divide-x divide-gray-200 dark:divide-gray-800 dark:divide-x-2 text-sm sm:text-base">
<a href="{% url 'posts:show' previous %}" class="w-1/2 p-4 flex items-center gap-2">
<a href="{% url 'posts:post-detail' previous %}" class="w-1/2 p-4 flex items-center gap-2">
<i class="fa-solid fa-chevron-left text-gray-600 dark:text-gray-400"></i>
<span class="text-gray-700 dark:text-gray-300 font-medium">Vorheriger Artikel</span>
<span class="text-gray-700 dark:text-gray-300 font-medium">{% block prev_text %}Vorheriger Artikel{% endblock %}</span>
</a>
<a href="{% url 'posts:show' next %}" class="w-1/2 p-4 flex flex-row-reverse items-center gap-2">
<a href="{% url 'posts:post-detail' next %}" class="w-1/2 p-4 flex flex-row-reverse items-center gap-2">
<i class="fa-solid fa-chevron-right text-gray-600 dark:text-gray-400"></i>
<span class="text-gray-700 dark:text-gray-300 font-medium">Nächster Artikel</span>
<span class="text-gray-700 dark:text-gray-300 font-medium">{% block next_text %}Nächster Artikel{% endblock %}</span>
</a>
</div>
</article>
{% if request.user.is_authenticated %}
{% if post.post_type == 'N' %}
<a href="{% url 'admin:posts_news_change' post.id %}" class="sm:hidden block w-full btn btn-primary mt-4">
<i class="fa-solid fa-pen-to-square mr-1"></i>Artikel bearbeiten
</a>
{% elif post.post_type == 'E' %}
<a href="{% url 'admin:posts_event_change' post.id %}" class="sm:hidden block w-full btn btn-primary mt-4">
<i class="fa-solid fa-pen-to-square mr-1"></i>Event bearbeiten
</a>
{% elif post.post_type == 'F' %}
<a href="{% url 'admin:posts_fetmeeting_change' post.id %}" class="sm:hidden block w-full btn btn-primary mt-4">
<i class="fa-solid fa-pen-to-square mr-1"></i>FET Sitzung bearbeiten
</a>
{% endif %}
{% endif %}
{% block update_button_mobile %}
{% endblock %}
</section>
{% if related_posts %}