Skip to content
Open
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
7 changes: 5 additions & 2 deletions src/ephios/core/forms/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,11 @@ class EventForm(forms.ModelForm):

class Meta:
model = Event
fields = ["title", "type", "description", "location"]
widgets = {"description": MarkdownTextarea}
fields = ["title", "type", "description", "location", "planner_note"]
widgets = {
"description": MarkdownTextarea,
"planner_note": forms.Textarea(attrs={"rows": 2}),
}

def __init__(self, **kwargs):
user = kwargs.pop("user")
Expand Down
22 changes: 22 additions & 0 deletions src/ephios/core/migrations/0040_event_planner_note.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Generated by Django 5.2.12 on 2026-04-25 17:37

from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
("core", "0039_alter_userprofile_disabled_notifications"),
]

operations = [
migrations.AddField(
model_name="event",
name="planner_note",
field=models.TextField(
blank=True,
help_text="Note only visible to responsibles of this event.",
null=True,
verbose_name="planner note",
),
),
]
6 changes: 6 additions & 0 deletions src/ephios/core/models/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,12 @@ class Event(Model):
description = TextField(_("description"), blank=True, null=True)
location = CharField(_("location"), max_length=254)
type = ForeignKey(EventType, on_delete=models.CASCADE, verbose_name=_("event type"))
planner_note = models.TextField(
_("Planner note"),
blank=True,
null=True,
help_text=_("Note only visible to responsibles of this event."),
)
active = BooleanField(default=False, verbose_name=_("active"))
group_object_permission_set = GenericRelation(
GroupObjectPermission, object_id_field="object_pk"
Expand Down
4 changes: 3 additions & 1 deletion src/ephios/core/signup/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,9 @@ def _process_signup_action(self, participation, signup_data, validator):
messages.error(self.request, error_message.format(error=error))
raise # must reraise for transaction rollback
messages.success(self.request, success_message.format(shift=self.shift))
return redirect(self.participant.reverse_event_detail(self.shift.event))
return redirect(
self.participant.reverse_event_detail(self.shift.event) + f"#shift-{self.shift.pk}"
)

def _send_signup_save_signal(self, participation, signup_data):
signup_save.send(
Expand Down
2 changes: 1 addition & 1 deletion src/ephios/core/templates/core/event_detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ <h1 class="card-title fw-bold fs-1">
{% endif %}
{{ event.title }}
</h1>
<h5 class="card-subtitle mb-2 text-body-secondary fw-bolder lh-base">
<h5 class="cartended to give ad-subtitle mb-2 text-body-secondary fw-bolder lh-base">
<span class="me-1 badge badge-eventtype eventtype-{{ event.type.pk }}-color">{{ event.type }}</span>
<span class="text-body-secondary me-1 d-inline-block">
<i class="fas fa-map-marker-alt"></i>
Expand Down
143 changes: 99 additions & 44 deletions src/ephios/core/templates/core/event_form.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{% extends "base.html" %}
{% load rich_text %}
{% load utils %}
{% load logentries %}
{% load bootstrap %}
{% load crispy_forms_filters %}
Expand All @@ -21,53 +23,106 @@
{% render_alert unsaved_message|add:" ("|add:event.title|add:"). <a class='btn btn-light' href='"|add:event.get_absolute_url|add:"'>"|add:view_message|add:"</a>"|safe %}
{% endfor %}
{% endif %}
<div class="page-header">
{% if event.id %}
<h1>{% translate "Edit event" %}</h1>
{% else %}
<h1>
{% blocktranslate trimmed with title=eventtype.title %}
Create new {{ title }}
{% endblocktranslate %}
</h1>
{% endif %}
</div>
<form method="post" class="form">
{% csrf_token %}
{{ form.title|as_crispy_field }}
{% if form.type %}
{{ form.type|as_crispy_field }}
{% endif %}
{{ form.description|as_crispy_field }}
{{ form.location|as_crispy_field }}

<div class="card mb-3">
<div class="card-header collapsed" data-bs-toggle="collapse" data-bs-target="#advancedSettings">
<a href="#">{% translate "Permissions" %}</a>
<div class="row">
<div class="col">
<div class="page-header">
{% if event.id %}
<h1>{% translate "Edit event" %}</h1>
{% else %}
<h1>
{% blocktranslate trimmed with title=eventtype.title %}
Create new {{ title }}
{% endblocktranslate %}
</h1>
{% endif %}
</div>
<div id="advancedSettings" class="collapse">
<div class="card-body">
{{ form.visible_for|as_crispy_field }}
{{ form.responsible_groups|as_crispy_field }}
{{ form.responsible_users|as_crispy_field }}
<form method="post" class="form">
{% csrf_token %}
{{ form.title|as_crispy_field }}
{% if form.type %}
{{ form.type|as_crispy_field }}
{% endif %}
{{ form.location|as_crispy_field }}

<div class="card card-collapsed-with-hint mb-3">
<div class="card-header" data-bs-toggle="collapse" data-bs-target="#fields-texts">
<a href="#">
<i class="fas fa-pen me-1"></i>
{% translate "Texts" %}
</a>
</div>
<div class="card-body hint-to-hide text-muted row">
<div class="col-12{% if form.planner_note.initial %} col-lg-8{% endif %}">
{{ form.description.initial|rich_text|truncatechars_html:100 }}
</div>
{% if form.planner_note.initial %}
<div class="col-12 col-lg-4">
<strong>{% translate "Planner note" %}</strong><br/>
{{ form.planner_note.initial|truncatechars:50 }}
</div>
{% endif %}
</div>
<div id="fields-texts" class="collapse card-body">
{{ form.description|as_crispy_field }}
{{ form.planner_note|as_crispy_field }}
</div>
</div>
</div>
</div>

{% for plugin_form in plugin_forms %}
{{ plugin_form }}
{% endfor %}
<div class="card card-collapsed-with-hint mb-3">
<div class="card-header" data-bs-toggle="collapse" data-bs-target="#fields-perms">
<a class="hide-link" href="#">
<i class="fas fa-pen me-1"></i>
{% translate "Permissions" %}
</a>
</div>
<div class="card-body hint-to-hide text-muted">
{% translate "Visible for " %}
{{ form.visible_for.initial|join:", " }}
<br/>
{% translate 'Responsible' %}:
{{ form.responsible_groups.initial|chain:form.responsible_users.initial|join:", " }}
</div>
<div id="fields-perms" class="collapse card-body">
{{ form.visible_for|as_crispy_field }}
{{ form.responsible_groups|as_crispy_field }}
{{ form.responsible_users|as_crispy_field }}
</div>
</div>

{% for plugin_form in plugin_forms %}
{{ plugin_form }}
{% endfor %}

<div class="form-group">
{% if event.id %}
<a role="button" class="btn btn-secondary"
href="{{ event.get_absolute_url }}">{% translate "Back" %}</a>
<button type="submit" class="btn btn-primary float-end">{% translate "Save" %}</button>
{% else %}
<a role="button" class="btn btn-secondary"
href="{% url "core:event_list" %}">{% translate "Cancel" %}</a>
<button type="submit" class="btn btn-primary float-end">{% translate "Next" %}</button>
{% endif %}
<div class="form-group mt-3">
{% if event.id %}
<a role="button" class="btn btn-secondary"
href="{{ event.get_absolute_url }}">{% translate "Back" %}</a>
<button type="submit" class="btn btn-primary float-end">{% translate "Save" %}</button>
{% else %}
<a role="button" class="btn btn-secondary"
href="{% url "core:event_list" %}">{% translate "Cancel" %}</a>
<button type="submit" class="btn btn-primary float-end">{% translate "Next" %}</button>
{% endif %}
</div>
</form>
</div>
</form>
{% if event.id %}
<div class="d-none d-lg-block col-3">
<div class="card mb-2 border-info">
<div class="card-body">
<h5 class="card-title">
{{ event.title }}
</h5>
<p class="card-text">
{% translate "Event type" %}: {{ event.type }}<br>
{% translate "Location" %}: {{ event.location }}
</p>
</div>
</div>
{% for shift in event.shifts.all %}
{% include "core/fragments/shift_box_small.html" with shift=shift editing_shift=None can_change=True %}
{% endfor %}
</div>
{% endif %}
</div>
{% endblock %}
102 changes: 54 additions & 48 deletions src/ephios/core/templates/core/fragments/shift_box_big.html
Original file line number Diff line number Diff line change
Expand Up @@ -68,57 +68,63 @@

<div class="card-footer no-print">
{% with can_sign_up=request|can_sign_up:shift can_decline=request|can_decline:shift can_customize_signup=request|can_customize_signup:shift %}
<div class="row gy-1">
{% if can_sign_up or can_decline or can_customize_signup %}
<div class="col-auto order-1">
<form method="POST" class="form" id="signup-form-{{ shift.pk }}"
action="{{ request|reverse_signup_action:shift }}">
{% csrf_token %}
{# Sentinel value to bypass signup form #}
<input type="hidden" name="quick_action" value="1">
{% if can_sign_up and can_customize_signup %}
<div class="btn-group">
<button type="submit" name="signup_choice" value="sign_up"
class="btn btn-success">{{ shift.signup_flow.registration_button_text }}</button>
<a class="btn btn-success" href="{{ request|reverse_signup_action:shift }}">
<i class="fas fa-cog"></i>
<span class="visually-hidden">{% translate "Customize" %}</span>
</a>
</div>
{% elif can_sign_up and not can_customize_signup %}
<form method="POST" class="form" id="signup-form-{{ shift.pk }}"
action="{{ request|reverse_signup_action:shift }}">
<div class="row g-1 mb-1">
{% csrf_token %}
{# Sentinel value to bypass signup form #}
<input type="hidden" name="quick_action" value="1">
<div class="col-6 order-1">
{% if can_sign_up and can_customize_signup %}
<div class="btn-group w-100">
<button type="submit" name="signup_choice" value="sign_up"
class="btn btn-success">{{ shift.signup_flow.registration_button_text }}</button>
{% elif not can_sign_up and can_customize_signup %}
<a class="btn btn-secondary"
href="{{ request|reverse_signup_action:shift }}">{% translate "Customize" %}</a>
{% endif %}
{% if can_decline %}
<span class="d-inline-block" tabindex="1">
<button type="submit" name="signup_choice" value="decline"
class="btn btn-secondary">
{% translate "Decline" %}
</button>
</span>
{% endif %}
</form>
class="btn btn-success w-100">{{ shift.signup_flow.registration_button_text }}</button>
<a class="btn btn-success" href="{{ request|reverse_signup_action:shift }}">
<i class="fas fa-cog"></i>
<span class="visually-hidden">{% translate "Customize" %}</span>
</a>
</div>
{% elif can_sign_up and not can_customize_signup %}
<button type="submit" name="signup_choice" value="sign_up"
class="btn btn-success w-100">{{ shift.signup_flow.registration_button_text }}</button>
{% elif not can_sign_up and can_customize_signup %}
<a class="btn btn-secondary w-100"
href="{{ request|reverse_signup_action:shift }}">{% translate "Customize" %}</a>
{% else %}
<button type="submit" name="signup_choice" value="sign_up"
class="btn btn-outline-secondary w-100 disabled">{{ shift.signup_flow.registration_button_text }}</button>
{% endif %}
</div>
<div class="col-6 order-2">
<button type="submit" name="signup_choice" value="decline"
class="btn w-100 {% if can_decline %}btn-secondary{% else %}btn-outline-secondary disabled{% endif %}">
{% translate "Decline" %}
</button>
</div>
{% endif %}

<div class="col-auto ms-auto order-3">
<span class="float-end">
{% if can_change_event %}
{% shift_plugin_actions shift request as plugin_actions %}
{% for plugin_action in plugin_actions %}
{% if can_change_event %}
{% shift_plugin_actions shift request as plugin_actions %}
{% for plugin_action in plugin_actions %}
<div class="col-6 {% if forloop.first %}order-3{% else %}order-5{% endif %}">
<a href="{{ plugin_action.url }}"
class="btn btn-outline-info">{{ plugin_action.label }}</a>
{% endfor %}
{% endif %}

{% if disposition_url %}
class="btn btn-outline-info w-100">
<span class="text-body">
{{ plugin_action.label }}
</span>
</a>
</div>
{% empty %}
<div class="col-6 order-3">
{# placeholder #}
</div>
{% endfor %}
{% endif %}
{% if disposition_url %}
<div class="col-6 order-4">
<a href="{{ disposition_url }}"
class="btn btn-info">{% translate "Disposition" %}</a>
{% endif %}
</span>
class="btn btn-info w-100">{% translate "Disposition" %}</a>
</div>
{% 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 %}">
Expand All @@ -139,7 +145,7 @@
{% endif %}
</div>
</div>
</div>
</form>
{% endwith %}
</div>
</div>
</div>
Loading
Loading