Skip to content

Commit

Permalink
link coupled shift
Browse files Browse the repository at this point in the history
  • Loading branch information
felixrindt committed Dec 12, 2024
1 parent 27e68cc commit 26b59bf
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 17 deletions.
33 changes: 18 additions & 15 deletions ephios/core/templates/core/fragments/shift_box_big.html
Original file line number Diff line number Diff line change
Expand Up @@ -88,21 +88,24 @@
</div>
{% endif %}

<div class="col-12 order-4{% if not can_sign_up and not can_decline and not can_customize_signup or not disposition_url %} col-md order-md-2{% endif %}">
{% if can_sign_up and shift.signup_flow.configuration.signup_until %}
<span class="text-success" data-bs-toggle="tooltip" data-bs-placement="top"
title="{{ shift.signup_flow.configuration.signup_until|date:'SHORT_DATETIME_FORMAT' }}">
{% translate "Signup ends" %}
{{ shift.signup_flow.configuration.signup_until | naturaltime }}.
</span>
{% endif %}
{% if not can_sign_up or not can_decline %}
<span class="text-body-secondary">
{% for error in request|signup_action_errors:shift %}
<span>{{ error.message }}</span>
{% endfor %}
</span>
{% endif %}</div>
<div class="d-flex align-items-center col-12 order-4{% if not can_sign_up and not can_decline and not can_customize_signup or not disposition_url %} col-md order-md-2{% endif %}">
<div>
{% if can_sign_up and shift.signup_flow.configuration.signup_until %}
<span class="text-success" data-bs-toggle="tooltip" data-bs-placement="top"
title="{{ shift.signup_flow.configuration.signup_until|date:'SHORT_DATETIME_FORMAT' }}">
{% translate "Signup ends" %}
{{ shift.signup_flow.configuration.signup_until | naturaltime }}.
</span>
{% endif %}
{% if not can_sign_up or not can_decline %}
<span class="text-body-secondary">
{% for error in request|signup_action_errors:shift %}
{{ error.message }}
{% endfor %}
</span>
{% endif %}
</div>
</div>
</div>
{% endwith %}
</div>
Expand Down
14 changes: 12 additions & 2 deletions ephios/plugins/basesignupflows/flow/coupled.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'<a class="link-primary link-underline-opacity-25" '
f'href="#shift-{leader_shift.pk}">'
f"{shift_name}</a>"
)
)
)
# 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.")
Expand Down

0 comments on commit 26b59bf

Please sign in to comment.