Widget: Add a compatibility mode for Jimdo

This commit is contained in:
Raphael Michel
2018-04-04 10:07:10 +02:00
parent 7939503a11
commit 0ad3ec444c
5 changed files with 37 additions and 3 deletions

View File

@@ -983,6 +983,11 @@ class WidgetCodeForm(forms.Form):
"bought via the widget, this voucher will be used. This can for example be used to provide "
"widgets that give discounts or unlock secret products.")
)
compatibility_mode = forms.BooleanField(
label=_("Compatibility mode"),
help_text=_("Our regular widget doesn't work in all website builders. If you run into trouble, try using "
"this compatibility mode.")
)
def __init__(self, *args, **kwargs):
self.event = kwargs.pop('event')

View File

@@ -31,6 +31,20 @@
{% else %}
{% abseventurl request.event "presale:event.index" as indexurl %}
{% endif %}
{% if form.cleaned_data.compatibility_mode %}
<pre>&lt;div class="pretix-widget-compat" event="{% abseventurl request.event "presale:event.index" %}"{% if form.cleaned_data.subevent %} subevent="{{ form.cleaned_data.subevent.pk }}"{% endif %}{% if form.cleaned_data.voucher %} voucher="{{ form.cleaned_data.voucher }}"{% endif %}&gt;&lt;/div&gt;
&lt;noscript&gt;
&lt;div class="pretix-widget"&gt;
&lt;div class="pretix-widget-info-message"&gt;
{% blocktrans trimmed with a_attr='target="_blank" rel="noopener" href="'|add:indexurl|add:'"'|safe %}
JavaScript is disabled in your browser. To access our ticket shop without JavaScript,
please &lt;a {{ a_attr }}&gt;click here&lt;/a&gt;.
{% endblocktrans %}
&lt;/div&gt;
&lt;/div&gt;
&lt;/noscript&gt;
</pre>
{% else %}
<pre>&lt;pretix-widget event="{% abseventurl request.event "presale:event.index" %}"{% if form.cleaned_data.subevent %} subevent="{{ form.cleaned_data.subevent.pk }}"{% endif %}{% if form.cleaned_data.voucher %} voucher="{{ form.cleaned_data.voucher }}"{% endif %}&gt;&lt;/pretix-widget&gt;
&lt;noscript&gt;
&lt;div class="pretix-widget"&gt;
@@ -43,6 +57,7 @@
&lt;/div&gt;
&lt;/noscript&gt;
</pre>
{% endif %}
<p>
<a href="https://docs.pretix.eu/en/latest/user/events/widget.html" target="_blank" rel="noopener">
<span class="fa fa-question-circle"></span>