Email settings: Collapse attendee texts if unused (Z#23243417)

This commit is contained in:
Raphael Michel
2026-09-08 21:46:25 +02:00
parent edb4069e18
commit 7d2e4eb494
2 changed files with 12 additions and 4 deletions
+9 -4
View File
@@ -1635,10 +1635,15 @@ class MailSettingsForm(FormPlaceholderMixin, SettingsForm):
self._set_field_placeholders(k, v, rich=k.startswith('mail_text_') and k not in self.plain_rendering)
for k, v in list(self.fields.items()):
if k.endswith('_attendee') and not event.settings.attendee_emails_asked:
# If we don't ask for attendee emails, we can't send them anything and we don't need to clutter
# the user interface with it
del self.fields[k]
if k.endswith('_attendee'):
if not event.settings.attendee_emails_asked:
# If we don't ask for attendee emails, we can't send them anything and we don't need to clutter
# the user interface with it
del self.fields[k]
elif 'subject' in k and k.replace("subject", "send") in self.fields:
v.widget.attrs["data-display-dependency"] = f'#id_{k.replace("subject", "send")}'
elif 'text' in k and k.replace("text", "send") in self.fields:
v.widget.attrs["data-display-dependency"] = f'#id_{k.replace("text", "send")}'
class TicketSettingsForm(SettingsForm):
@@ -401,6 +401,9 @@ var form_handlers = function (el) {
if (tagName !== "div" && tagName !== "button") {
$toggling = dependent.closest('.form-group');
}
if ($toggling.find(".has-error").length > 0) {
enabled = true; // Don't hide error message that makes form unsubmittable
}
if (ev) {
if (enabled) {
$toggling.stop().slideDown();