mirror of
https://github.com/pretix/pretix.git
synced 2026-09-12 16:04:42 +00:00
Email settings: Collapse attendee texts if unused (Z#23243417)
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user