Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Link participants to coupled shift #1448

Merged
merged 1 commit into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading