mirror of
https://github.com/pretix/pretix.git
synced 2026-09-15 16:34:42 +00:00
Add special input widgets for markdown fields (#1577)
* Add markdown text input widgets * Update src/pretix/static/pretixcontrol/scss/_forms.scss * Improvements --------- Co-authored-by: Raphael Michel <michel@rami.io>
This commit is contained in:
co-authored by
Raphael Michel
parent
64d6a34039
commit
5c833cd493
@@ -11,6 +11,9 @@ In many places of your shop, like frontpage texts, product descriptions and emai
|
|||||||
since it is way easier to learn than languages like HTML but allows all basic formatting options required
|
since it is way easier to learn than languages like HTML but allows all basic formatting options required
|
||||||
for text in those places.
|
for text in those places.
|
||||||
|
|
||||||
|
.. note:: Some fields that are used in one-line context only allow formatting that refers to individual words
|
||||||
|
(such as bold or italic font or a link) but do not allow block-level formatting like lists or headlines.
|
||||||
|
|
||||||
Formatting rules
|
Formatting rules
|
||||||
----------------
|
----------------
|
||||||
|
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ from django import forms
|
|||||||
from django.core.validators import URLValidator
|
from django.core.validators import URLValidator
|
||||||
from django.forms.models import ModelFormMetaclass
|
from django.forms.models import ModelFormMetaclass
|
||||||
from django.utils.crypto import get_random_string
|
from django.utils.crypto import get_random_string
|
||||||
|
from django.utils.safestring import mark_safe
|
||||||
from django.utils.translation import gettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
from formtools.wizard.views import SessionWizardView
|
from formtools.wizard.views import SessionWizardView
|
||||||
from hierarkey.forms import HierarkeyForm
|
from hierarkey.forms import HierarkeyForm
|
||||||
@@ -85,6 +86,43 @@ class I18nInlineFormSet(i18nfield.forms.I18nInlineFormSet):
|
|||||||
super().__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
|
class MarkdownTextarea(forms.Textarea):
|
||||||
|
|
||||||
|
def _render(self, template_name, context, renderer=None):
|
||||||
|
return mark_safe(
|
||||||
|
'<div class="i18n-form-group">%s<div class="i18n-field-markdown-note">%s</div></div>' % (
|
||||||
|
super()._render(template_name, context, renderer=None),
|
||||||
|
_("You can use {markup_name} in this field.").format(
|
||||||
|
markup_name='<a href="https://docs.pretix.eu/en/latest/user/markdown.html" target="_blank">Markdown</a>'
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class I18nMarkdownTextarea(i18nfield.forms.I18nTextarea):
|
||||||
|
def format_output(self, rendered_widgets) -> str:
|
||||||
|
rendered_widgets = rendered_widgets + [
|
||||||
|
'<div class="i18n-field-markdown-note">%s</div>' % (
|
||||||
|
_("You can use {markup_name} in this field.").format(
|
||||||
|
markup_name='<a href="https://docs.pretix.eu/en/latest/user/markdown.html" target="_blank">Markdown</a>'
|
||||||
|
)
|
||||||
|
)
|
||||||
|
]
|
||||||
|
return super().format_output(rendered_widgets)
|
||||||
|
|
||||||
|
|
||||||
|
class I18nMarkdownTextInput(i18nfield.forms.I18nTextInput):
|
||||||
|
def format_output(self, rendered_widgets) -> str:
|
||||||
|
rendered_widgets = rendered_widgets + [
|
||||||
|
'<div class="i18n-field-markdown-note">%s</div>' % (
|
||||||
|
_("You can use {markup_name} in this field.").format(
|
||||||
|
markup_name='<a href="https://docs.pretix.eu/en/latest/user/markdown.html" target="_blank">Markdown</a>'
|
||||||
|
)
|
||||||
|
)
|
||||||
|
]
|
||||||
|
return super().format_output(rendered_widgets)
|
||||||
|
|
||||||
|
|
||||||
SECRET_REDACTED = '*****'
|
SECRET_REDACTED = '*****'
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1461,7 +1461,7 @@ class SubEvent(EventMixin, LoggedModel):
|
|||||||
)
|
)
|
||||||
frontpage_text = I18nTextField(
|
frontpage_text = I18nTextField(
|
||||||
null=True, blank=True,
|
null=True, blank=True,
|
||||||
verbose_name=_("Frontpage text")
|
verbose_name=_("Frontpage text"),
|
||||||
)
|
)
|
||||||
seating_plan = models.ForeignKey('SeatingPlan', on_delete=models.PROTECT, null=True, blank=True,
|
seating_plan = models.ForeignKey('SeatingPlan', on_delete=models.PROTECT, null=True, blank=True,
|
||||||
related_name='subevents', verbose_name=_('Seating plan'))
|
related_name='subevents', verbose_name=_('Seating plan'))
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ from i18nfield.forms import I18nFormField, I18nTextarea, I18nTextInput
|
|||||||
from i18nfield.strings import LazyI18nString
|
from i18nfield.strings import LazyI18nString
|
||||||
|
|
||||||
from pretix.base.channels import get_all_sales_channels
|
from pretix.base.channels import get_all_sales_channels
|
||||||
from pretix.base.forms import PlaceholderValidator
|
from pretix.base.forms import I18nMarkdownTextarea, PlaceholderValidator
|
||||||
from pretix.base.models import (
|
from pretix.base.models import (
|
||||||
CartPosition, Event, GiftCard, InvoiceAddress, Order, OrderPayment,
|
CartPosition, Event, GiftCard, InvoiceAddress, Order, OrderPayment,
|
||||||
OrderRefund, Quota, TaxRule,
|
OrderRefund, Quota, TaxRule,
|
||||||
@@ -1185,14 +1185,14 @@ class ManualPayment(BasePaymentProvider):
|
|||||||
label=_('Payment process description during checkout'),
|
label=_('Payment process description during checkout'),
|
||||||
help_text=_('This text will be shown during checkout when the user selects this payment method. '
|
help_text=_('This text will be shown during checkout when the user selects this payment method. '
|
||||||
'It should give a short explanation on this payment method.'),
|
'It should give a short explanation on this payment method.'),
|
||||||
widget=I18nTextarea,
|
widget=I18nMarkdownTextarea,
|
||||||
)),
|
)),
|
||||||
('email_instructions', I18nFormField(
|
('email_instructions', I18nFormField(
|
||||||
label=_('Payment process description in order confirmation emails'),
|
label=_('Payment process description in order confirmation emails'),
|
||||||
help_text=_('This text will be included for the {payment_info} placeholder in order confirmation '
|
help_text=_('This text will be included for the {payment_info} placeholder in order confirmation '
|
||||||
'mails. It should instruct the user on how to proceed with the payment. You can use '
|
'mails. It should instruct the user on how to proceed with the payment. You can use '
|
||||||
'the placeholders {order}, {amount}, {currency} and {amount_with_currency}.'),
|
'the placeholders {order}, {amount}, {currency} and {amount_with_currency}.'),
|
||||||
widget=I18nTextarea,
|
widget=I18nMarkdownTextarea,
|
||||||
validators=[PlaceholderValidator(['{order}', '{amount}', '{currency}', '{amount_with_currency}'])],
|
validators=[PlaceholderValidator(['{order}', '{amount}', '{currency}', '{amount_with_currency}'])],
|
||||||
)),
|
)),
|
||||||
('pending_description', I18nFormField(
|
('pending_description', I18nFormField(
|
||||||
@@ -1200,7 +1200,7 @@ class ManualPayment(BasePaymentProvider):
|
|||||||
help_text=_('This text will be shown on the order confirmation page for pending orders. '
|
help_text=_('This text will be shown on the order confirmation page for pending orders. '
|
||||||
'It should instruct the user on how to proceed with the payment. You can use '
|
'It should instruct the user on how to proceed with the payment. You can use '
|
||||||
'the placeholders {order}, {amount}, {currency} and {amount_with_currency}.'),
|
'the placeholders {order}, {amount}, {currency} and {amount_with_currency}.'),
|
||||||
widget=I18nTextarea,
|
widget=I18nMarkdownTextarea,
|
||||||
validators=[PlaceholderValidator(['{order}', '{amount}', '{currency}', '{amount_with_currency}'])],
|
validators=[PlaceholderValidator(['{order}', '{amount}', '{currency}', '{amount_with_currency}'])],
|
||||||
)),
|
)),
|
||||||
('invoice_immediately',
|
('invoice_immediately',
|
||||||
@@ -1325,7 +1325,7 @@ class GiftCardPayment(BasePaymentProvider):
|
|||||||
(
|
(
|
||||||
"public_description",
|
"public_description",
|
||||||
I18nFormField(
|
I18nFormField(
|
||||||
label=_("Payment method description"), widget=I18nTextarea, required=False
|
label=_("Payment method description"), widget=I18nMarkdownTextarea, required=False
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
|||||||
+20
-20
@@ -64,7 +64,7 @@ from pretix.api.serializers.fields import (
|
|||||||
ListMultipleChoiceField, UploadedFileField,
|
ListMultipleChoiceField, UploadedFileField,
|
||||||
)
|
)
|
||||||
from pretix.api.serializers.i18n import I18nField, I18nURLField
|
from pretix.api.serializers.i18n import I18nField, I18nURLField
|
||||||
from pretix.base.forms import I18nURLFormField
|
from pretix.base.forms import I18nMarkdownTextarea, I18nURLFormField
|
||||||
from pretix.base.models.tax import VAT_ID_COUNTRIES, TaxRule
|
from pretix.base.models.tax import VAT_ID_COUNTRIES, TaxRule
|
||||||
from pretix.base.reldate import (
|
from pretix.base.reldate import (
|
||||||
RelativeDateField, RelativeDateTimeField, RelativeDateWrapper,
|
RelativeDateField, RelativeDateTimeField, RelativeDateWrapper,
|
||||||
@@ -602,7 +602,7 @@ DEFAULTS = {
|
|||||||
'serializer_class': I18nField,
|
'serializer_class': I18nField,
|
||||||
'form_kwargs': dict(
|
'form_kwargs': dict(
|
||||||
label=_("Invoice address explanation"),
|
label=_("Invoice address explanation"),
|
||||||
widget=I18nTextarea,
|
widget=I18nMarkdownTextarea,
|
||||||
widget_kwargs={'attrs': {'rows': '2'}},
|
widget_kwargs={'attrs': {'rows': '2'}},
|
||||||
help_text=_("This text will be shown above the invoice address form during checkout.")
|
help_text=_("This text will be shown above the invoice address form during checkout.")
|
||||||
)
|
)
|
||||||
@@ -801,7 +801,7 @@ DEFAULTS = {
|
|||||||
'serializer_class': I18nField,
|
'serializer_class': I18nField,
|
||||||
'form_kwargs': dict(
|
'form_kwargs': dict(
|
||||||
label=_("End of presale text"),
|
label=_("End of presale text"),
|
||||||
widget=I18nTextarea,
|
widget=I18nMarkdownTextarea,
|
||||||
widget_kwargs={'attrs': {'rows': '2'}},
|
widget_kwargs={'attrs': {'rows': '2'}},
|
||||||
help_text=_("This text will be shown above the ticket shop once the designated sales timeframe for this event "
|
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.")
|
"is over. You can use it to describe other options to get a ticket, such as a box office.")
|
||||||
@@ -813,7 +813,7 @@ DEFAULTS = {
|
|||||||
'form_class': I18nFormField,
|
'form_class': I18nFormField,
|
||||||
'serializer_class': I18nField,
|
'serializer_class': I18nField,
|
||||||
'form_kwargs': dict(
|
'form_kwargs': dict(
|
||||||
widget=I18nTextarea,
|
widget=I18nMarkdownTextarea,
|
||||||
widget_kwargs={'attrs': {
|
widget_kwargs={'attrs': {
|
||||||
'rows': 3,
|
'rows': 3,
|
||||||
}},
|
}},
|
||||||
@@ -1459,7 +1459,7 @@ DEFAULTS = {
|
|||||||
'serializer_class': I18nField,
|
'serializer_class': I18nField,
|
||||||
'form_kwargs': dict(
|
'form_kwargs': dict(
|
||||||
label=_("Phone number explanation"),
|
label=_("Phone number explanation"),
|
||||||
widget=I18nTextarea,
|
widget=I18nMarkdownTextarea,
|
||||||
widget_kwargs={'attrs': {'rows': '2'}},
|
widget_kwargs={'attrs': {'rows': '2'}},
|
||||||
help_text=_("If you ask for a phone number, explain why you do so and what you will use the phone number for.")
|
help_text=_("If you ask for a phone number, explain why you do so and what you will use the phone number for.")
|
||||||
)
|
)
|
||||||
@@ -1876,7 +1876,7 @@ DEFAULTS = {
|
|||||||
'form_class': I18nFormField,
|
'form_class': I18nFormField,
|
||||||
'form_kwargs': dict(
|
'form_kwargs': dict(
|
||||||
label=_("Voluntary lower refund explanation"),
|
label=_("Voluntary lower refund explanation"),
|
||||||
widget=I18nTextarea,
|
widget=I18nMarkdownTextarea,
|
||||||
widget_kwargs={'attrs': {'rows': '2'}},
|
widget_kwargs={'attrs': {'rows': '2'}},
|
||||||
help_text=_("This text will be shown in between the explanation of how the refunds work and the slider "
|
help_text=_("This text will be shown in between the explanation of how the refunds work and the slider "
|
||||||
"which your customers can use to choose the amount they would like to receive. You can use it "
|
"which your customers can use to choose the amount they would like to receive. You can use it "
|
||||||
@@ -1958,7 +1958,7 @@ DEFAULTS = {
|
|||||||
'form_class': I18nFormField,
|
'form_class': I18nFormField,
|
||||||
'form_kwargs': dict(
|
'form_kwargs': dict(
|
||||||
label=_("Terms of cancellation"),
|
label=_("Terms of cancellation"),
|
||||||
widget=I18nTextarea,
|
widget=I18nMarkdownTextarea,
|
||||||
widget_kwargs={'attrs': {'rows': '2'}},
|
widget_kwargs={'attrs': {'rows': '2'}},
|
||||||
help_text=_("This text will be shown when cancellation is allowed for a paid order. Leave empty if you "
|
help_text=_("This text will be shown when cancellation is allowed for a paid order. Leave empty if you "
|
||||||
"want pretix to automatically generate the terms of cancellation based on your settings.")
|
"want pretix to automatically generate the terms of cancellation based on your settings.")
|
||||||
@@ -1971,7 +1971,7 @@ DEFAULTS = {
|
|||||||
'form_class': I18nFormField,
|
'form_class': I18nFormField,
|
||||||
'form_kwargs': dict(
|
'form_kwargs': dict(
|
||||||
label=_("Terms of cancellation"),
|
label=_("Terms of cancellation"),
|
||||||
widget=I18nTextarea,
|
widget=I18nMarkdownTextarea,
|
||||||
widget_kwargs={'attrs': {'rows': '2'}},
|
widget_kwargs={'attrs': {'rows': '2'}},
|
||||||
help_text=_("This text will be shown when cancellation is allowed for an unpaid or free order. Leave empty "
|
help_text=_("This text will be shown when cancellation is allowed for an unpaid or free order. Leave empty "
|
||||||
"if you want pretix to automatically generate the terms of cancellation based on your settings.")
|
"if you want pretix to automatically generate the terms of cancellation based on your settings.")
|
||||||
@@ -2060,7 +2060,7 @@ DEFAULTS = {
|
|||||||
'form_class': I18nFormField,
|
'form_class': I18nFormField,
|
||||||
'form_kwargs': dict(
|
'form_kwargs': dict(
|
||||||
label=_("Event description"),
|
label=_("Event description"),
|
||||||
widget=I18nTextarea,
|
widget=I18nMarkdownTextarea,
|
||||||
help_text=_(
|
help_text=_(
|
||||||
"You can use this to share information with your attendees, such as travel information or the link to a digital event. "
|
"You can use this to share information with your attendees, such as travel information or the link to a digital event. "
|
||||||
"If you keep it empty, we will put a link to the event shop, the admission time, and your organizer name in there. "
|
"If you keep it empty, we will put a link to the event shop, the admission time, and your organizer name in there. "
|
||||||
@@ -2991,7 +2991,7 @@ Your {organizer} team""")) # noqa: W291
|
|||||||
'form_class': I18nFormField,
|
'form_class': I18nFormField,
|
||||||
'form_kwargs': dict(
|
'form_kwargs': dict(
|
||||||
label=_("Frontpage text"),
|
label=_("Frontpage text"),
|
||||||
widget=I18nTextarea
|
widget=I18nMarkdownTextarea,
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
'event_info_text': {
|
'event_info_text': {
|
||||||
@@ -3013,7 +3013,7 @@ Your {organizer} team""")) # noqa: W291
|
|||||||
'form_class': I18nFormField,
|
'form_class': I18nFormField,
|
||||||
'form_kwargs': dict(
|
'form_kwargs': dict(
|
||||||
label=_("Banner text (top)"),
|
label=_("Banner text (top)"),
|
||||||
widget=I18nTextarea,
|
widget=I18nMarkdownTextarea,
|
||||||
widget_kwargs={'attrs': {'rows': '2'}},
|
widget_kwargs={'attrs': {'rows': '2'}},
|
||||||
help_text=_("This text will be shown above every page of your shop. Please only use this for "
|
help_text=_("This text will be shown above every page of your shop. Please only use this for "
|
||||||
"very important messages.")
|
"very important messages.")
|
||||||
@@ -3026,7 +3026,7 @@ Your {organizer} team""")) # noqa: W291
|
|||||||
'form_class': I18nFormField,
|
'form_class': I18nFormField,
|
||||||
'form_kwargs': dict(
|
'form_kwargs': dict(
|
||||||
label=_("Banner text (bottom)"),
|
label=_("Banner text (bottom)"),
|
||||||
widget=I18nTextarea,
|
widget=I18nMarkdownTextarea,
|
||||||
widget_kwargs={'attrs': {'rows': '2'}},
|
widget_kwargs={'attrs': {'rows': '2'}},
|
||||||
help_text=_("This text will be shown below every page of your shop. Please only use this for "
|
help_text=_("This text will be shown below every page of your shop. Please only use this for "
|
||||||
"very important messages.")
|
"very important messages.")
|
||||||
@@ -3039,7 +3039,7 @@ Your {organizer} team""")) # noqa: W291
|
|||||||
'form_class': I18nFormField,
|
'form_class': I18nFormField,
|
||||||
'form_kwargs': dict(
|
'form_kwargs': dict(
|
||||||
label=_("Voucher explanation"),
|
label=_("Voucher explanation"),
|
||||||
widget=I18nTextarea,
|
widget=I18nMarkdownTextarea,
|
||||||
widget_kwargs={'attrs': {'rows': '2'}},
|
widget_kwargs={'attrs': {'rows': '2'}},
|
||||||
help_text=_("This text will be shown next to the input for a voucher code. You can use it e.g. to explain "
|
help_text=_("This text will be shown next to the input for a voucher code. You can use it e.g. to explain "
|
||||||
"how to obtain a voucher code.")
|
"how to obtain a voucher code.")
|
||||||
@@ -3052,7 +3052,7 @@ Your {organizer} team""")) # noqa: W291
|
|||||||
'form_class': I18nFormField,
|
'form_class': I18nFormField,
|
||||||
'form_kwargs': dict(
|
'form_kwargs': dict(
|
||||||
label=_("Attendee data explanation"),
|
label=_("Attendee data explanation"),
|
||||||
widget=I18nTextarea,
|
widget=I18nMarkdownTextarea,
|
||||||
widget_kwargs={'attrs': {'rows': '2'}},
|
widget_kwargs={'attrs': {'rows': '2'}},
|
||||||
help_text=_("This text will be shown above the questions asked for every personalized product. You can use it e.g. to explain "
|
help_text=_("This text will be shown above the questions asked for every personalized product. You can use it e.g. to explain "
|
||||||
"why you need information from them.")
|
"why you need information from them.")
|
||||||
@@ -3068,7 +3068,7 @@ Your {organizer} team""")) # noqa: W291
|
|||||||
help_text=_("This message will be shown after an order has been created successfully. It will be shown in additional "
|
help_text=_("This message will be shown after an order has been created successfully. It will be shown in additional "
|
||||||
"to the default text."),
|
"to the default text."),
|
||||||
widget_kwargs={'attrs': {'rows': '2'}},
|
widget_kwargs={'attrs': {'rows': '2'}},
|
||||||
widget=I18nTextarea
|
widget=I18nMarkdownTextarea,
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
'checkout_phone_helptext': {
|
'checkout_phone_helptext': {
|
||||||
@@ -3079,7 +3079,7 @@ Your {organizer} team""")) # noqa: W291
|
|||||||
'form_kwargs': dict(
|
'form_kwargs': dict(
|
||||||
label=_("Help text of the phone number field"),
|
label=_("Help text of the phone number field"),
|
||||||
widget_kwargs={'attrs': {'rows': '2'}},
|
widget_kwargs={'attrs': {'rows': '2'}},
|
||||||
widget=I18nTextarea
|
widget=I18nMarkdownTextarea,
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
'checkout_email_helptext': {
|
'checkout_email_helptext': {
|
||||||
@@ -3093,7 +3093,7 @@ Your {organizer} team""")) # noqa: W291
|
|||||||
'form_kwargs': dict(
|
'form_kwargs': dict(
|
||||||
label=_("Help text of the email field"),
|
label=_("Help text of the email field"),
|
||||||
widget_kwargs={'attrs': {'rows': '2'}},
|
widget_kwargs={'attrs': {'rows': '2'}},
|
||||||
widget=I18nTextarea
|
widget=I18nMarkdownTextarea,
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
'order_import_settings': {
|
'order_import_settings': {
|
||||||
@@ -3223,7 +3223,7 @@ Your {organizer} team""")) # noqa: W291
|
|||||||
'form_class': I18nFormField,
|
'form_class': I18nFormField,
|
||||||
'form_kwargs': dict(
|
'form_kwargs': dict(
|
||||||
label=_('Homepage text'),
|
label=_('Homepage text'),
|
||||||
widget=I18nTextarea,
|
widget=I18nMarkdownTextarea,
|
||||||
help_text=_('This will be displayed on the organizer homepage.')
|
help_text=_('This will be displayed on the organizer homepage.')
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
@@ -3280,7 +3280,7 @@ Your {organizer} team""")) # noqa: W291
|
|||||||
'form_class': I18nFormField,
|
'form_class': I18nFormField,
|
||||||
'form_kwargs': dict(
|
'form_kwargs': dict(
|
||||||
label=_("Dialog text"),
|
label=_("Dialog text"),
|
||||||
widget=I18nTextarea,
|
widget=I18nMarkdownTextarea,
|
||||||
widget_kwargs={'attrs': {'rows': '3', 'data-display-dependency': '#id_settings-cookie_consent'}},
|
widget_kwargs={'attrs': {'rows': '3', 'data-display-dependency': '#id_settings-cookie_consent'}},
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
@@ -3295,7 +3295,7 @@ Your {organizer} team""")) # noqa: W291
|
|||||||
'form_class': I18nFormField,
|
'form_class': I18nFormField,
|
||||||
'form_kwargs': dict(
|
'form_kwargs': dict(
|
||||||
label=_("Secondary dialog text"),
|
label=_("Secondary dialog text"),
|
||||||
widget=I18nTextarea,
|
widget=I18nMarkdownTextarea,
|
||||||
widget_kwargs={'attrs': {'rows': '3', 'data-display-dependency': '#id_settings-cookie_consent'}},
|
widget_kwargs={'attrs': {'rows': '3', 'data-display-dependency': '#id_settings-cookie_consent'}},
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -55,12 +55,14 @@ from django.utils.timezone import get_current_timezone_name
|
|||||||
from django.utils.translation import gettext, gettext_lazy as _, pgettext_lazy
|
from django.utils.translation import gettext, gettext_lazy as _, pgettext_lazy
|
||||||
from django_countries.fields import LazyTypedChoiceField
|
from django_countries.fields import LazyTypedChoiceField
|
||||||
from i18nfield.forms import (
|
from i18nfield.forms import (
|
||||||
I18nForm, I18nFormField, I18nFormSetMixin, I18nTextarea, I18nTextInput,
|
I18nForm, I18nFormField, I18nFormSetMixin, I18nTextInput,
|
||||||
)
|
)
|
||||||
from pytz import common_timezones
|
from pytz import common_timezones
|
||||||
|
|
||||||
from pretix.base.channels import get_all_sales_channels
|
from pretix.base.channels import get_all_sales_channels
|
||||||
from pretix.base.forms import I18nModelForm, PlaceholderValidator, SettingsForm
|
from pretix.base.forms import (
|
||||||
|
I18nMarkdownTextarea, I18nModelForm, PlaceholderValidator, SettingsForm,
|
||||||
|
)
|
||||||
from pretix.base.models import Event, Organizer, TaxRule, Team
|
from pretix.base.models import Event, Organizer, TaxRule, Team
|
||||||
from pretix.base.models.event import EventFooterLink, EventMetaValue, SubEvent
|
from pretix.base.models.event import EventFooterLink, EventMetaValue, SubEvent
|
||||||
from pretix.base.reldate import RelativeDateField, RelativeDateTimeField
|
from pretix.base.reldate import RelativeDateField, RelativeDateTimeField
|
||||||
@@ -988,7 +990,7 @@ class MailSettingsForm(FormPlaceholderMixin, SettingsForm):
|
|||||||
mail_text_signature = I18nFormField(
|
mail_text_signature = I18nFormField(
|
||||||
label=_("Signature"),
|
label=_("Signature"),
|
||||||
required=False,
|
required=False,
|
||||||
widget=I18nTextarea,
|
widget=I18nMarkdownTextarea,
|
||||||
help_text=_("This will be attached to every email. Available placeholders: {event}"),
|
help_text=_("This will be attached to every email. Available placeholders: {event}"),
|
||||||
validators=[PlaceholderValidator(['{event}'])],
|
validators=[PlaceholderValidator(['{event}'])],
|
||||||
widget_kwargs={'attrs': {
|
widget_kwargs={'attrs': {
|
||||||
@@ -1011,7 +1013,7 @@ class MailSettingsForm(FormPlaceholderMixin, SettingsForm):
|
|||||||
mail_text_order_placed = I18nFormField(
|
mail_text_order_placed = I18nFormField(
|
||||||
label=_("Text sent to order contact address"),
|
label=_("Text sent to order contact address"),
|
||||||
required=False,
|
required=False,
|
||||||
widget=I18nTextarea,
|
widget=I18nMarkdownTextarea,
|
||||||
)
|
)
|
||||||
mail_send_order_placed_attendee = forms.BooleanField(
|
mail_send_order_placed_attendee = forms.BooleanField(
|
||||||
label=_("Send an email to attendees"),
|
label=_("Send an email to attendees"),
|
||||||
@@ -1027,7 +1029,7 @@ class MailSettingsForm(FormPlaceholderMixin, SettingsForm):
|
|||||||
mail_text_order_placed_attendee = I18nFormField(
|
mail_text_order_placed_attendee = I18nFormField(
|
||||||
label=_("Text sent to attendees"),
|
label=_("Text sent to attendees"),
|
||||||
required=False,
|
required=False,
|
||||||
widget=I18nTextarea,
|
widget=I18nMarkdownTextarea,
|
||||||
)
|
)
|
||||||
|
|
||||||
mail_subject_order_paid = I18nFormField(
|
mail_subject_order_paid = I18nFormField(
|
||||||
@@ -1038,7 +1040,7 @@ class MailSettingsForm(FormPlaceholderMixin, SettingsForm):
|
|||||||
mail_text_order_paid = I18nFormField(
|
mail_text_order_paid = I18nFormField(
|
||||||
label=_("Text sent to order contact address"),
|
label=_("Text sent to order contact address"),
|
||||||
required=False,
|
required=False,
|
||||||
widget=I18nTextarea,
|
widget=I18nMarkdownTextarea,
|
||||||
)
|
)
|
||||||
mail_send_order_paid_attendee = forms.BooleanField(
|
mail_send_order_paid_attendee = forms.BooleanField(
|
||||||
label=_("Send an email to attendees"),
|
label=_("Send an email to attendees"),
|
||||||
@@ -1054,7 +1056,7 @@ class MailSettingsForm(FormPlaceholderMixin, SettingsForm):
|
|||||||
mail_text_order_paid_attendee = I18nFormField(
|
mail_text_order_paid_attendee = I18nFormField(
|
||||||
label=_("Text sent to attendees"),
|
label=_("Text sent to attendees"),
|
||||||
required=False,
|
required=False,
|
||||||
widget=I18nTextarea,
|
widget=I18nMarkdownTextarea,
|
||||||
)
|
)
|
||||||
|
|
||||||
mail_subject_order_free = I18nFormField(
|
mail_subject_order_free = I18nFormField(
|
||||||
@@ -1065,7 +1067,7 @@ class MailSettingsForm(FormPlaceholderMixin, SettingsForm):
|
|||||||
mail_text_order_free = I18nFormField(
|
mail_text_order_free = I18nFormField(
|
||||||
label=_("Text sent to order contact address"),
|
label=_("Text sent to order contact address"),
|
||||||
required=False,
|
required=False,
|
||||||
widget=I18nTextarea,
|
widget=I18nMarkdownTextarea,
|
||||||
)
|
)
|
||||||
mail_send_order_free_attendee = forms.BooleanField(
|
mail_send_order_free_attendee = forms.BooleanField(
|
||||||
label=_("Send an email to attendees"),
|
label=_("Send an email to attendees"),
|
||||||
@@ -1081,7 +1083,7 @@ class MailSettingsForm(FormPlaceholderMixin, SettingsForm):
|
|||||||
mail_text_order_free_attendee = I18nFormField(
|
mail_text_order_free_attendee = I18nFormField(
|
||||||
label=_("Text sent to attendees"),
|
label=_("Text sent to attendees"),
|
||||||
required=False,
|
required=False,
|
||||||
widget=I18nTextarea,
|
widget=I18nMarkdownTextarea,
|
||||||
)
|
)
|
||||||
|
|
||||||
mail_subject_order_changed = I18nFormField(
|
mail_subject_order_changed = I18nFormField(
|
||||||
@@ -1092,7 +1094,7 @@ class MailSettingsForm(FormPlaceholderMixin, SettingsForm):
|
|||||||
mail_text_order_changed = I18nFormField(
|
mail_text_order_changed = I18nFormField(
|
||||||
label=_("Text"),
|
label=_("Text"),
|
||||||
required=False,
|
required=False,
|
||||||
widget=I18nTextarea,
|
widget=I18nMarkdownTextarea,
|
||||||
)
|
)
|
||||||
mail_subject_resend_link = I18nFormField(
|
mail_subject_resend_link = I18nFormField(
|
||||||
label=_("Subject (sent by admin)"),
|
label=_("Subject (sent by admin)"),
|
||||||
@@ -1107,7 +1109,7 @@ class MailSettingsForm(FormPlaceholderMixin, SettingsForm):
|
|||||||
mail_text_resend_link = I18nFormField(
|
mail_text_resend_link = I18nFormField(
|
||||||
label=_("Text (sent by admin)"),
|
label=_("Text (sent by admin)"),
|
||||||
required=False,
|
required=False,
|
||||||
widget=I18nTextarea,
|
widget=I18nMarkdownTextarea,
|
||||||
)
|
)
|
||||||
mail_subject_resend_all_links = I18nFormField(
|
mail_subject_resend_all_links = I18nFormField(
|
||||||
label=_("Subject (requested by user)"),
|
label=_("Subject (requested by user)"),
|
||||||
@@ -1117,7 +1119,7 @@ class MailSettingsForm(FormPlaceholderMixin, SettingsForm):
|
|||||||
mail_text_resend_all_links = I18nFormField(
|
mail_text_resend_all_links = I18nFormField(
|
||||||
label=_("Text (requested by user)"),
|
label=_("Text (requested by user)"),
|
||||||
required=False,
|
required=False,
|
||||||
widget=I18nTextarea,
|
widget=I18nMarkdownTextarea,
|
||||||
)
|
)
|
||||||
mail_days_order_expire_warning = forms.IntegerField(
|
mail_days_order_expire_warning = forms.IntegerField(
|
||||||
label=_("Number of days"),
|
label=_("Number of days"),
|
||||||
@@ -1129,7 +1131,7 @@ class MailSettingsForm(FormPlaceholderMixin, SettingsForm):
|
|||||||
mail_text_order_expire_warning = I18nFormField(
|
mail_text_order_expire_warning = I18nFormField(
|
||||||
label=_("Text (if order will expire automatically)"),
|
label=_("Text (if order will expire automatically)"),
|
||||||
required=False,
|
required=False,
|
||||||
widget=I18nTextarea,
|
widget=I18nMarkdownTextarea,
|
||||||
)
|
)
|
||||||
mail_subject_order_expire_warning = I18nFormField(
|
mail_subject_order_expire_warning = I18nFormField(
|
||||||
label=_("Subject (if order will expire automatically)"),
|
label=_("Subject (if order will expire automatically)"),
|
||||||
@@ -1139,7 +1141,7 @@ class MailSettingsForm(FormPlaceholderMixin, SettingsForm):
|
|||||||
mail_text_order_pending_warning = I18nFormField(
|
mail_text_order_pending_warning = I18nFormField(
|
||||||
label=_("Text (if order will not expire automatically)"),
|
label=_("Text (if order will not expire automatically)"),
|
||||||
required=False,
|
required=False,
|
||||||
widget=I18nTextarea,
|
widget=I18nMarkdownTextarea,
|
||||||
)
|
)
|
||||||
mail_subject_order_pending_warning = I18nFormField(
|
mail_subject_order_pending_warning = I18nFormField(
|
||||||
label=_("Subject (if order will not expire automatically)"),
|
label=_("Subject (if order will not expire automatically)"),
|
||||||
@@ -1154,7 +1156,7 @@ class MailSettingsForm(FormPlaceholderMixin, SettingsForm):
|
|||||||
mail_text_order_incomplete_payment = I18nFormField(
|
mail_text_order_incomplete_payment = I18nFormField(
|
||||||
label=_("Text"),
|
label=_("Text"),
|
||||||
required=False,
|
required=False,
|
||||||
widget=I18nTextarea,
|
widget=I18nMarkdownTextarea,
|
||||||
help_text=_("This email only applies to payment methods that can receive incomplete payments, "
|
help_text=_("This email only applies to payment methods that can receive incomplete payments, "
|
||||||
"such as bank transfer."),
|
"such as bank transfer."),
|
||||||
)
|
)
|
||||||
@@ -1166,7 +1168,7 @@ class MailSettingsForm(FormPlaceholderMixin, SettingsForm):
|
|||||||
mail_text_order_payment_failed = I18nFormField(
|
mail_text_order_payment_failed = I18nFormField(
|
||||||
label=_("Text"),
|
label=_("Text"),
|
||||||
required=False,
|
required=False,
|
||||||
widget=I18nTextarea,
|
widget=I18nMarkdownTextarea,
|
||||||
)
|
)
|
||||||
mail_subject_waiting_list = I18nFormField(
|
mail_subject_waiting_list = I18nFormField(
|
||||||
label=_("Subject"),
|
label=_("Subject"),
|
||||||
@@ -1176,7 +1178,7 @@ class MailSettingsForm(FormPlaceholderMixin, SettingsForm):
|
|||||||
mail_text_waiting_list = I18nFormField(
|
mail_text_waiting_list = I18nFormField(
|
||||||
label=_("Text"),
|
label=_("Text"),
|
||||||
required=False,
|
required=False,
|
||||||
widget=I18nTextarea,
|
widget=I18nMarkdownTextarea,
|
||||||
)
|
)
|
||||||
mail_subject_order_canceled = I18nFormField(
|
mail_subject_order_canceled = I18nFormField(
|
||||||
label=_("Subject"),
|
label=_("Subject"),
|
||||||
@@ -1186,12 +1188,12 @@ class MailSettingsForm(FormPlaceholderMixin, SettingsForm):
|
|||||||
mail_text_order_canceled = I18nFormField(
|
mail_text_order_canceled = I18nFormField(
|
||||||
label=_("Text"),
|
label=_("Text"),
|
||||||
required=False,
|
required=False,
|
||||||
widget=I18nTextarea,
|
widget=I18nMarkdownTextarea,
|
||||||
)
|
)
|
||||||
mail_text_order_custom_mail = I18nFormField(
|
mail_text_order_custom_mail = I18nFormField(
|
||||||
label=_("Text"),
|
label=_("Text"),
|
||||||
required=False,
|
required=False,
|
||||||
widget=I18nTextarea,
|
widget=I18nMarkdownTextarea,
|
||||||
)
|
)
|
||||||
mail_subject_download_reminder = I18nFormField(
|
mail_subject_download_reminder = I18nFormField(
|
||||||
label=_("Subject sent to order contact address"),
|
label=_("Subject sent to order contact address"),
|
||||||
@@ -1201,7 +1203,7 @@ class MailSettingsForm(FormPlaceholderMixin, SettingsForm):
|
|||||||
mail_text_download_reminder = I18nFormField(
|
mail_text_download_reminder = I18nFormField(
|
||||||
label=_("Text sent to order contact address"),
|
label=_("Text sent to order contact address"),
|
||||||
required=False,
|
required=False,
|
||||||
widget=I18nTextarea,
|
widget=I18nMarkdownTextarea,
|
||||||
)
|
)
|
||||||
mail_send_download_reminder_attendee = forms.BooleanField(
|
mail_send_download_reminder_attendee = forms.BooleanField(
|
||||||
label=_("Send an email to attendees"),
|
label=_("Send an email to attendees"),
|
||||||
@@ -1217,7 +1219,7 @@ class MailSettingsForm(FormPlaceholderMixin, SettingsForm):
|
|||||||
mail_text_download_reminder_attendee = I18nFormField(
|
mail_text_download_reminder_attendee = I18nFormField(
|
||||||
label=_("Text sent to attendees"),
|
label=_("Text sent to attendees"),
|
||||||
required=False,
|
required=False,
|
||||||
widget=I18nTextarea,
|
widget=I18nMarkdownTextarea,
|
||||||
)
|
)
|
||||||
mail_days_download_reminder = forms.IntegerField(
|
mail_days_download_reminder = forms.IntegerField(
|
||||||
label=_("Number of days"),
|
label=_("Number of days"),
|
||||||
@@ -1234,7 +1236,7 @@ class MailSettingsForm(FormPlaceholderMixin, SettingsForm):
|
|||||||
mail_text_order_placed_require_approval = I18nFormField(
|
mail_text_order_placed_require_approval = I18nFormField(
|
||||||
label=_("Text for received order"),
|
label=_("Text for received order"),
|
||||||
required=False,
|
required=False,
|
||||||
widget=I18nTextarea,
|
widget=I18nMarkdownTextarea,
|
||||||
)
|
)
|
||||||
mail_subject_order_approved = I18nFormField(
|
mail_subject_order_approved = I18nFormField(
|
||||||
label=_("Subject for approved order"),
|
label=_("Subject for approved order"),
|
||||||
@@ -1244,7 +1246,7 @@ class MailSettingsForm(FormPlaceholderMixin, SettingsForm):
|
|||||||
mail_text_order_approved = I18nFormField(
|
mail_text_order_approved = I18nFormField(
|
||||||
label=_("Text for approved order"),
|
label=_("Text for approved order"),
|
||||||
required=False,
|
required=False,
|
||||||
widget=I18nTextarea,
|
widget=I18nMarkdownTextarea,
|
||||||
help_text=_("This will only be sent out for non-free orders. Free orders will receive the free order "
|
help_text=_("This will only be sent out for non-free orders. Free orders will receive the free order "
|
||||||
"template from below instead."),
|
"template from below instead."),
|
||||||
)
|
)
|
||||||
@@ -1262,7 +1264,7 @@ class MailSettingsForm(FormPlaceholderMixin, SettingsForm):
|
|||||||
mail_text_order_approved_attendee = I18nFormField(
|
mail_text_order_approved_attendee = I18nFormField(
|
||||||
label=_("Text sent to attendees"),
|
label=_("Text sent to attendees"),
|
||||||
required=False,
|
required=False,
|
||||||
widget=I18nTextarea,
|
widget=I18nMarkdownTextarea,
|
||||||
help_text=_("This will only be sent out for non-free orders. Free orders will receive the free order "
|
help_text=_("This will only be sent out for non-free orders. Free orders will receive the free order "
|
||||||
"template from below instead."),
|
"template from below instead."),
|
||||||
)
|
)
|
||||||
@@ -1274,7 +1276,7 @@ class MailSettingsForm(FormPlaceholderMixin, SettingsForm):
|
|||||||
mail_text_order_approved_free = I18nFormField(
|
mail_text_order_approved_free = I18nFormField(
|
||||||
label=_("Text for approved free order"),
|
label=_("Text for approved free order"),
|
||||||
required=False,
|
required=False,
|
||||||
widget=I18nTextarea,
|
widget=I18nMarkdownTextarea,
|
||||||
help_text=_("This will only be sent out for free orders. Non-free orders will receive the non-free order "
|
help_text=_("This will only be sent out for free orders. Non-free orders will receive the non-free order "
|
||||||
"template from above instead."),
|
"template from above instead."),
|
||||||
)
|
)
|
||||||
@@ -1292,7 +1294,7 @@ class MailSettingsForm(FormPlaceholderMixin, SettingsForm):
|
|||||||
mail_text_order_approved_free_attendee = I18nFormField(
|
mail_text_order_approved_free_attendee = I18nFormField(
|
||||||
label=_("Text sent to attendees"),
|
label=_("Text sent to attendees"),
|
||||||
required=False,
|
required=False,
|
||||||
widget=I18nTextarea,
|
widget=I18nMarkdownTextarea,
|
||||||
help_text=_("This will only be sent out for free orders. Non-free orders will receive the non-free order "
|
help_text=_("This will only be sent out for free orders. Non-free orders will receive the non-free order "
|
||||||
"template from above instead."),
|
"template from above instead."),
|
||||||
)
|
)
|
||||||
@@ -1304,7 +1306,7 @@ class MailSettingsForm(FormPlaceholderMixin, SettingsForm):
|
|||||||
mail_text_order_denied = I18nFormField(
|
mail_text_order_denied = I18nFormField(
|
||||||
label=_("Text for denied order"),
|
label=_("Text for denied order"),
|
||||||
required=False,
|
required=False,
|
||||||
widget=I18nTextarea,
|
widget=I18nMarkdownTextarea,
|
||||||
)
|
)
|
||||||
base_context = {
|
base_context = {
|
||||||
'mail_text_order_placed': ['event', 'order', 'payments'],
|
'mail_text_order_placed': ['event', 'order', 'payments'],
|
||||||
@@ -1737,7 +1739,7 @@ class ItemMetaPropertyForm(forms.ModelForm):
|
|||||||
|
|
||||||
class ConfirmTextForm(I18nForm):
|
class ConfirmTextForm(I18nForm):
|
||||||
text = I18nFormField(
|
text = I18nFormField(
|
||||||
widget=I18nTextarea,
|
widget=I18nMarkdownTextarea,
|
||||||
widget_kwargs={'attrs': {'rows': '2'}},
|
widget_kwargs={'attrs': {'rows': '2'}},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -36,10 +36,12 @@ from collections import OrderedDict
|
|||||||
|
|
||||||
from django import forms
|
from django import forms
|
||||||
from django.utils.translation import gettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
from i18nfield.forms import I18nFormField, I18nTextarea, I18nTextInput
|
from i18nfield.forms import I18nFormField, I18nTextInput
|
||||||
|
|
||||||
from pretix import settings
|
from pretix import settings
|
||||||
from pretix.base.forms import SecretKeySettingsField, SettingsForm
|
from pretix.base.forms import (
|
||||||
|
I18nMarkdownTextarea, SecretKeySettingsField, SettingsForm,
|
||||||
|
)
|
||||||
from pretix.base.settings import GlobalSettingsObject
|
from pretix.base.settings import GlobalSettingsObject
|
||||||
from pretix.base.signals import register_global_settings
|
from pretix.base.signals import register_global_settings
|
||||||
|
|
||||||
@@ -67,12 +69,12 @@ class GlobalSettingsForm(SettingsForm):
|
|||||||
help_text=_("Will be included as the link in the additional footer text.")
|
help_text=_("Will be included as the link in the additional footer text.")
|
||||||
)),
|
)),
|
||||||
('banner_message', I18nFormField(
|
('banner_message', I18nFormField(
|
||||||
widget=I18nTextarea,
|
widget=I18nMarkdownTextarea,
|
||||||
required=False,
|
required=False,
|
||||||
label=_("Global message banner"),
|
label=_("Global message banner"),
|
||||||
)),
|
)),
|
||||||
('banner_message_detail', I18nFormField(
|
('banner_message_detail', I18nFormField(
|
||||||
widget=I18nTextarea,
|
widget=I18nMarkdownTextarea,
|
||||||
required=False,
|
required=False,
|
||||||
label=_("Global message banner detail text"),
|
label=_("Global message banner detail text"),
|
||||||
)),
|
)),
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ from django_scopes.forms import (
|
|||||||
from i18nfield.forms import I18nFormField, I18nTextarea
|
from i18nfield.forms import I18nFormField, I18nTextarea
|
||||||
|
|
||||||
from pretix.base.channels import get_all_sales_channels
|
from pretix.base.channels import get_all_sales_channels
|
||||||
from pretix.base.forms import I18nFormSet, I18nModelForm
|
from pretix.base.forms import I18nFormSet, I18nMarkdownTextarea, I18nModelForm
|
||||||
from pretix.base.forms.widgets import DatePickerWidget
|
from pretix.base.forms.widgets import DatePickerWidget
|
||||||
from pretix.base.models import (
|
from pretix.base.models import (
|
||||||
Item, ItemCategory, ItemVariation, Question, QuestionOption, Quota,
|
Item, ItemCategory, ItemVariation, Question, QuestionOption, Quota,
|
||||||
@@ -82,6 +82,9 @@ class CategoryForm(I18nModelForm):
|
|||||||
'description',
|
'description',
|
||||||
'is_addon'
|
'is_addon'
|
||||||
]
|
]
|
||||||
|
widgets = {
|
||||||
|
'description': I18nMarkdownTextarea,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
class QuestionForm(I18nModelForm):
|
class QuestionForm(I18nModelForm):
|
||||||
@@ -188,6 +191,7 @@ class QuestionForm(I18nModelForm):
|
|||||||
attrs={'class': 'scrolling-multiple-choice'}
|
attrs={'class': 'scrolling-multiple-choice'}
|
||||||
),
|
),
|
||||||
'dependency_values': forms.SelectMultiple,
|
'dependency_values': forms.SelectMultiple,
|
||||||
|
'help_text': I18nMarkdownTextarea,
|
||||||
}
|
}
|
||||||
field_classes = {
|
field_classes = {
|
||||||
'valid_datetime_min': SplitDateTimeField,
|
'valid_datetime_min': SplitDateTimeField,
|
||||||
@@ -823,6 +827,7 @@ class ItemUpdateForm(I18nModelForm):
|
|||||||
'max_per_order': forms.widgets.NumberInput(attrs={'min': 0}),
|
'max_per_order': forms.widgets.NumberInput(attrs={'min': 0}),
|
||||||
'min_per_order': forms.widgets.NumberInput(attrs={'min': 0}),
|
'min_per_order': forms.widgets.NumberInput(attrs={'min': 0}),
|
||||||
'checkin_text': forms.TextInput(),
|
'checkin_text': forms.TextInput(),
|
||||||
|
'description': I18nMarkdownTextarea,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -47,11 +47,14 @@ from django.utils.translation import (
|
|||||||
gettext_lazy as _, gettext_noop, pgettext_lazy,
|
gettext_lazy as _, gettext_noop, pgettext_lazy,
|
||||||
)
|
)
|
||||||
from django_scopes.forms import SafeModelChoiceField
|
from django_scopes.forms import SafeModelChoiceField
|
||||||
from i18nfield.forms import I18nFormField, I18nTextarea, I18nTextInput
|
from i18nfield.forms import I18nFormField, I18nTextInput
|
||||||
from i18nfield.strings import LazyI18nString
|
from i18nfield.strings import LazyI18nString
|
||||||
|
|
||||||
from pretix.base.email import get_available_placeholders
|
from pretix.base.email import get_available_placeholders
|
||||||
from pretix.base.forms import I18nModelForm, PlaceholderValidator
|
from pretix.base.forms import (
|
||||||
|
I18nMarkdownTextarea, I18nModelForm, MarkdownTextarea,
|
||||||
|
PlaceholderValidator,
|
||||||
|
)
|
||||||
from pretix.base.forms.questions import WrappedPhoneNumberPrefixWidget
|
from pretix.base.forms.questions import WrappedPhoneNumberPrefixWidget
|
||||||
from pretix.base.forms.widgets import (
|
from pretix.base.forms.widgets import (
|
||||||
DatePickerWidget, SplitDateTimePickerWidget, format_placeholders_help_text,
|
DatePickerWidget, SplitDateTimePickerWidget, format_placeholders_help_text,
|
||||||
@@ -699,7 +702,7 @@ class OrderMailForm(forms.Form):
|
|||||||
self.fields['message'] = forms.CharField(
|
self.fields['message'] = forms.CharField(
|
||||||
label=_("Message"),
|
label=_("Message"),
|
||||||
required=True,
|
required=True,
|
||||||
widget=forms.Textarea,
|
widget=MarkdownTextarea,
|
||||||
initial=order.event.settings.mail_text_order_custom_mail.localize(order.locale),
|
initial=order.event.settings.mail_text_order_custom_mail.localize(order.locale),
|
||||||
)
|
)
|
||||||
self.fields['attach_invoices'].queryset = order.invoices.all()
|
self.fields['attach_invoices'].queryset = order.invoices.all()
|
||||||
@@ -716,7 +719,7 @@ class OrderPositionMailForm(OrderMailForm):
|
|||||||
self.fields['message'] = forms.CharField(
|
self.fields['message'] = forms.CharField(
|
||||||
label=_("Message"),
|
label=_("Message"),
|
||||||
required=True,
|
required=True,
|
||||||
widget=forms.Textarea,
|
widget=MarkdownTextarea,
|
||||||
initial=self.order.event.settings.mail_text_order_custom_mail.localize(self.order.locale),
|
initial=self.order.event.settings.mail_text_order_custom_mail.localize(self.order.locale),
|
||||||
)
|
)
|
||||||
self._set_field_placeholders('message', ['event', 'order', 'position'])
|
self._set_field_placeholders('message', ['event', 'order', 'position'])
|
||||||
@@ -883,7 +886,7 @@ class EventCancelForm(FormPlaceholderMixin, forms.Form):
|
|||||||
)
|
)
|
||||||
self.fields['send_message'] = I18nFormField(
|
self.fields['send_message'] = I18nFormField(
|
||||||
label=_('Message'),
|
label=_('Message'),
|
||||||
widget=I18nTextarea,
|
widget=I18nMarkdownTextarea,
|
||||||
required=True,
|
required=True,
|
||||||
widget_kwargs={'attrs': {'data-display-dependency': '#id_send'}},
|
widget_kwargs={'attrs': {'data-display-dependency': '#id_send'}},
|
||||||
locales=self.event.settings.get('locales'),
|
locales=self.event.settings.get('locales'),
|
||||||
@@ -910,7 +913,7 @@ class EventCancelForm(FormPlaceholderMixin, forms.Form):
|
|||||||
)
|
)
|
||||||
self.fields['send_waitinglist_message'] = I18nFormField(
|
self.fields['send_waitinglist_message'] = I18nFormField(
|
||||||
label=_('Message'),
|
label=_('Message'),
|
||||||
widget=I18nTextarea,
|
widget=I18nMarkdownTextarea,
|
||||||
required=True,
|
required=True,
|
||||||
locales=self.event.settings.get('locales'),
|
locales=self.event.settings.get('locales'),
|
||||||
widget_kwargs={'attrs': {'data-display-dependency': '#id_send_waitinglist'}},
|
widget_kwargs={'attrs': {'data-display-dependency': '#id_send_waitinglist'}},
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ from django.utils.safestring import mark_safe
|
|||||||
from django.utils.translation import gettext_lazy as _, pgettext_lazy
|
from django.utils.translation import gettext_lazy as _, pgettext_lazy
|
||||||
from django_scopes.forms import SafeModelChoiceField
|
from django_scopes.forms import SafeModelChoiceField
|
||||||
from i18nfield.forms import (
|
from i18nfield.forms import (
|
||||||
I18nForm, I18nFormField, I18nFormSetMixin, I18nTextarea, I18nTextInput,
|
I18nForm, I18nFormField, I18nFormSetMixin, I18nTextInput,
|
||||||
)
|
)
|
||||||
from phonenumber_field.formfields import PhoneNumberField
|
from phonenumber_field.formfields import PhoneNumberField
|
||||||
from pytz import common_timezones
|
from pytz import common_timezones
|
||||||
@@ -56,7 +56,9 @@ from pytz import common_timezones
|
|||||||
from pretix.api.models import WebHook
|
from pretix.api.models import WebHook
|
||||||
from pretix.api.webhooks import get_all_webhook_events
|
from pretix.api.webhooks import get_all_webhook_events
|
||||||
from pretix.base.customersso.oidc import oidc_validate_and_complete_config
|
from pretix.base.customersso.oidc import oidc_validate_and_complete_config
|
||||||
from pretix.base.forms import I18nModelForm, PlaceholderValidator, SettingsForm
|
from pretix.base.forms import (
|
||||||
|
I18nMarkdownTextarea, I18nModelForm, PlaceholderValidator, SettingsForm,
|
||||||
|
)
|
||||||
from pretix.base.forms.questions import (
|
from pretix.base.forms.questions import (
|
||||||
NamePartsFormField, WrappedPhoneNumberPrefixWidget, get_country_by_locale,
|
NamePartsFormField, WrappedPhoneNumberPrefixWidget, get_country_by_locale,
|
||||||
get_phone_prefix,
|
get_phone_prefix,
|
||||||
@@ -524,7 +526,7 @@ class MailSettingsForm(SettingsForm):
|
|||||||
mail_text_signature = I18nFormField(
|
mail_text_signature = I18nFormField(
|
||||||
label=_("Signature"),
|
label=_("Signature"),
|
||||||
required=False,
|
required=False,
|
||||||
widget=I18nTextarea,
|
widget=I18nMarkdownTextarea,
|
||||||
help_text=_("This will be attached to every email."),
|
help_text=_("This will be attached to every email."),
|
||||||
validators=[PlaceholderValidator([])],
|
validators=[PlaceholderValidator([])],
|
||||||
widget_kwargs={'attrs': {
|
widget_kwargs={'attrs': {
|
||||||
@@ -543,7 +545,7 @@ class MailSettingsForm(SettingsForm):
|
|||||||
mail_text_customer_registration = I18nFormField(
|
mail_text_customer_registration = I18nFormField(
|
||||||
label=_("Text"),
|
label=_("Text"),
|
||||||
required=False,
|
required=False,
|
||||||
widget=I18nTextarea,
|
widget=I18nMarkdownTextarea,
|
||||||
)
|
)
|
||||||
mail_subject_customer_email_change = I18nFormField(
|
mail_subject_customer_email_change = I18nFormField(
|
||||||
label=_("Subject"),
|
label=_("Subject"),
|
||||||
@@ -553,7 +555,7 @@ class MailSettingsForm(SettingsForm):
|
|||||||
mail_text_customer_email_change = I18nFormField(
|
mail_text_customer_email_change = I18nFormField(
|
||||||
label=_("Text"),
|
label=_("Text"),
|
||||||
required=False,
|
required=False,
|
||||||
widget=I18nTextarea,
|
widget=I18nMarkdownTextarea,
|
||||||
)
|
)
|
||||||
mail_subject_customer_reset = I18nFormField(
|
mail_subject_customer_reset = I18nFormField(
|
||||||
label=_("Subject"),
|
label=_("Subject"),
|
||||||
@@ -563,7 +565,7 @@ class MailSettingsForm(SettingsForm):
|
|||||||
mail_text_customer_reset = I18nFormField(
|
mail_text_customer_reset = I18nFormField(
|
||||||
label=_("Text"),
|
label=_("Text"),
|
||||||
required=False,
|
required=False,
|
||||||
widget=I18nTextarea,
|
widget=I18nMarkdownTextarea,
|
||||||
)
|
)
|
||||||
|
|
||||||
base_context = {
|
base_context = {
|
||||||
|
|||||||
@@ -45,7 +45,9 @@ from django.utils.translation import gettext_lazy as _, pgettext_lazy
|
|||||||
from django_scopes.forms import SafeModelChoiceField
|
from django_scopes.forms import SafeModelChoiceField
|
||||||
|
|
||||||
from pretix.base.email import get_available_placeholders
|
from pretix.base.email import get_available_placeholders
|
||||||
from pretix.base.forms import I18nModelForm, PlaceholderValidator
|
from pretix.base.forms import (
|
||||||
|
I18nModelForm, MarkdownTextarea, PlaceholderValidator,
|
||||||
|
)
|
||||||
from pretix.base.forms.widgets import format_placeholders_help_text
|
from pretix.base.forms.widgets import format_placeholders_help_text
|
||||||
from pretix.base.models import Item, Voucher
|
from pretix.base.models import Item, Voucher
|
||||||
from pretix.control.forms import SplitDateTimeField, SplitDateTimePickerWidget
|
from pretix.control.forms import SplitDateTimeField, SplitDateTimePickerWidget
|
||||||
@@ -271,7 +273,7 @@ class VoucherBulkForm(VoucherForm):
|
|||||||
)
|
)
|
||||||
send_message = forms.CharField(
|
send_message = forms.CharField(
|
||||||
label=_("Message"),
|
label=_("Message"),
|
||||||
widget=forms.Textarea(attrs={'data-display-dependency': '#id_send'}),
|
widget=MarkdownTextarea(attrs={'data-display-dependency': '#id_send'}),
|
||||||
required=False,
|
required=False,
|
||||||
initial=_('Hello,\n\n'
|
initial=_('Hello,\n\n'
|
||||||
'with this email, we\'re sending you one or more vouchers for {event}:\n\n{voucher_list}\n\n'
|
'with this email, we\'re sending you one or more vouchers for {event}:\n\n{voucher_list}\n\n'
|
||||||
|
|||||||
@@ -39,9 +39,9 @@ from django.core.exceptions import ValidationError
|
|||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from django.utils.translation import gettext_lazy as _, pgettext_lazy
|
from django.utils.translation import gettext_lazy as _, pgettext_lazy
|
||||||
from django_scopes.forms import SafeModelMultipleChoiceField
|
from django_scopes.forms import SafeModelMultipleChoiceField
|
||||||
from i18nfield.forms import I18nFormField, I18nTextarea, I18nTextInput
|
from i18nfield.forms import I18nFormField, I18nTextInput
|
||||||
|
|
||||||
from pretix.base.forms import I18nModelForm
|
from pretix.base.forms import I18nMarkdownTextarea, I18nModelForm
|
||||||
from pretix.base.forms.widgets import (
|
from pretix.base.forms.widgets import (
|
||||||
SplitDateTimePickerWidget, TimePickerWidget,
|
SplitDateTimePickerWidget, TimePickerWidget,
|
||||||
)
|
)
|
||||||
@@ -76,7 +76,7 @@ class BaseMailForm(FormPlaceholderMixin, forms.Form):
|
|||||||
)
|
)
|
||||||
self.fields['message'] = I18nFormField(
|
self.fields['message'] = I18nFormField(
|
||||||
label=_('Message'),
|
label=_('Message'),
|
||||||
widget=I18nTextarea, required=True,
|
widget=I18nMarkdownTextarea, required=True,
|
||||||
locales=event.settings.get('locales'),
|
locales=event.settings.get('locales'),
|
||||||
)
|
)
|
||||||
self._set_field_placeholders('subject', context_parameters)
|
self._set_field_placeholders('subject', context_parameters)
|
||||||
@@ -317,6 +317,7 @@ class RuleForm(FormPlaceholderMixin, I18nModelForm):
|
|||||||
),
|
),
|
||||||
'send_to': forms.RadioSelect,
|
'send_to': forms.RadioSelect,
|
||||||
'checked_in_status': forms.RadioSelect,
|
'checked_in_status': forms.RadioSelect,
|
||||||
|
'template': I18nMarkdownTextarea,
|
||||||
}
|
}
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 208 128"><path d="M193 128H15a15 15 0 0 1-15-15V15A15 15 0 0 1 15 0h178a15 15 0 0 1 15 15v98a15 15 0 0 1-15 15zM50 98V59l20 25 20-25v39h20V30H90L70 55 50 30H30v68zm134-34h-20V30h-20v34h-20l30 35z"/></svg>
|
||||||
|
After Width: | Height: | Size: 257 B |
@@ -147,8 +147,27 @@ div[data-formset-body], div[data-formset-form], div[data-nested-formset-form], d
|
|||||||
padding: 5px 0;
|
padding: 5px 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.i18n-form-group .i18n-field-markdown-note {
|
||||||
|
border: 1px solid $input-border;
|
||||||
|
color: $text-muted;
|
||||||
|
font-size: 0.8em;
|
||||||
|
padding: 0.2em;
|
||||||
|
&::before {
|
||||||
|
display: inline-block;
|
||||||
|
height: 0.6em;
|
||||||
|
width: 1.5em;
|
||||||
|
position: relative;
|
||||||
|
top: 0.1em;
|
||||||
|
left: 0.1em;
|
||||||
|
opacity: 50%;
|
||||||
|
margin-right: 0.5em;
|
||||||
|
content: url(static('pretixcontrol/img/icons/markdown-mark-solid.svg'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.i18n-form-group input,
|
.i18n-form-group input,
|
||||||
.i18n-form-group textarea {
|
.i18n-form-group textarea,
|
||||||
|
.i18n-form-group .i18n-field-markdown-note {
|
||||||
@include border-top-radius(0px);
|
@include border-top-radius(0px);
|
||||||
@include border-bottom-radius(0px);
|
@include border-bottom-radius(0px);
|
||||||
border-top-width: 0;
|
border-top-width: 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user