Skip to content
Snippets Groups Projects
Commit b9137b1b authored by Nadja Geisler's avatar Nadja Geisler :sunny:
Browse files

Merge branch 'interest_restriction' into 'main'

add interest window

See merge request !111
parents bf847eff c2fcc620
Branches
No related tags found
1 merge request!111add interest window
Pipeline #48623 failed
Showing
with 498 additions and 291 deletions
...@@ -8,7 +8,7 @@ msgid "" ...@@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-04-29 22:48+0000\n" "POT-Creation-Date: 2021-10-29 09:57+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
...@@ -116,7 +116,7 @@ msgstr "AK \"%(ak)s\" bearbeitet." ...@@ -116,7 +116,7 @@ msgstr "AK \"%(ak)s\" bearbeitet."
msgid "AK \"%(ak)s\" deleted." msgid "AK \"%(ak)s\" deleted."
msgstr "AK \"%(ak)s\" gelöscht." msgstr "AK \"%(ak)s\" gelöscht."
#: AKDashboard/views.py:58 #: AKDashboard/views.py:61
#, python-format #, python-format
msgid "AK \"%(ak)s\" (re-)scheduled." msgid "AK \"%(ak)s\" (re-)scheduled."
msgstr "AK \"%(ak)s\" (um-)geplant." msgstr "AK \"%(ak)s\" (um-)geplant."
...@@ -159,9 +159,9 @@ class AKAdminForm(forms.ModelForm): ...@@ -159,9 +159,9 @@ class AKAdminForm(forms.ModelForm):
@admin.register(AK) @admin.register(AK)
class AKAdmin(SimpleHistoryAdmin): class AKAdmin(SimpleHistoryAdmin):
model = AK model = AK
list_display = ['name', 'short_name', 'category', 'track', 'is_wish', 'interest', 'event'] list_display = ['name', 'short_name', 'category', 'track', 'is_wish', 'interest', 'interest_counter', 'event']
list_filter = ['category', WishFilter, 'event'] list_filter = ['category', WishFilter, 'event']
list_editable = ['short_name', 'track', 'interest'] list_editable = ['short_name', 'track', 'interest', 'interest_counter']
ordering = ['pk'] ordering = ['pk']
actions = ['wiki_export'] actions = ['wiki_export']
form = AKAdminForm form = AKAdminForm
......
This diff is collapsed.
# Generated by Django 3.1.8 on 2021-10-29 10:01
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('AKModel', '0048_constraint_violation_text'),
]
operations = [
migrations.AddField(
model_name='event',
name='interest_end',
field=models.DateTimeField(blank=True, help_text='Closing time for expression of interest.', null=True,
verbose_name='Interest Window End'),
),
migrations.AddField(
model_name='event',
name='interest_start',
field=models.DateTimeField(blank=True, help_text='Opening time for expression of interest.', null=True,
verbose_name='Interest Window Start'),
),
]
...@@ -27,6 +27,11 @@ class Event(models.Model): ...@@ -27,6 +27,11 @@ class Event(models.Model):
reso_deadline = models.DateTimeField(verbose_name=_('Resolution Deadline'), blank=True, null=True, reso_deadline = models.DateTimeField(verbose_name=_('Resolution Deadline'), blank=True, null=True,
help_text=_('When should AKs with intention to submit a resolution be done?')) help_text=_('When should AKs with intention to submit a resolution be done?'))
interest_start = models.DateTimeField(verbose_name=_('Interest Window Start'), blank=True, null=True,
help_text=_('Opening time for expression of interest.'))
interest_end = models.DateTimeField(verbose_name=_('Interest Window End'), blank=True, null=True,
help_text=_('Closing time for expression of interest.'))
public = models.BooleanField(verbose_name=_('Public event'), default=True, public = models.BooleanField(verbose_name=_('Public event'), default=True,
help_text=_('Show this event on overview page.')) help_text=_('Show this event on overview page.'))
...@@ -160,7 +165,8 @@ class AKCategory(models.Model): ...@@ -160,7 +165,8 @@ class AKCategory(models.Model):
description = models.TextField(blank=True, verbose_name=_("Description"), description = models.TextField(blank=True, verbose_name=_("Description"),
help_text=_("Short description of this AK Category")) help_text=_("Short description of this AK Category"))
present_by_default = models.BooleanField(blank=True, default=True, verbose_name=_("Present by default"), present_by_default = models.BooleanField(blank=True, default=True, verbose_name=_("Present by default"),
help_text=_("Present AKs of this category by default if AK owner did not specify whether this AK should be presented?")) help_text=_(
"Present AKs of this category by default if AK owner did not specify whether this AK should be presented?"))
event = models.ForeignKey(to=Event, on_delete=models.CASCADE, verbose_name=_('Event'), event = models.ForeignKey(to=Event, on_delete=models.CASCADE, verbose_name=_('Event'),
help_text=_('Associated event')) help_text=_('Associated event'))
...@@ -328,7 +334,8 @@ class Room(models.Model): ...@@ -328,7 +334,8 @@ class Room(models.Model):
name = models.CharField(max_length=64, verbose_name=_('Name'), help_text=_('Name or number of the room')) name = models.CharField(max_length=64, verbose_name=_('Name'), help_text=_('Name or number of the room'))
location = models.CharField(max_length=256, blank=True, verbose_name=_('Location'), location = models.CharField(max_length=256, blank=True, verbose_name=_('Location'),
help_text=_('Name or number of the location')) help_text=_('Name or number of the location'))
capacity = models.IntegerField(verbose_name=_('Capacity'), help_text=_('Maximum number of people (-1 for unlimited).')) capacity = models.IntegerField(verbose_name=_('Capacity'),
help_text=_('Maximum number of people (-1 for unlimited).'))
properties = models.ManyToManyField(to=AKRequirement, blank=True, verbose_name=_('Properties'), properties = models.ManyToManyField(to=AKRequirement, blank=True, verbose_name=_('Properties'),
help_text=_('AK requirements fulfilled by the room')) help_text=_('AK requirements fulfilled by the room'))
......
...@@ -26,11 +26,13 @@ if apps.is_installed("AKScheduling"): ...@@ -26,11 +26,13 @@ if apps.is_installed("AKScheduling"):
api_router.register('scheduling-constraint-violations', ConstraintViolationsViewSet, api_router.register('scheduling-constraint-violations', ConstraintViolationsViewSet,
basename='scheduling-constraint-violations') basename='scheduling-constraint-violations')
extra_paths = [ extra_paths.append(path('api/scheduling-events/', EventsView.as_view(), name='scheduling-events'))
path('api/scheduling-events/', EventsView.as_view(), name='scheduling-events'), extra_paths.append(path('api/scheduling-room-availabilities/', RoomAvailabilitiesView.as_view(),
path('api/scheduling-room-availabilities/', RoomAvailabilitiesView.as_view(), name='scheduling-room-availabilities'))
name='scheduling-room-availabilities'), if apps.is_installed("AKSubmission"):
] from AKSubmission.api import increment_interest_counter
extra_paths.append(path('api/ak/<pk>/indicate-interest/', increment_interest_counter, name='submission-ak-indicate-interest'))
event_specific_paths = [ event_specific_paths = [
path('api/', include(api_router.urls), name='api'), path('api/', include(api_router.urls), name='api'),
......
...@@ -8,7 +8,7 @@ msgid "" ...@@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-04-29 22:48+0000\n" "POT-Creation-Date: 2021-10-29 09:57+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
...@@ -27,56 +27,56 @@ msgstr "Plan" ...@@ -27,56 +27,56 @@ msgstr "Plan"
msgid "Write to organizers of this event for questions and comments" msgid "Write to organizers of this event for questions and comments"
msgstr "Fragen oder Kommentare? Schreib den Orgas dieses Events eine Mail" msgstr "Fragen oder Kommentare? Schreib den Orgas dieses Events eine Mail"
#: AKPlan/templates/AKPlan/plan_index.html:31 #: AKPlan/templates/AKPlan/plan_index.html:32
msgid "Day" msgid "Day"
msgstr "Tag" msgstr "Tag"
#: AKPlan/templates/AKPlan/plan_index.html:41 #: AKPlan/templates/AKPlan/plan_index.html:42
msgid "Event" msgid "Event"
msgstr "Veranstaltung" msgstr "Veranstaltung"
#: AKPlan/templates/AKPlan/plan_index.html:53 #: AKPlan/templates/AKPlan/plan_index.html:55
#: AKPlan/templates/AKPlan/plan_room.html:13 #: AKPlan/templates/AKPlan/plan_room.html:13
#: AKPlan/templates/AKPlan/plan_room.html:59 #: AKPlan/templates/AKPlan/plan_room.html:59
#: AKPlan/templates/AKPlan/plan_wall.html:50 #: AKPlan/templates/AKPlan/plan_wall.html:52
msgid "Room" msgid "Room"
msgstr "Raum" msgstr "Raum"
#: AKPlan/templates/AKPlan/plan_index.html:74 #: AKPlan/templates/AKPlan/plan_index.html:76
#: AKPlan/templates/AKPlan/plan_room.html:11 #: AKPlan/templates/AKPlan/plan_room.html:11
#: AKPlan/templates/AKPlan/plan_track.html:9 #: AKPlan/templates/AKPlan/plan_track.html:9
msgid "AK Plan" msgid "AK Plan"
msgstr "AK-Plan" msgstr "AK-Plan"
#: AKPlan/templates/AKPlan/plan_index.html:86 #: AKPlan/templates/AKPlan/plan_index.html:88
#: AKPlan/templates/AKPlan/plan_room.html:49 #: AKPlan/templates/AKPlan/plan_room.html:49
msgid "Rooms" msgid "Rooms"
msgstr "Räume" msgstr "Räume"
#: AKPlan/templates/AKPlan/plan_index.html:99 #: AKPlan/templates/AKPlan/plan_index.html:101
#: AKPlan/templates/AKPlan/plan_track.html:36 #: AKPlan/templates/AKPlan/plan_track.html:36
msgid "Tracks" msgid "Tracks"
msgstr "Tracks" msgstr "Tracks"
#: AKPlan/templates/AKPlan/plan_index.html:111 #: AKPlan/templates/AKPlan/plan_index.html:113
msgid "AK Wall" msgid "AK Wall"
msgstr "AK-Wall" msgstr "AK-Wall"
#: AKPlan/templates/AKPlan/plan_index.html:124 #: AKPlan/templates/AKPlan/plan_index.html:126
#: AKPlan/templates/AKPlan/plan_wall.html:79 #: AKPlan/templates/AKPlan/plan_wall.html:81
msgid "Current AKs" msgid "Current AKs"
msgstr "Aktuelle AKs" msgstr "Aktuelle AKs"
#: AKPlan/templates/AKPlan/plan_index.html:131 #: AKPlan/templates/AKPlan/plan_index.html:133
#: AKPlan/templates/AKPlan/plan_wall.html:84 #: AKPlan/templates/AKPlan/plan_wall.html:86
msgid "Next AKs" msgid "Next AKs"
msgstr "Nächste AKs" msgstr "Nächste AKs"
#: AKPlan/templates/AKPlan/plan_index.html:139 #: AKPlan/templates/AKPlan/plan_index.html:141
msgid "This event is not active." msgid "This event is not active."
msgstr "Dieses Event ist nicht aktiv." msgstr "Dieses Event ist nicht aktiv."
#: AKPlan/templates/AKPlan/plan_index.html:152 #: AKPlan/templates/AKPlan/plan_index.html:154
#: AKPlan/templates/AKPlan/plan_room.html:77 #: AKPlan/templates/AKPlan/plan_room.html:77
#: AKPlan/templates/AKPlan/plan_track.html:58 #: AKPlan/templates/AKPlan/plan_track.html:58
msgid "Plan is not visible (yet)." msgid "Plan is not visible (yet)."
......
...@@ -8,7 +8,7 @@ msgid "" ...@@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-04-29 22:48+0000\n" "POT-Creation-Date: 2021-10-29 09:57+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
...@@ -17,10 +17,10 @@ msgstr "" ...@@ -17,10 +17,10 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
#: AKPlanning/settings.py:134 #: AKPlanning/settings.py:144
msgid "German" msgid "German"
msgstr "Deutsch" msgstr "Deutsch"
#: AKPlanning/settings.py:135 #: AKPlanning/settings.py:145
msgid "English" msgid "English"
msgstr "Englisch" msgstr "Englisch"
...@@ -13,10 +13,10 @@ Including another URLconf ...@@ -13,10 +13,10 @@ Including another URLconf
1. Import the include() function: from django.urls import include, path 1. Import the include() function: from django.urls import include, path
2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) 2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
""" """
import debug_toolbar
from django.apps import apps from django.apps import apps
from django.contrib import admin from django.contrib import admin
from django.urls import path, include from django.urls import path, include
import debug_toolbar
urlpatterns = [ urlpatterns = [
path('admin/', admin.site.urls), path('admin/', admin.site.urls),
......
...@@ -8,7 +8,7 @@ msgid "" ...@@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-10-28 20:45+0000\n" "POT-Creation-Date: 2021-10-29 09:57+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
...@@ -17,7 +17,7 @@ msgstr "" ...@@ -17,7 +17,7 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
#: AKScheduling/models.py:507 #: AKScheduling/models.py:80
#, python-format #, python-format
msgid "" msgid ""
"Not enough space for AK interest (Interest: %(interest)d, Capacity: " "Not enough space for AK interest (Interest: %(interest)d, Capacity: "
...@@ -26,7 +26,7 @@ msgstr "" ...@@ -26,7 +26,7 @@ msgstr ""
"Nicht genug Platz für AK-Interesse (Interesse: %(interest)d, Kapazität: " "Nicht genug Platz für AK-Interesse (Interesse: %(interest)d, Kapazität: "
"%(capacity)d)" "%(capacity)d)"
#: AKScheduling/models.py:519 #: AKScheduling/models.py:92
#, python-format #, python-format
msgid "" msgid ""
"Space is too close to AK interest (Interest: %(interest)d, Capacity: " "Space is too close to AK interest (Interest: %(interest)d, Capacity: "
......
from rest_framework import status
from rest_framework.decorators import api_view
from rest_framework.response import Response
from django.utils.datetime_safe import datetime
from AKModel.models import AK
def ak_interest_indication_active(event, current_timestamp):
"""
Check whether indication of interest is currently allowed for a given event
:param event: event to check for
:type event: Event
:param current_timestamp: current timestamp
:type current_timestamp: datetime
:return: True if indication is allowed, False if not
:rtype: Bool
"""
return event.active and (event.interest_start is None or (event.interest_start <= current_timestamp and (
event.interest_end is None or current_timestamp <= event.interest_end)))
@api_view(['POST'])
def increment_interest_counter(request, event_slug, pk, **kwargs):
"""
Increment interest counter for AK
"""
ak = AK.objects.get(pk=pk)
if ak:
# Check whether interest indication is currently allowed
current_timestamp = datetime.now().astimezone(ak.event.timezone)
if ak_interest_indication_active(ak.event, current_timestamp):
ak.interest_counter += 1
ak.save()
return Response({'interest_counter': ak.interest_counter}, status=status.HTTP_200_OK)
return Response(status=status.HTTP_403_FORBIDDEN)
return Response(status=status.HTTP_404_NOT_FOUND)
...@@ -8,7 +8,7 @@ msgid "" ...@@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-05-15 14:34+0000\n" "POT-Creation-Date: 2021-10-29 11:22+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
...@@ -38,30 +38,6 @@ msgstr "" ...@@ -38,30 +38,6 @@ msgstr ""
"Mindestens eine geplante Dauer (in Stunden) angeben. Wenn der AK mehrere " "Mindestens eine geplante Dauer (in Stunden) angeben. Wenn der AK mehrere "
"Slots haben soll, mehrere Zeilen verwenden" "Slots haben soll, mehrere Zeilen verwenden"
#: AKSubmission/templates/AKSubmission/ak_detail.html:11
#: AKSubmission/templates/AKSubmission/ak_edit.html:8
#: AKSubmission/templates/AKSubmission/ak_history.html:11
#: AKSubmission/templates/AKSubmission/ak_overview.html:8
#: AKSubmission/templates/AKSubmission/ak_overview.html:12
#: AKSubmission/templates/AKSubmission/ak_overview.html:38
#: AKSubmission/templates/AKSubmission/akmessage_add.html:7
#: AKSubmission/templates/AKSubmission/akowner_create_update.html:7
#: AKSubmission/templates/AKSubmission/akslot_add_update.html:7
#: AKSubmission/templates/AKSubmission/akslot_delete.html:7
#: AKSubmission/templates/AKSubmission/submission_not_configured.html:7
#: AKSubmission/templates/AKSubmission/submission_overview.html:7
#: AKSubmission/templates/AKSubmission/submission_overview.html:43
#: AKSubmission/templates/AKSubmission/submit_new.html:8
#: AKSubmission/templates/AKSubmission/submit_new_wish.html:7
msgid "AKs"
msgstr "AKs"
#: AKSubmission/templates/AKSubmission/ak_detail.html:11
#: AKSubmission/templates/AKSubmission/ak_history.html:11
#: AKSubmission/templates/AKSubmission/akslot_delete.html:31
msgid "AK"
msgstr "AK"
#: AKSubmission/templates/AKSubmission/ak_detail.html:22 #: AKSubmission/templates/AKSubmission/ak_detail.html:22
#: AKSubmission/templates/AKSubmission/ak_edit.html:13 #: AKSubmission/templates/AKSubmission/ak_edit.html:13
#: AKSubmission/templates/AKSubmission/ak_history.html:16 #: AKSubmission/templates/AKSubmission/ak_history.html:16
...@@ -80,51 +56,59 @@ msgstr "AK" ...@@ -80,51 +56,59 @@ msgstr "AK"
msgid "AK Submission" msgid "AK Submission"
msgstr "AK-Eintragung" msgstr "AK-Eintragung"
#: AKSubmission/templates/AKSubmission/ak_detail.html:37 #: AKSubmission/templates/AKSubmission/ak_detail.html:78
msgid "Interest indication currently not allowed. Sorry."
msgstr "Interessenangabe aktuell nicht erlaubt. Sorry."
#: AKSubmission/templates/AKSubmission/ak_detail.html:80
msgid "Could not save your interest. Sorry."
msgstr "Interesse konnte nicht gespeichert werden. Sorry."
#: AKSubmission/templates/AKSubmission/ak_detail.html:101
msgid "Interest" msgid "Interest"
msgstr "Interesse" msgstr "Interesse"
#: AKSubmission/templates/AKSubmission/ak_detail.html:40 #: AKSubmission/templates/AKSubmission/ak_detail.html:103
#: AKSubmission/templates/AKSubmission/ak_table.html:56 #: AKSubmission/templates/AKSubmission/ak_table.html:57
msgid "Show Interest" msgid "Show Interest"
msgstr "Interesse bekunden" msgstr "Interesse bekunden"
#: AKSubmission/templates/AKSubmission/ak_detail.html:46 #: AKSubmission/templates/AKSubmission/ak_detail.html:109
#: AKSubmission/templates/AKSubmission/ak_table.html:48 #: AKSubmission/templates/AKSubmission/ak_table.html:48
msgid "Open external link" msgid "Open external link"
msgstr "Externen Link öffnen" msgstr "Externen Link öffnen"
#: AKSubmission/templates/AKSubmission/ak_detail.html:51 #: AKSubmission/templates/AKSubmission/ak_detail.html:114
msgid "Open protocol link" msgid "Open protocol link"
msgstr "Protokolllink öffnen" msgstr "Protokolllink öffnen"
#: AKSubmission/templates/AKSubmission/ak_detail.html:56 #: AKSubmission/templates/AKSubmission/ak_detail.html:119
#: AKSubmission/templates/AKSubmission/ak_history.html:19 #: AKSubmission/templates/AKSubmission/ak_history.html:19
#: AKSubmission/templates/AKSubmission/ak_history.html:31 #: AKSubmission/templates/AKSubmission/ak_history.html:31
msgid "History" msgid "History"
msgstr "Versionsgeschichte" msgstr "Versionsgeschichte"
#: AKSubmission/templates/AKSubmission/ak_detail.html:59 #: AKSubmission/templates/AKSubmission/ak_detail.html:122
#: AKSubmission/templates/AKSubmission/akmessage_add.html:8 #: AKSubmission/templates/AKSubmission/akmessage_add.html:8
#: AKSubmission/templates/AKSubmission/akmessage_add.html:16 #: AKSubmission/templates/AKSubmission/akmessage_add.html:16
#: AKSubmission/templates/AKSubmission/akmessage_add.html:22 #: AKSubmission/templates/AKSubmission/akmessage_add.html:22
msgid "Add confidential message to organizers" msgid "Add confidential message to organizers"
msgstr "Sende eine private Nachricht an das Organisationsteam" msgstr "Sende eine private Nachricht an das Organisationsteam"
#: AKSubmission/templates/AKSubmission/ak_detail.html:62 #: AKSubmission/templates/AKSubmission/ak_detail.html:125
#: AKSubmission/templates/AKSubmission/ak_detail.html:213 #: AKSubmission/templates/AKSubmission/ak_detail.html:276
#: AKSubmission/templates/AKSubmission/ak_edit.html:16 #: AKSubmission/templates/AKSubmission/ak_edit.html:16
#: AKSubmission/templates/AKSubmission/ak_table.html:53 #: AKSubmission/templates/AKSubmission/ak_table.html:53
msgid "Edit" msgid "Edit"
msgstr "Bearbeiten" msgstr "Bearbeiten"
#: AKSubmission/templates/AKSubmission/ak_detail.html:67 #: AKSubmission/templates/AKSubmission/ak_detail.html:130
#: AKSubmission/templates/AKSubmission/ak_history.html:31 #: AKSubmission/templates/AKSubmission/ak_history.html:31
#: AKSubmission/templates/AKSubmission/ak_table.html:35 #: AKSubmission/templates/AKSubmission/ak_table.html:35
msgid "AK Wish" msgid "AK Wish"
msgstr "AK-Wunsch" msgstr "AK-Wunsch"
#: AKSubmission/templates/AKSubmission/ak_detail.html:74 #: AKSubmission/templates/AKSubmission/ak_detail.html:137
#, python-format #, python-format
msgid "" msgid ""
"\n" "\n"
...@@ -138,7 +122,7 @@ msgstr "" ...@@ -138,7 +122,7 @@ msgstr ""
"Minute(n) in %(room)s statt.&nbsp;\n" "Minute(n) in %(room)s statt.&nbsp;\n"
" " " "
#: AKSubmission/templates/AKSubmission/ak_detail.html:80 #: AKSubmission/templates/AKSubmission/ak_detail.html:143
#, python-format #, python-format
msgid "" msgid ""
"\n" "\n"
...@@ -151,104 +135,126 @@ msgstr "" ...@@ -151,104 +135,126 @@ msgstr ""
"Minute(n) in %(room)s.&nbsp;\n" "Minute(n) in %(room)s.&nbsp;\n"
" " " "
#: AKSubmission/templates/AKSubmission/ak_detail.html:87 #: AKSubmission/templates/AKSubmission/ak_detail.html:150
#: AKSubmission/templates/AKSubmission/ak_detail.html:221 #: AKSubmission/templates/AKSubmission/ak_detail.html:284
msgid "Go to virtual room" msgid "Go to virtual room"
msgstr "Zum virtuellen Raum" msgstr "Zum virtuellen Raum"
#: AKSubmission/templates/AKSubmission/ak_detail.html:96 #: AKSubmission/templates/AKSubmission/ak_detail.html:159
#: AKSubmission/templates/AKSubmission/ak_table.html:10 #: AKSubmission/templates/AKSubmission/ak_table.html:10
msgid "Who?" msgid "Who?"
msgstr "Wer?" msgstr "Wer?"
#: AKSubmission/templates/AKSubmission/ak_detail.html:102 #: AKSubmission/templates/AKSubmission/ak_detail.html:165
#: AKSubmission/templates/AKSubmission/ak_history.html:36 #: AKSubmission/templates/AKSubmission/ak_history.html:36
#: AKSubmission/templates/AKSubmission/ak_table.html:11 #: AKSubmission/templates/AKSubmission/ak_table.html:11
msgid "Category" msgid "Category"
msgstr "Kategorie" msgstr "Kategorie"
#: AKSubmission/templates/AKSubmission/ak_detail.html:109 #: AKSubmission/templates/AKSubmission/ak_detail.html:172
#: AKSubmission/templates/AKSubmission/ak_history.html:37 #: AKSubmission/templates/AKSubmission/ak_history.html:37
msgid "Track" msgid "Track"
msgstr "Track" msgstr "Track"
#: AKSubmission/templates/AKSubmission/ak_detail.html:115 #: AKSubmission/templates/AKSubmission/ak_detail.html:178
#, fuzzy #, fuzzy
#| msgid "Present results of this AK" #| msgid "Present results of this AK"
msgid "Present this AK" msgid "Present this AK"
msgstr "Die Ergebnisse dieses AKs vorstellen" msgstr "Die Ergebnisse dieses AKs vorstellen"
#: AKSubmission/templates/AKSubmission/ak_detail.html:120 #: AKSubmission/templates/AKSubmission/ak_detail.html:183
msgid "(Category Default)" msgid "(Category Default)"
msgstr "(Kategorievoreinstellung)" msgstr "(Kategorievoreinstellung)"
#: AKSubmission/templates/AKSubmission/ak_detail.html:126 #: AKSubmission/templates/AKSubmission/ak_detail.html:189
#: AKSubmission/templates/AKSubmission/ak_table.html:12 #: AKSubmission/templates/AKSubmission/ak_table.html:12
msgid "Tags" msgid "Tags"
msgstr "Tags" msgstr "Tags"
#: AKSubmission/templates/AKSubmission/ak_detail.html:132 #: AKSubmission/templates/AKSubmission/ak_detail.html:195
msgid "Reso intention?" msgid "Reso intention?"
msgstr "Resoabsicht?" msgstr "Resoabsicht?"
#: AKSubmission/templates/AKSubmission/ak_detail.html:139 #: AKSubmission/templates/AKSubmission/ak_detail.html:202
msgid "Requirements" msgid "Requirements"
msgstr "Anforderungen" msgstr "Anforderungen"
#: AKSubmission/templates/AKSubmission/ak_detail.html:152 #: AKSubmission/templates/AKSubmission/ak_detail.html:215
msgid "Conflicting AKs" msgid "Conflicting AKs"
msgstr "AK-Konflikte" msgstr "AK-Konflikte"
#: AKSubmission/templates/AKSubmission/ak_detail.html:160 #: AKSubmission/templates/AKSubmission/ak_detail.html:223
msgid "Prerequisite AKs" msgid "Prerequisite AKs"
msgstr "Vorausgesetzte AKs" msgstr "Vorausgesetzte AKs"
#: AKSubmission/templates/AKSubmission/ak_detail.html:168 #: AKSubmission/templates/AKSubmission/ak_detail.html:231
msgid "Notes" msgid "Notes"
msgstr "Notizen" msgstr "Notizen"
#: AKSubmission/templates/AKSubmission/ak_detail.html:181 #: AKSubmission/templates/AKSubmission/ak_detail.html:244
msgid "When?" msgid "When?"
msgstr "Wann?" msgstr "Wann?"
#: AKSubmission/templates/AKSubmission/ak_detail.html:183 #: AKSubmission/templates/AKSubmission/ak_detail.html:246
#: AKSubmission/templates/AKSubmission/akslot_delete.html:35 #: AKSubmission/templates/AKSubmission/akslot_delete.html:35
msgid "Duration" msgid "Duration"
msgstr "Dauer" msgstr "Dauer"
#: AKSubmission/templates/AKSubmission/ak_detail.html:185 #: AKSubmission/templates/AKSubmission/ak_detail.html:248
msgid "Room" msgid "Room"
msgstr "Raum" msgstr "Raum"
#: AKSubmission/templates/AKSubmission/ak_detail.html:216 #: AKSubmission/templates/AKSubmission/ak_detail.html:279
msgid "Delete" msgid "Delete"
msgstr "Löschen" msgstr "Löschen"
#: AKSubmission/templates/AKSubmission/ak_detail.html:227 #: AKSubmission/templates/AKSubmission/ak_detail.html:290
msgid "Schedule" msgid "Schedule"
msgstr "Schedule" msgstr "Schedule"
#: AKSubmission/templates/AKSubmission/ak_detail.html:239 #: AKSubmission/templates/AKSubmission/ak_detail.html:302
msgid "Add another slot" msgid "Add another slot"
msgstr "Einen neuen AK-Slot hinzufügen" msgstr "Einen neuen AK-Slot hinzufügen"
#: AKSubmission/templates/AKSubmission/ak_detail.html:249 #: AKSubmission/templates/AKSubmission/ak_detail.html:312
msgid "Possible Times" msgid "Possible Times"
msgstr "Mögliche Zeiten" msgstr "Mögliche Zeiten"
#: AKSubmission/templates/AKSubmission/ak_detail.html:253 #: AKSubmission/templates/AKSubmission/ak_detail.html:316
msgid "Start" msgid "Start"
msgstr "Start" msgstr "Start"
#: AKSubmission/templates/AKSubmission/ak_detail.html:254 #: AKSubmission/templates/AKSubmission/ak_detail.html:317
msgid "End" msgid "End"
msgstr "Ende" msgstr "Ende"
#: AKSubmission/templates/AKSubmission/ak_edit.html:8
#: AKSubmission/templates/AKSubmission/ak_history.html:11
#: AKSubmission/templates/AKSubmission/ak_overview.html:8
#: AKSubmission/templates/AKSubmission/ak_overview.html:12
#: AKSubmission/templates/AKSubmission/ak_overview.html:38
#: AKSubmission/templates/AKSubmission/akmessage_add.html:7
#: AKSubmission/templates/AKSubmission/akowner_create_update.html:7
#: AKSubmission/templates/AKSubmission/akslot_add_update.html:7
#: AKSubmission/templates/AKSubmission/akslot_delete.html:7
#: AKSubmission/templates/AKSubmission/submission_not_configured.html:7
#: AKSubmission/templates/AKSubmission/submission_overview.html:7
#: AKSubmission/templates/AKSubmission/submission_overview.html:43
#: AKSubmission/templates/AKSubmission/submit_new.html:8
#: AKSubmission/templates/AKSubmission/submit_new_wish.html:7
msgid "AKs"
msgstr "AKs"
#: AKSubmission/templates/AKSubmission/ak_edit.html:8 #: AKSubmission/templates/AKSubmission/ak_edit.html:8
#: AKSubmission/templates/AKSubmission/ak_edit.html:21 #: AKSubmission/templates/AKSubmission/ak_edit.html:21
msgid "Edit AK" msgid "Edit AK"
msgstr "AK bearbeiten" msgstr "AK bearbeiten"
#: AKSubmission/templates/AKSubmission/ak_history.html:11
#: AKSubmission/templates/AKSubmission/akslot_delete.html:31
msgid "AK"
msgstr "AK"
#: AKSubmission/templates/AKSubmission/ak_history.html:27 #: AKSubmission/templates/AKSubmission/ak_history.html:27
msgid "Back" msgid "Back"
msgstr "Zurück" msgstr "Zurück"
...@@ -272,7 +278,7 @@ msgstr "Die Ergebnisse dieses AKs vorstellen" ...@@ -272,7 +278,7 @@ msgstr "Die Ergebnisse dieses AKs vorstellen"
msgid "Intends to submit a resolution" msgid "Intends to submit a resolution"
msgstr "Beabsichtigt eine Resolution einzureichen" msgstr "Beabsichtigt eine Resolution einzureichen"
#: AKSubmission/templates/AKSubmission/ak_list.html:6 AKSubmission/views.py:39 #: AKSubmission/templates/AKSubmission/ak_list.html:6 AKSubmission/views.py:40
msgid "All AKs" msgid "All AKs"
msgstr "Alle AKs" msgstr "Alle AKs"
...@@ -292,7 +298,7 @@ msgstr "AK hinzufügen" ...@@ -292,7 +298,7 @@ msgstr "AK hinzufügen"
msgid "Details" msgid "Details"
msgstr "Details" msgstr "Details"
#: AKSubmission/templates/AKSubmission/ak_table.html:66 #: AKSubmission/templates/AKSubmission/ak_table.html:67
msgid "There are no AKs in this category yet" msgid "There are no AKs in this category yet"
msgstr "Es gibt noch keine AKs in dieser Kategorie" msgstr "Es gibt noch keine AKs in dieser Kategorie"
...@@ -398,65 +404,65 @@ msgstr "" ...@@ -398,65 +404,65 @@ msgstr ""
msgid "Submit" msgid "Submit"
msgstr "Eintragen" msgstr "Eintragen"
#: AKSubmission/views.py:70 #: AKSubmission/views.py:71
msgid "Wishes" msgid "Wishes"
msgstr "Wünsche" msgstr "Wünsche"
#: AKSubmission/views.py:70 #: AKSubmission/views.py:71
msgid "AKs one would like to have" msgid "AKs one would like to have"
msgstr "" msgstr ""
"AKs die sich gewünscht wurden, aber bei denen noch nicht klar ist, wer sie " "AKs die sich gewünscht wurden, aber bei denen noch nicht klar ist, wer sie "
"macht. Falls du dir das vorstellen kannst, trag dich einfach ein" "macht. Falls du dir das vorstellen kannst, trag dich einfach ein"
#: AKSubmission/views.py:86 #: AKSubmission/views.py:87
msgid "Currently planned AKs" msgid "Currently planned AKs"
msgstr "Aktuell geplante AKs" msgstr "Aktuell geplante AKs"
#: AKSubmission/views.py:184 #: AKSubmission/views.py:188
msgid "Event inactive. Cannot create or update." msgid "Event inactive. Cannot create or update."
msgstr "Event inaktiv. Hinzufügen/Bearbeiten nicht möglich." msgstr "Event inaktiv. Hinzufügen/Bearbeiten nicht möglich."
#: AKSubmission/views.py:200 #: AKSubmission/views.py:204
msgid "AK successfully created" msgid "AK successfully created"
msgstr "AK erfolgreich angelegt" msgstr "AK erfolgreich angelegt"
#: AKSubmission/views.py:258 #: AKSubmission/views.py:262
msgid "AK successfully updated" msgid "AK successfully updated"
msgstr "AK erfolgreich aktualisiert" msgstr "AK erfolgreich aktualisiert"
#: AKSubmission/views.py:289 #: AKSubmission/views.py:293
msgid "Interest saved" msgid "Interest saved"
msgstr "Interesse gespeichert" msgstr "Interesse gespeichert"
#: AKSubmission/views.py:348 #: AKSubmission/views.py:352
msgid "Person Info successfully updated" msgid "Person Info successfully updated"
msgstr "Personen-Info erfolgreich aktualisiert" msgstr "Personen-Info erfolgreich aktualisiert"
#: AKSubmission/views.py:368 #: AKSubmission/views.py:372
msgid "No user selected" msgid "No user selected"
msgstr "Keine Person ausgewählt" msgstr "Keine Person ausgewählt"
#: AKSubmission/views.py:394 #: AKSubmission/views.py:398
msgid "AK Slot successfully added" msgid "AK Slot successfully added"
msgstr "AK-Slot erfolgreich angelegt" msgstr "AK-Slot erfolgreich angelegt"
#: AKSubmission/views.py:408 #: AKSubmission/views.py:412
msgid "You cannot edit a slot that has already been scheduled" msgid "You cannot edit a slot that has already been scheduled"
msgstr "Bereits geplante AK-Slots können nicht mehr bearbeitet werden" msgstr "Bereits geplante AK-Slots können nicht mehr bearbeitet werden"
#: AKSubmission/views.py:418 #: AKSubmission/views.py:422
msgid "AK Slot successfully updated" msgid "AK Slot successfully updated"
msgstr "AK-Slot erfolgreich aktualisiert" msgstr "AK-Slot erfolgreich aktualisiert"
#: AKSubmission/views.py:431 #: AKSubmission/views.py:435
msgid "You cannot delete a slot that has already been scheduled" msgid "You cannot delete a slot that has already been scheduled"
msgstr "Bereits geplante AK-Slots können nicht mehr gelöscht werden" msgstr "Bereits geplante AK-Slots können nicht mehr gelöscht werden"
#: AKSubmission/views.py:441 #: AKSubmission/views.py:445
msgid "AK Slot successfully deleted" msgid "AK Slot successfully deleted"
msgstr "AK-Slot erfolgreich angelegt" msgstr "AK-Slot erfolgreich angelegt"
#: AKSubmission/views.py:462 #: AKSubmission/views.py:466
msgid "Message to organizers successfully saved" msgid "Message to organizers successfully saved"
msgstr "Nachricht an die Organisator*innen erfolgreich gespeichert" msgstr "Nachricht an die Organisator*innen erfolgreich gespeichert"
......
...@@ -26,6 +26,68 @@ ...@@ -26,6 +26,68 @@
{% if 'AKPlan'|check_app_installed %} {% if 'AKPlan'|check_app_installed %}
{% block imports %} {% block imports %}
{% include "AKPlan/plan_akslot.html" %} {% include "AKPlan/plan_akslot.html" %}
<script>
document.addEventListener('DOMContentLoaded', function () {
// CSRF Protection/Authentication
function getCookie(name) {
let cookieValue = null;
if (document.cookie && document.cookie !== '') {
const cookies = document.cookie.split(';');
for (let i = 0; i < cookies.length; i++) {
const cookie = cookies[i].trim();
// Does this cookie string begin with the name we want?
if (cookie.substring(0, name.length + 1) === (name + '=')) {
cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
break;
}
}
}
return cookieValue;
}
const csrftoken = getCookie('csrftoken');
function csrfSafeMethod(method) {
// these HTTP methods do not require CSRF protection
return (/^(GET|HEAD|OPTIONS|TRACE)$/.test(method));
}
$.ajaxSetup({
beforeSend: function (xhr, settings) {
if (!csrfSafeMethod(settings.type) && !this.crossDomain) {
xhr.setRequestHeader("X-CSRFToken", csrftoken);
}
}
});
function indicate_interest(ak_id, btn) {
$.ajax({
url: "{% url "model:AK-list" event_slug=event.slug %}" + ak_id + "/indicate-interest/",
type: 'POST',
data: {
},
success: function (response) {
btn.html('{% fa5_icon 'check' 'fas' %}');
btn.off('click');
$('#interest-counter').html(response.interest_counter);
},
error: function (response) {
if(response.status === 403)
alert("{% trans 'Interest indication currently not allowed. Sorry.' %}");
else
alert("{% trans 'Could not save your interest. Sorry.' %}");
}
});
}
// Update counter
$('#btn-indicate-interest').click(function () {
indicate_interest({{ ak.pk }}, $(this));
});
});
</script>
{% endblock %} {% endblock %}
{% endif %} {% endif %}
...@@ -34,11 +96,11 @@ ...@@ -34,11 +96,11 @@
<div class="text-right"> <div class="text-right">
{% if ak.interest_counter >= 0 %} {% if ak.interest_counter >= 0 %}
{% trans 'Interest' %}: <b class='mx-1 text-muted'>{{ ak.interest_counter }}</b> {% if ak.event.active and interest_indication_active %}
{% if ak.event.active %} {% trans 'Interest' %}: <b class='mx-1 text-muted' id="interest-counter">{{ ak.interest_counter }}</b>
<a href="{% url 'submit:inc_interest' event_slug=ak.event.slug pk=ak.pk %}" data-toggle="tooltip" <a href="#" data-toggle="tooltip"
title="{% trans 'Show Interest' %}" title="{% trans 'Show Interest' %}"
class="btn btn-primary">{% fa5_icon 'thumbs-up' 'fas' %}</a> class="btn btn-primary" id="btn-indicate-interest">{% fa5_icon 'thumbs-up' 'fas' %}</a>
{% endif %} {% endif %}
{% endif %} {% endif %}
{% if ak.link != "" %} {% if ak.link != "" %}
......
{% load i18n %}
{% load fontawesome_5 %}
<script>
document.addEventListener('DOMContentLoaded', function () {
// CSRF Protection/Authentication
function getCookie(name) {
let cookieValue = null;
if (document.cookie && document.cookie !== '') {
const cookies = document.cookie.split(';');
for (let i = 0; i < cookies.length; i++) {
const cookie = cookies[i].trim();
// Does this cookie string begin with the name we want?
if (cookie.substring(0, name.length + 1) === (name + '=')) {
cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
break;
}
}
}
return cookieValue;
}
const csrftoken = getCookie('csrftoken');
function csrfSafeMethod(method) {
// these HTTP methods do not require CSRF protection
return (/^(GET|HEAD|OPTIONS|TRACE)$/.test(method));
}
$.ajaxSetup({
beforeSend: function (xhr, settings) {
if (!csrfSafeMethod(settings.type) && !this.crossDomain) {
xhr.setRequestHeader("X-CSRFToken", csrftoken);
}
}
});
function indicate_interest(ak_id, btn) {
$.ajax({
url: "{% url "model:AK-list" event_slug=event.slug %}" + ak_id + "/indicate-interest/",
type: 'POST',
data: {
},
success: function (response) {
btn.html('{% fa5_icon 'check' 'fas' %}');
btn.off('click');
},
error: function (response) {
if(response.status === 403)
alert("{% trans 'Interest indication currently not allowed. Sorry.' %}");
else
alert("{% trans 'Could not save your interest. Sorry.' %}");
}
});
}
// Update counter
$('.btn-interest').click(function () {
indicate_interest($(this).data('ak_id'), $(this));
});
});
</script>
...@@ -19,6 +19,8 @@ ...@@ -19,6 +19,8 @@
white-space: nowrap; white-space: nowrap;
} }
</style> </style>
{% include "AKSubmission/ak_interest_script.html" %}
{% endblock %} {% endblock %}
{% block breadcrumbs %} {% block breadcrumbs %}
......
...@@ -52,9 +52,11 @@ ...@@ -52,9 +52,11 @@
<a href="{% url 'submit:ak_edit' event_slug=event.slug pk=ak.pk %}" data-toggle="tooltip" <a href="{% url 'submit:ak_edit' event_slug=event.slug pk=ak.pk %}" data-toggle="tooltip"
title="{% trans 'Edit' %}" title="{% trans 'Edit' %}"
class="btn btn-success">{% fa5_icon 'pencil-alt' 'fas' %}</a> class="btn btn-success">{% fa5_icon 'pencil-alt' 'fas' %}</a>
<a href="{% url 'submit:overview_inc_interest' event_slug=event.slug pk=ak.pk %}" data-toggle="tooltip" {% if interest_indication_active %}
title="{% trans 'Show Interest' %}" <span data-ak_id="{{ ak.pk }}" data-toggle="tooltip"
class="btn btn-primary">{% fa5_icon 'thumbs-up' 'fas' %}</a> title="{% trans 'Show Interest' %}"
class="btn btn-primary btn-interest" style="cursor: pointer">{% fa5_icon 'thumbs-up' 'fas' %}</span>
{% endif %}
{% endif %} {% endif %}
</td> </td>
</tr> </tr>
......
...@@ -28,6 +28,8 @@ ...@@ -28,6 +28,8 @@
} }
</style> </style>
{% include "AKSubmission/ak_interest_script.html" %}
{% if event.active %} {% if event.active %}
<link href="{% static 'common/vendor/select2/select2.min.css' %}" rel="stylesheet" /> <link href="{% static 'common/vendor/select2/select2.min.css' %}" rel="stylesheet" />
<script src="{% static 'common/vendor/select2/select2.min.js' %}"></script> <script src="{% static 'common/vendor/select2/select2.min.js' %}"></script>
......
...@@ -12,8 +12,6 @@ urlpatterns = [ ...@@ -12,8 +12,6 @@ urlpatterns = [
path('ak/<int:pk>/', views.AKDetailView.as_view(), name='ak_detail'), path('ak/<int:pk>/', views.AKDetailView.as_view(), name='ak_detail'),
path('ak/<int:pk>/history/', views.AKHistoryView.as_view(), name='ak_history'), path('ak/<int:pk>/history/', views.AKHistoryView.as_view(), name='ak_history'),
path('ak/<int:pk>/edit/', views.AKEditView.as_view(), name='ak_edit'), path('ak/<int:pk>/edit/', views.AKEditView.as_view(), name='ak_edit'),
path('ak/<int:pk>/interest/', views.AKInterestView.as_view(), name='inc_interest'),
path('ak/<int:pk>/overview_interest/', views.AKOverviewInterestView.as_view(), name='overview_inc_interest'),
path('ak/<int:pk>/add_slot/', views.AKSlotAddView.as_view(), name='akslot_add'), path('ak/<int:pk>/add_slot/', views.AKSlotAddView.as_view(), name='akslot_add'),
path('ak/<int:pk>/add_message/', views.AKAddOrgaMessageView.as_view(), name='akmessage_add'), path('ak/<int:pk>/add_message/', views.AKAddOrgaMessageView.as_view(), name='akmessage_add'),
path('akslot/<int:pk>/edit/', views.AKSlotEditView.as_view(), name='akslot_edit'), path('akslot/<int:pk>/edit/', views.AKSlotEditView.as_view(), name='akslot_edit'),
......
...@@ -10,12 +10,13 @@ from django.urls import reverse_lazy ...@@ -10,12 +10,13 @@ from django.urls import reverse_lazy
from django.utils.datetime_safe import datetime from django.utils.datetime_safe import datetime
from django.utils.translation import gettext_lazy as _ from django.utils.translation import gettext_lazy as _
from django.views import View from django.views import View
from django.views.generic import ListView, DetailView, CreateView, UpdateView, DeleteView, RedirectView, TemplateView from django.views.generic import ListView, DetailView, CreateView, UpdateView, DeleteView, TemplateView
from AKModel.availability.models import Availability from AKModel.availability.models import Availability
from AKModel.models import AK, AKCategory, AKTag, AKOwner, AKSlot, AKTrack, AKOrgaMessage from AKModel.models import AK, AKCategory, AKTag, AKOwner, AKSlot, AKTrack, AKOrgaMessage
from AKModel.views import EventSlugMixin from AKModel.views import EventSlugMixin
from AKModel.views import FilterByEventSlugMixin from AKModel.views import FilterByEventSlugMixin
from AKSubmission.api import ak_interest_indication_active
from AKSubmission.forms import AKWishForm, AKOwnerForm, AKEditForm, AKSubmissionForm, AKDurationForm, AKOrgaMessageForm from AKSubmission.forms import AKWishForm, AKOwnerForm, AKEditForm, AKSubmissionForm, AKDurationForm, AKOrgaMessageForm
...@@ -73,6 +74,10 @@ class AKOverviewView(FilterByEventSlugMixin, ListView): ...@@ -73,6 +74,10 @@ class AKOverviewView(FilterByEventSlugMixin, ListView):
context["active_category"] = self.get_active_category_name(context) context["active_category"] = self.get_active_category_name(context)
context['table_title'] = self.get_table_title(context) context['table_title'] = self.get_table_title(context)
# Display interest indication button?
current_timestamp = datetime.now().astimezone(self.event.timezone)
context['interest_indication_active'] = ak_interest_indication_active(self.event, current_timestamp)
return context return context
...@@ -136,10 +141,11 @@ class AKDetailView(EventSlugMixin, DetailView): ...@@ -136,10 +141,11 @@ class AKDetailView(EventSlugMixin, DetailView):
context = super().get_context_data(object_list=object_list, **kwargs) context = super().get_context_data(object_list=object_list, **kwargs)
context["availabilities"] = Availability.objects.filter(ak=context["ak"]) context["availabilities"] = Availability.objects.filter(ak=context["ak"])
current_timestamp = datetime.now().astimezone(self.event.timezone)
# Is this AK taking place now or soon (used for top page visualization) # Is this AK taking place now or soon (used for top page visualization)
context["featured_slot_type"] = "NONE" context["featured_slot_type"] = "NONE"
if apps.is_installed("AKPlan"): if apps.is_installed("AKPlan"):
current_timestamp = datetime.now().astimezone(self.event.timezone)
in_two_hours = current_timestamp + timedelta(hours=2) in_two_hours = current_timestamp + timedelta(hours=2)
slots = context["ak"].akslot_set.filter(start__isnull=False, room__isnull=False) slots = context["ak"].akslot_set.filter(start__isnull=False, room__isnull=False)
for slot in slots: for slot in slots:
...@@ -157,6 +163,9 @@ class AKDetailView(EventSlugMixin, DetailView): ...@@ -157,6 +163,9 @@ class AKDetailView(EventSlugMixin, DetailView):
context["featured_slot_remaining"] = floor(remaining.days * 24 * 60 + remaining.seconds / 60) context["featured_slot_remaining"] = floor(remaining.days * 24 * 60 + remaining.seconds / 60)
break break
# Display interest indication button?
context['interest_indication_active'] = ak_interest_indication_active(self.event, current_timestamp)
return context return context
...@@ -277,29 +286,6 @@ class AKEditView(EventSlugMixin, EventInactiveRedirectMixin, UpdateView): ...@@ -277,29 +286,6 @@ class AKEditView(EventSlugMixin, EventInactiveRedirectMixin, UpdateView):
return super_form_valid return super_form_valid
class AKInterestView(RedirectView):
permanent = False
pattern_name = 'submit:ak_detail'
def get(self, request, *args, **kwargs):
# Increase interest counter for given AK
ak = get_object_or_404(AK, pk=kwargs['pk'])
if ak.event.active:
ak.increment_interest()
messages.add_message(self.request, messages.SUCCESS, _("Interest saved"))
return super().get(request, *args, **kwargs)
# when the interest increase request comes from the AK overview page, redirect to that instead of the AK overview page
class AKOverviewInterestView(AKInterestView):
pattern_name = 'submit:submission_overview'
def get_redirect_url(self, *args, **kwargs):
# No PK needed for overview page of all AKs
del kwargs['pk']
return super().get_redirect_url(*args, **kwargs)
class AKOwnerCreateView(EventSlugMixin, EventInactiveRedirectMixin, CreateView): class AKOwnerCreateView(EventSlugMixin, EventInactiveRedirectMixin, CreateView):
model = AKOwner model = AKOwner
template_name = 'AKSubmission/akowner_create_update.html' template_name = 'AKSubmission/akowner_create_update.html'
......
...@@ -8,7 +8,7 @@ msgid "" ...@@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-04-29 22:48+0000\n" "POT-Creation-Date: 2021-10-29 09:57+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment