mirror of
https://github.com/pretix/pretix.git
synced 2026-05-10 16:04:02 +00:00
Widget: Allow to disable voucher input
This commit is contained in:
@@ -107,6 +107,13 @@ voucher's settings.
|
|||||||
</div>
|
</div>
|
||||||
</noscript>
|
</noscript>
|
||||||
|
|
||||||
|
Disabling the voucher input
|
||||||
|
---------------------------
|
||||||
|
|
||||||
|
If you want to disable voucher input in the widget, you can pass the ``disable-vouchers`` attribute::
|
||||||
|
|
||||||
|
<pretix-widget event="https://pretix.eu/demo/democon/" disable-vouchers></pretix-widget>
|
||||||
|
|
||||||
pretix Button
|
pretix Button
|
||||||
-------------
|
-------------
|
||||||
|
|
||||||
|
|||||||
@@ -569,7 +569,8 @@ Vue.component('pretix-widget', {
|
|||||||
+ '<button @click="buy" type="submit">' + strings.buy + '</button>'
|
+ '<button @click="buy" type="submit">' + strings.buy + '</button>'
|
||||||
+ '</div>'
|
+ '</div>'
|
||||||
+ '</form>'
|
+ '</form>'
|
||||||
+ '<form method="get" :action="$root.voucherFormTarget" target="_blank" v-if="$root.vouchers_exist && !$root.voucher_code">'
|
+ '<form method="get" :action="$root.voucherFormTarget" target="_blank" '
|
||||||
|
+ ' v-if="$root.vouchers_exist && !$root.disable_vouchers && !$root.voucher_code">'
|
||||||
+ '<div class="pretix-widget-voucher">'
|
+ '<div class="pretix-widget-voucher">'
|
||||||
+ '<h3 class="pretix-widget-voucher-headline">'+ strings['redeem_voucher'] +'</h3>'
|
+ '<h3 class="pretix-widget-voucher-headline">'+ strings['redeem_voucher'] +'</h3>'
|
||||||
+ '<div class="pretix-widget-voucher-input-wrap">'
|
+ '<div class="pretix-widget-voucher-input-wrap">'
|
||||||
@@ -727,6 +728,7 @@ var create_widget = function (element) {
|
|||||||
var voucher = element.attributes.voucher ? element.attributes.voucher.value : null;
|
var voucher = element.attributes.voucher ? element.attributes.voucher.value : null;
|
||||||
var subevent = element.attributes.subevent ? element.attributes.subevent.value : null;
|
var subevent = element.attributes.subevent ? element.attributes.subevent.value : null;
|
||||||
var skip_ssl = element.attributes["skip-ssl-check"] ? true : false;
|
var skip_ssl = element.attributes["skip-ssl-check"] ? true : false;
|
||||||
|
var disable_vouchers = element.attributes["disable-vouchers"] ? true : false;
|
||||||
|
|
||||||
if (element.tagName !== "pretix-widget") {
|
if (element.tagName !== "pretix-widget") {
|
||||||
element.innerHTML = "<pretix-widget></pretix-widget>";
|
element.innerHTML = "<pretix-widget></pretix-widget>";
|
||||||
@@ -753,6 +755,7 @@ var create_widget = function (element) {
|
|||||||
error_message: null,
|
error_message: null,
|
||||||
error_url_after: null,
|
error_url_after: null,
|
||||||
vouchers_exist: false,
|
vouchers_exist: false,
|
||||||
|
disable_vouchers: disable_vouchers,
|
||||||
cart_exists: false,
|
cart_exists: false,
|
||||||
itemcount: 0
|
itemcount: 0
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user