Widget: Add voucher explanation text

This commit is contained in:
Raphael Michel
2019-05-06 11:33:48 +02:00
parent 53053f19e4
commit c23f71a19c
3 changed files with 8 additions and 0 deletions

View File

@@ -434,6 +434,7 @@ class WidgetAPIProductList(EventListMixin, View):
'display_net_prices': request.event.settings.display_net_prices,
'show_variations_expanded': request.event.settings.show_variations_expanded,
'waiting_list_enabled': request.event.settings.waiting_list_enabled,
'voucher_explanation_text': str(request.event.settings.voucher_explanation_text),
'error': None,
'cart_exists': False
}

View File

@@ -680,6 +680,7 @@ Vue.component('pretix-widget-event-form', {
+ ' v-if="$root.vouchers_exist && !$root.disable_vouchers && !$root.voucher_code">'
+ '<div class="pretix-widget-voucher">'
+ '<h3 class="pretix-widget-voucher-headline">'+ strings['redeem_voucher'] +'</h3>'
+ '<div v-if="$root.voucher_explanation_text" class="pretix-widget-voucher-text">{{ $root.voucher_explanation_text }}</div>'
+ '<div class="pretix-widget-voucher-input-wrap">'
+ '<input class="pretix-widget-voucher-input" type="text" v-model="$parent.voucher" name="voucher" placeholder="'+strings.voucher_code+'">'
+ '</div>'
@@ -1045,6 +1046,7 @@ var shared_root_methods = {
root.categories = data.items_by_category;
root.currency = data.currency;
root.display_net_prices = data.display_net_prices;
root.voucher_explanation_text = data.voucher_explanation_text;
root.error = data.error;
root.display_add_to_cart = data.display_add_to_cart;
root.waiting_list_enabled = data.waiting_list_enabled;
@@ -1200,6 +1202,7 @@ var create_widget = function (element) {
name: null,
voucher_code: voucher,
display_net_prices: false,
voucher_explanation_text: null,
show_variations_expanded: false,
skip_ssl: skip_ssl,
style: style,

View File

@@ -273,6 +273,10 @@
.pretix-widget-voucher-headline {
margin: 10px 0 0 0;
}
.pretix-widget-voucher-text {
margin: 10px 0;
padding: 0 15px;
}
.pretix-widget-voucher-input-wrap {
padding: 0 15px;