forked from CGM_Public/pretix_original
Allow to set a custom error message when presale is ended
This commit is contained in:
@@ -101,6 +101,10 @@ DEFAULTS = {
|
||||
'default': 'False',
|
||||
'type': bool
|
||||
},
|
||||
'presale_has_ended_text': {
|
||||
'default': '',
|
||||
'type': LazyI18nString
|
||||
},
|
||||
'payment_explanation': {
|
||||
'default': '',
|
||||
'type': LazyI18nString
|
||||
|
||||
@@ -1049,6 +1049,14 @@ class DisplaySettingsForm(SettingsForm):
|
||||
required=False,
|
||||
widget=I18nTextarea
|
||||
)
|
||||
presale_has_ended_text = I18nFormField(
|
||||
label=_("End of presale text"),
|
||||
required=False,
|
||||
widget=I18nTextarea,
|
||||
widget_kwargs={'attrs': {'rows': '2'}},
|
||||
help_text=_("This text will be shown above the ticket shop once the designated sales timeframe for this event "
|
||||
"is over. You can use it to describe other options to get a ticket, such as a box office.")
|
||||
)
|
||||
voucher_explanation_text = I18nFormField(
|
||||
label=_("Voucher explanation"),
|
||||
required=False,
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
<legend>{% trans "Event page" %}</legend>
|
||||
{% bootstrap_field form.logo_image layout="control" %}
|
||||
{% bootstrap_field form.frontpage_text layout="control" %}
|
||||
{% bootstrap_field form.presale_has_ended_text layout="control" %}
|
||||
{% bootstrap_field form.voucher_explanation_text layout="control" %}
|
||||
{% bootstrap_field form.show_variations_expanded layout="control" %}
|
||||
{% bootstrap_field form.meta_noindex layout="control" %}
|
||||
|
||||
@@ -110,9 +110,13 @@
|
||||
{% if not ev.presale_is_running %}
|
||||
<div class="alert alert-info">
|
||||
{% if ev.presale_has_ended %}
|
||||
{% blocktrans trimmed %}
|
||||
The presale period for this event is over.
|
||||
{% endblocktrans %}
|
||||
{% if event.settings.presale_has_ended_text %}
|
||||
{{ event.settings.presale_has_ended_text|rich_text }}
|
||||
{% else %}
|
||||
{% blocktrans trimmed %}
|
||||
The presale period for this event is over.
|
||||
{% endblocktrans %}
|
||||
{% endif %}
|
||||
{% elif event.settings.presale_start_show_date %}
|
||||
{% blocktrans trimmed with date=ev.presale_start|date:"SHORT_DATE_FORMAT" time=ev.presale_start|time:"TIME_FORMAT" %}
|
||||
The presale for this event will start on {{ date }} at {{ time }}.
|
||||
|
||||
@@ -437,7 +437,10 @@ class WidgetAPIProductList(EventListMixin, View):
|
||||
|
||||
if not ev.presale_is_running:
|
||||
if ev.presale_has_ended:
|
||||
data['error'] = ugettext('The presale period for this event is over.')
|
||||
if request.event.settings.presale_has_ended_text:
|
||||
data['error'] = str(request.event.settings.presale_has_ended_text)
|
||||
else:
|
||||
data['error'] = ugettext('The presale period for this event is over.')
|
||||
elif request.event.settings.presale_start_show_date:
|
||||
data['error'] = ugettext('The presale for this event will start on %(date)s at %(time)s.') % {
|
||||
'date': date_format(ev.presale_start.astimezone(request.event.timezone), "SHORT_DATE_FORMAT"),
|
||||
|
||||
Reference in New Issue
Block a user