From 26b59bf1acec0573ba7a910c1ebbd3fe2c174849 Mon Sep 17 00:00:00 2001 From: Felix Rindt Date: Thu, 12 Dec 2024 17:21:47 +0100 Subject: [PATCH] link coupled shift --- .../core/fragments/shift_box_big.html | 33 ++++++++++--------- .../plugins/basesignupflows/flow/coupled.py | 14 ++++++-- 2 files changed, 30 insertions(+), 17 deletions(-) diff --git a/ephios/core/templates/core/fragments/shift_box_big.html b/ephios/core/templates/core/fragments/shift_box_big.html index 1c49faca1..88e682fe7 100644 --- a/ephios/core/templates/core/fragments/shift_box_big.html +++ b/ephios/core/templates/core/fragments/shift_box_big.html @@ -88,21 +88,24 @@ {% endif %} -
- {% if can_sign_up and shift.signup_flow.configuration.signup_until %} - - {% translate "Signup ends" %} - {{ shift.signup_flow.configuration.signup_until | naturaltime }}. - - {% endif %} - {% if not can_sign_up or not can_decline %} - - {% for error in request|signup_action_errors:shift %} - {{ error.message }} - {% endfor %} - - {% endif %}
+
+
+ {% if can_sign_up and shift.signup_flow.configuration.signup_until %} + + {% translate "Signup ends" %} + {{ shift.signup_flow.configuration.signup_until | naturaltime }}. + + {% endif %} + {% if not can_sign_up or not can_decline %} + + {% for error in request|signup_action_errors:shift %} + {{ error.message }} + {% endfor %} + + {% endif %} +
+
{% endwith %} diff --git a/ephios/plugins/basesignupflows/flow/coupled.py b/ephios/plugins/basesignupflows/flow/coupled.py index b956648ca..5524105eb 100644 --- a/ephios/plugins/basesignupflows/flow/coupled.py +++ b/ephios/plugins/basesignupflows/flow/coupled.py @@ -18,9 +18,19 @@ class CoupledSignupActionValidator(NoSignupSignupActionValidator): def get_no_signup_allowed_message(self): - if self.shift.signup_flow.leader_shift: + leader_shift = self.shift.signup_flow.leader_shift + if leader_shift: + shift_name = leader_shift.get_datetime_display() + if leader_shift.label: + shift_name = f"{leader_shift.label} ({shift_name})" return ActionDisallowedError( - _("Participation is coupled to {}.").format(self.shift.signup_flow.leader_shift) + mark_safe( + _("Participation is coupled to {}.").format( + f'' + f"{shift_name}" + ) + ) ) # This is red as it requires responsibles to update the shift configuration. text = _("Participation is coupled to another shift, but the leading shift is missing.")