diff --git a/core/migrations/0020_rename_is_external_to_is_partner_event.py b/core/migrations/0020_rename_is_external_to_is_partner_event.py new file mode 100644 index 0000000..3139884 --- /dev/null +++ b/core/migrations/0020_rename_is_external_to_is_partner_event.py @@ -0,0 +1,18 @@ +# Generated by Django 4.2.1 on 2023-11-15 12:00 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('core', '0019_alter_aboutuspage_team_members'), + ] + + operations = [ + migrations.RenameField( + model_name='eventpage', + old_name='is_external', + new_name='is_partner_event', + ), + ] diff --git a/core/models.py b/core/models.py index b9857dc..e5ae132 100644 --- a/core/models.py +++ b/core/models.py @@ -318,7 +318,7 @@ class EventPage(Page): help_text="Last day where the registration will be available. Leave empty to enable registration permanently" "after start date") show_in_event_calendar = models.BooleanField(default=True, help_text='Event in Eventliste und im Kalender anzeigen?') - is_external = models.BooleanField(default=False, help_text='Externes Event? Externe Events werden nicht im Upcoming Events Banner auf der Startseite angezeigt.') + is_partner_event = models.BooleanField(default=False, help_text='Partner Event? Partner Events werden mit einem Ribbon markiert und nicht im Upcoming Events Banner auf der Startseite angezeigt.') is_free = models.BooleanField(default=False, help_text='If this is checked the send button under the registration' 'form will be labeled "verbindlich anmelden" instead of "kostenpflichtig anmelden"') @@ -369,7 +369,7 @@ EventPage.content_panels = [ FieldPanel('downloads'), MultiFieldPanel([ FieldPanel('show_in_event_calendar'), - FieldPanel('is_external'), + FieldPanel('is_partner_event'), FieldPanel('vimeo_id'), ], heading="Settings", classname="collapsible collapsed"), MultiFieldPanel([ diff --git a/core/static/css/theme/events.css b/core/static/css/theme/events.css index 5c7f0c2..ea53251 100644 --- a/core/static/css/theme/events.css +++ b/core/static/css/theme/events.css @@ -34,6 +34,24 @@ padding-bottom: 1rem; border-bottom: 1px solid rgba(0, 0, 0, 0.05); transition: all 0.3s ease; + position: relative; +} + +/* Partner event ribbon */ +.partner-event-ribbon { + position: absolute; + top: 10px; + right: 10px; + background: linear-gradient(135deg, #ff9800, #ff5722); + color: white; + padding: 0.3rem 1rem; + font-size: 0.8rem; + font-weight: var(--font-weight-medium); + box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2); + z-index: 10; + border-radius: 3px; + text-transform: uppercase; + letter-spacing: 0.5px; } .event-item:hover { @@ -180,6 +198,10 @@ font-size: 2rem; } +.event-calendar .event-title { + font-size: 1.25rem; +} + .event-title::after { content: ''; position: absolute; diff --git a/core/tasks.py b/core/tasks.py index ad7b1c8..7789dc9 100644 --- a/core/tasks.py +++ b/core/tasks.py @@ -11,11 +11,11 @@ from core.models import EventPage, EventHistoryPage def move_past_events_to_history(): """ Daily task to: - 1. Move past events that are not external to the history - 2. Unpublish external events that are past + 1. Move past events that are not partner events to the history + 2. Unpublish partner events that are past """ today = date.today() - + # Find all live EventPage objects with a start_date in the past past_events = EventPage.objects.live().filter( Q(end_date__lt=timezone.now()) | Q(end_date__isnull=True, start_date__lt=timezone.now())) @@ -28,26 +28,26 @@ def move_past_events_to_history(): return "No EventHistoryPage found. Cannot move past events." except EventHistoryPage.DoesNotExist: return "No EventHistoryPage found. Cannot move past events." - + moved_count = 0 unpublished_count = 0 - + with transaction.atomic(): # Process each past event for event in past_events: - if event.is_external: - # Unpublish external events + if event.is_partner_event: + # Unpublish partner events event.unpublish() unpublished_count += 1 else: - # Move non-external events to history + # Move non-partner events to history # Get the current parent page current_parent = event.get_parent() - + # Only move if not already under the history page if current_parent.id != history_page.id: # Move the event to be a child of the history page event.move(history_page, pos='last-child') moved_count += 1 - - return f"Processed past events: {moved_count} moved to history, {unpublished_count} external events unpublished." + + return f"Processed past events: {moved_count} moved to history, {unpublished_count} partner events unpublished." diff --git a/core/templates/core/event_index_page.html b/core/templates/core/event_index_page.html index a5bbf17..2eeb6b7 100644 --- a/core/templates/core/event_index_page.html +++ b/core/templates/core/event_index_page.html @@ -20,6 +20,9 @@ {{ event.start_date|date:"b" }}