Skip to content

Commit

Permalink
Merge pull request #253 from HungNgien/sync-upstream-dec-24th
Browse files Browse the repository at this point in the history
Sync upstream dec 24th
  • Loading branch information
mariobehling authored Dec 25, 2024
2 parents 80a0676 + 445f34a commit bc1cc16
Show file tree
Hide file tree
Showing 54 changed files with 2,209 additions and 1,154 deletions.
1 change: 0 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ jobs:
python -m pytest \
-nauto -p no:sugar \
--junitxml=pytest.xml \
--reruns 3 \
--cov-report=term-missing:skip-covered \
tests | tee pytest-coverage.txt
env:
Expand Down
2 changes: 2 additions & 0 deletions doc/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
Release Notes
=============

- :feature:`schedule` Organisers can now configure additional links to show in the top menu next to "Schedule", "Sessions", "Speakers", handy for links back to the conference website, streams, etc.
- :feature:`orga` Organisers can now configure footer links that will be shown on all schedule pages.
- :feature:`cfp` pretalx will now send an email after a user changes their password, notifying them of the change.
- :feature:`orga,1302` Organisers can now customise the template used to inform speakers when they are added to a proposal by an organiser. There are two new templates – one for speakers with an existing account, and one for speakers without account who need to set their password.
- :feature:`orga,1311` Organisers can now customise the “New proposal” notification email contents.
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ dependencies = [
"django-formset-js-improved==0.5.0.3",
"django-formtools~=2.5.1",
"django-hierarkey~=1.2.0",
"django-i18nfield~=1.9.0",
"django-i18nfield>=1.9,<1.11",
"django-libsass~=0.8",
"django-scopes~=2.0.0",
"django-pdb~=0.6.2",
Expand All @@ -55,6 +55,7 @@ dependencies = [
"reportlab~=4.2.0",
"requests~=2.32.0",
"rules~=3.5.0",
"setuptools",
"urlman~=2.0.1",
"vobject~=0.9.0",
"whitenoise~=6.8.0",
Expand Down Expand Up @@ -88,7 +89,6 @@ dev = [
"pytest-cov",
"pytest-django",
"pytest-mock",
"pytest-rerunfailures",
"pytest-sugar",
"pytest-xdist",
"pywatchman",
Expand Down
7 changes: 7 additions & 0 deletions src/pretalx/agenda/templates/agenda/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
{% load event_tags %}
{% load i18n %}
{% load rules %}
{% load safelink %}

{% block custom_header %}
{% block alternate_link %}
<link rel="alternate" type="application/atom+xml" title="{{ request.event.name }} Schedule Versions" href="{{ request.event.urls.feed }}" />
Expand Down Expand Up @@ -31,6 +33,11 @@
<a href="{{ request.event.urls.speakers }}" class='header-tab {% if "/speaker/" in request.path_info %} active{% endif %}'>
<i class="fa fa-group"></i> {{ phrases.schedule.speakers }}
</a>
{% for link in header_links %}
<a href="{% safelink link.url %}" target="_blank" rel="noopener" class="header-tab">
<i class="fa fa-link"></i> {{ link.label }}
</a>
{% endfor %}
{% if request.event.display_settings.ticket_link %}
<a href="{{ request.event.display_settings.ticket_link }}" class="header-tab">
<i class="fa fa-ticket"></i> {% translate "Tickets" %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
<script defer src="{% static "js/jquery.js" %}"></script>
<script defer src="{% static "js/jquery.formset.js" %}"></script>
<script defer src="{% static "cfp/js/animateFormset.js" %}"></script>
<script defer src="{% static "cfp/js/animateFormset.js" %}"></script>
{% endcompress %}
{% endblock cfp_header %}

Expand Down
16 changes: 15 additions & 1 deletion src/pretalx/common/context_processors.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,20 @@ def system_information(request):
event = getattr(request, "event", None)

if not request.path.startswith("/orga/"):
context["footer_links"] = []
context["header_links"] = []

if event:
context["footer_links"] = [
{"label": link.label, "url": link.url}
for link in event.extra_links.all()
if link.role == "footer"
]
context["header_links"] = [
{"label": link.label, "url": link.url}
for link in event.extra_links.all()
if link.role == "header"
]
for __, response in footer_link.send(event, request=request):
if isinstance(response, list):
_footer += response
Expand All @@ -74,7 +88,7 @@ def system_information(request):
"Please return a list in your footer_link signal receiver, not a dictionary.",
DeprecationWarning,
)
context["footer_links"] = _footer
context["footer_links"] += _footer

if event:
for _receiver, response in html_head.send(event, request=request):
Expand Down
4 changes: 3 additions & 1 deletion src/pretalx/common/middleware/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,9 @@ def __call__(self, request):
with scopes_disabled():
try:
request.event = get_object_or_404(
Event.objects.prefetch_related("schedules", "submissions"),
Event.objects.prefetch_related(
"schedules", "submissions", "extra_links"
),
slug__iexact=event_slug,
)
except ValueError:
Expand Down
3 changes: 2 additions & 1 deletion src/pretalx/common/templates/common/base.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{% load compress %}
{% load safelink %}
{% load i18n %}
{% load rules %}
{% load static %}
Expand Down Expand Up @@ -177,7 +178,7 @@ <h1>
{% endif %}
{% for footer in footer_links %}
·
<a href="{{ footer.link }}">{{ footer.label }}</a>
<a href="{% safelink footer.url %}" target="_blank" rel="noopener">{{ footer.label }}</a>
{% endfor %}
</footer>
</div>
Expand Down
6 changes: 3 additions & 3 deletions src/pretalx/common/templates/common/widgets/image_input.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
</div>
<br>
{% endif %}
{% if widget.is_initial %}{{ widget.initial_text }}: <a href="{{ widget.value.url }}" data-lightbox="{{ widget.value.url }}">{{ widget.value }}</a>{% if not widget.required %}
<input type="checkbox" name="{{ widget.checkbox_name }}" id="{{ widget.checkbox_id }}"{% if widget.attrs.disabled %} disabled{% endif %}>
<label for="{{ widget.checkbox_id }}">{{ widget.clear_checkbox_label }}</label>{% endif %}<br>
{% if widget.is_initial %}<span class="form-image-initial">{{ widget.initial_text }}: <a href="{{ widget.value.url }}" data-lightbox="{{ widget.value.url }}">{{ widget.value }}</a>{% if not widget.is_required %}
<span class="form-image-clear"><input type="checkbox" name="{{ widget.checkbox_name }}" id="{{ widget.checkbox_id }}"{% if widget.attrs.disabled %} disabled{% endif %}>
<label for="{{ widget.checkbox_id }}">{{ widget.clear_checkbox_label }}</label></span>{% endif %}</span><br>
{{ widget.input_text }}:{% endif %}
<input type="{{ widget.type }}" name="{{ widget.name }}"{% include "django/forms/widgets/attrs.html" %}>
49 changes: 49 additions & 0 deletions src/pretalx/event/migrations/0038_eventextralink.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Generated by Django 5.1.4 on 2024-12-19 13:05

import django.db.models.deletion
import i18nfield.fields
import pretalx.common.models.mixins
from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("event", "0037_remove_event_accept_template_and_more"),
]

operations = [
migrations.CreateModel(
name="EventExtraLink",
fields=[
(
"id",
models.AutoField(
auto_created=True, primary_key=True, serialize=False
),
),
("created", models.DateTimeField(auto_now_add=True, null=True)),
("updated", models.DateTimeField(auto_now=True, null=True)),
("label", i18nfield.fields.I18nCharField(max_length=200)),
("url", models.URLField()),
("role", models.CharField(default="footer", max_length=6)),
(
"event",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name="extra_links",
to="event.event",
),
),
],
options={
"abstract": False,
},
bases=(
pretalx.common.models.mixins.OrderedModel,
pretalx.common.models.mixins.LogMixin,
pretalx.common.models.mixins.FileCleanupMixin,
models.Model,
),
),
]
24 changes: 22 additions & 2 deletions src/pretalx/event/models/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
from django.utils.functional import cached_property
from django.utils.timezone import make_aware, now
from django.utils.translation import gettext_lazy as _
from django_scopes import scopes_disabled
from django_scopes import ScopedManager, scopes_disabled
from i18nfield.fields import I18nCharField, I18nTextField

from pretalx.common.cache import ObjectRelatedCache
from pretalx.common.language import LANGUAGE_NAMES
from pretalx.common.models import TIMEZONE_CHOICES
from pretalx.common.models.mixins import PretalxModel
from pretalx.common.models.mixins import OrderedModel, PretalxModel
from pretalx.common.models.settings import hierarkey
from pretalx.common.plugins import get_all_plugins
from pretalx.common.text.daterange import daterange
Expand Down Expand Up @@ -629,6 +629,11 @@ def copy_data_from(self, other_event, skip_attributes=None):
setattr(self, attribute, getattr(other_event, attribute))
self.save()

for extra_link in other_event.extra_links.all():
extra_link.pk = None
extra_link.event = self
extra_link.save()

self.mail_templates.all().delete()
for template in other_event.mail_templates.all().filter(is_auto_created=False):
template.pk = None
Expand Down Expand Up @@ -1086,3 +1091,18 @@ def shred(self, person=None):
entry.delete()

shred.alters_data = True


class EventExtraLink(OrderedModel, PretalxModel):
event = models.ForeignKey(
to="Event", on_delete=models.CASCADE, related_name="extra_links"
)
label = I18nCharField(max_length=200, verbose_name=_("Link text"))
url = models.URLField(verbose_name=_("Link URL"))
role = models.CharField(
max_length=6,
choices=(("footer", "Footer"), ("header", "Header")),
default="footer",
)

objects = ScopedManager(event="event")
12 changes: 6 additions & 6 deletions src/pretalx/frontend/schedule-editor/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit bc1cc16

Please sign in to comment.