From dce9c206b59161b7f9f51e02f2f57405f0f7533d Mon Sep 17 00:00:00 2001 From: Felix Rindt Date: Wed, 18 Dec 2024 13:07:37 +0100 Subject: [PATCH 01/10] add responsible indicator --- .../core/templates/core/fragments/event_list_list_mode.html | 6 ++++++ ephios/static/ephios/scss/ephios_custom.scss | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ephios/core/templates/core/fragments/event_list_list_mode.html b/ephios/core/templates/core/fragments/event_list_list_mode.html index e2bdbeda1..af40abe26 100644 --- a/ephios/core/templates/core/fragments/event_list_list_mode.html +++ b/ephios/core/templates/core/fragments/event_list_list_mode.html @@ -66,6 +66,12 @@
+ {% if event.can_change %} + + + + {% endif %} {{ event.type }}
- {% if event.can_change %} - - - - {% endif %} {{ event.type }} -
- {{ event.start_time|date:"D" }}, - {% if event.start_time.date == event.end_time.date %} - {{ event.start_time|date:"SHORT_DATE_FORMAT" }} - , -
- {{ event.start_time|date:"TIME_FORMAT" }} – - {{ event.end_time|date:"TIME_FORMAT" }} - {% else %} - {{ event.start_time|date:"SHORT_DATE_FORMAT" }} -
- {% translate "to" %} - {{ event.end_time|date:"SHORT_DATE_FORMAT" }} - {% endif %} +
+ {{ event.start_time|date:"D" }}, + {% if event.start_time.date == event.end_time.date %} + {{ event.start_time|date:"SHORT_DATE_FORMAT" }} + , +
+ {{ event.start_time|date:"TIME_FORMAT" }} – + {{ event.end_time|date:"TIME_FORMAT" }} + {% else %} + {{ event.start_time|date:"SHORT_DATE_FORMAT" }} +
+ {% translate "to" %} + {{ event.end_time|date:"SHORT_DATE_FORMAT" }} + {% endif %} +
diff --git a/ephios/static/ephios/scss/ephios_custom.scss b/ephios/static/ephios/scss/ephios_custom.scss index 1ef7dd3d0..aa3e33f3f 100644 --- a/ephios/static/ephios/scss/ephios_custom.scss +++ b/ephios/static/ephios/scss/ephios_custom.scss @@ -148,7 +148,6 @@ footer { grid-area: signup; justify-self: end; align-self: end; - width: 100%; } .grid-action { @@ -158,7 +157,7 @@ footer { @media (min-width: 992px) { .grid-wrapper { - grid-template-columns: 6fr auto 8rem 5rem auto; + grid-template-columns: 6fr auto 8rem 7rem 0px; grid-template-rows: auto; grid-template-areas: "title badge time signup action" From a1b953aaf763a9b828d143bb7b0865a3ed457288 Mon Sep 17 00:00:00 2001 From: Felix Rindt Date: Mon, 23 Dec 2024 19:49:15 +0100 Subject: [PATCH 03/10] show groups an event is visible to --- ephios/core/models/events.py | 6 +- .../core/fragments/event_list_list_mode.html | 60 ++++++++++--------- ephios/core/views/event.py | 18 +++++- ephios/static/ephios/scss/ephios_custom.scss | 2 +- 4 files changed, 53 insertions(+), 33 deletions(-) diff --git a/ephios/core/models/events.py b/ephios/core/models/events.py index c425e8ee6..f5fbfa74e 100644 --- a/ephios/core/models/events.py +++ b/ephios/core/models/events.py @@ -2,6 +2,7 @@ from datetime import timedelta from typing import TYPE_CHECKING +from django.contrib.contenttypes.fields import GenericRelation from django.db import models, transaction from django.db.models import ( BooleanField, @@ -24,7 +25,7 @@ from django.utils.translation import gettext_lazy as _ from django.utils.translation import pgettext from dynamic_preferences.models import PerInstancePreferenceModel -from guardian.shortcuts import assign_perm, get_objects_for_user +from guardian.shortcuts import assign_perm, get_objects_for_user, GroupObjectPermission from polymorphic.managers import PolymorphicManager from polymorphic.models import PolymorphicModel from polymorphic.query import PolymorphicQuerySet @@ -78,6 +79,9 @@ class Event(Model): location = CharField(_("location"), max_length=254) type = ForeignKey(EventType, on_delete=models.CASCADE, verbose_name=_("event type")) active = BooleanField(default=False, verbose_name=_("active")) + group_object_permission_set = GenericRelation( + GroupObjectPermission, object_id_field="object_pk" + ) objects = ActiveManager() all_objects = Manager() diff --git a/ephios/core/templates/core/fragments/event_list_list_mode.html b/ephios/core/templates/core/fragments/event_list_list_mode.html index bf02b0441..93b58c376 100644 --- a/ephios/core/templates/core/fragments/event_list_list_mode.html +++ b/ephios/core/templates/core/fragments/event_list_list_mode.html @@ -28,25 +28,37 @@ {% with counter=event|event_list_signup_state_counts stats=event.get_signup_stats %}
  • -
    - {% if counter|get:ParticipationStates.CONFIRMED > 0 %} - - {% elif counter|get:ParticipationStates.REQUESTED > 0 %} - - {% elif counter|get:ParticipationStates.RESPONSIBLE_REJECTED > 0 %} - - {% elif counter|get:ParticipationStates.USER_DECLINED > 0 and counter|length == 1 %} - - {% else %} - +
    + {% if event.can_change %} + + + {% endif %} + + {% if counter|get:ParticipationStates.CONFIRMED > 0 %} + + {% elif counter|get:ParticipationStates.REQUESTED > 0 %} + + {% elif counter|get:ParticipationStates.RESPONSIBLE_REJECTED > 0 %} + + {% elif counter|get:ParticipationStates.USER_DECLINED > 0 and counter|length == 1 %} + + {% else %} + + {% endif %} +
    {% if perms.core.add_event %}
    @@ -68,17 +80,9 @@
    {{ event.type }} -