diff --git a/src/pretix/static/pretixpresale/js/widget/widget.js b/src/pretix/static/pretixpresale/js/widget/widget.js index fd15d132a0..98924f9ee0 100644 --- a/src/pretix/static/pretixpresale/js/widget/widget.js +++ b/src/pretix/static/pretixpresale/js/widget/widget.js @@ -193,7 +193,7 @@ var widget_id = makeid(16); Vue.component('availbox', { template: ('
' + '
' - + '' + strings.voucher_required + '' + + '' + strings.voucher_required + '' + '
' + '
' @@ -279,6 +279,11 @@ Vue.component('availbox', { } return u } + }, + methods: { + focus_voucher_field: function () { + this.$root.$emit('focus_voucher_field') + } } }); Vue.component('pricebox', { @@ -796,7 +801,7 @@ Vue.component('pretix-widget-event-form', { + '

'+ strings['redeem_voucher'] +'

' + '
{{ $root.voucher_explanation_text }}
' + '
' - + '' + + '' + '
' + '' + '' @@ -815,10 +820,12 @@ Vue.component('pretix-widget-event-form', { }, mounted: function() { this.$root.$on('amounts_changed', this.calculate_buy_disabled) + this.$root.$on('focus_voucher_field', this.focus_voucher_field) this.calculate_buy_disabled() }, beforeDestroy: function() { this.$root.$off('amounts_changed', this.calculate_buy_disabled) + this.$root.$off('focus_voucher_field', this.focus_voucher_field) }, computed: { buy_label: function () { @@ -851,6 +858,10 @@ Vue.component('pretix-widget-event-form', { } }, methods: { + focus_voucher_field: function() { + this.$refs.voucherinput.scrollIntoView(false) + this.$refs.voucherinput.focus() + }, back_to_list: function() { this.$root.target_url = this.$root.parent_stack.pop(); this.$root.error = null;