Widget: Auto-open seating plan in some situations

This commit is contained in:
Raphael Michel
2019-11-19 22:48:47 +01:00
parent ee96fb2ca1
commit 180963c787

View File

@@ -579,26 +579,6 @@ var shared_methods = {
window.open(redirect_url); window.open(redirect_url);
} }
}, },
startseating: function () {
var redirect_url = this.$root.target_url + 'w/' + widget_id;
if (this.$root.subevent){
redirect_url += '/' + this.$root.subevent;
}
redirect_url += '/seatingframe/?iframe=1&locale=' + lang;
if (this.$root.cart_id) {
redirect_url += '&take_cart_id=' + this.$root.cart_id;
}
if (this.$root.widget_data) {
redirect_url += '&widget_data=' + escape(this.$root.widget_data_json);
}
if (this.$root.useIframe) {
var iframe = this.$root.overlay.$children[0].$refs['frame-container'].children[0];
this.$root.overlay.frame_loading = true;
iframe.src = redirect_url;
} else {
window.open(redirect_url);
}
},
handleResize: function () { handleResize: function () {
this.mobile = this.$refs.wrapper.clientWidth <= 800; this.mobile = this.$refs.wrapper.clientWidth <= 800;
} }
@@ -683,6 +663,7 @@ Vue.component('pretix-overlay', {
}, },
close: function () { close: function () {
this.$root.frame_shown = false; this.$root.frame_shown = false;
this.$root.parent.frame_dismissed = true;
this.$root.parent.reload(); this.$root.parent.reload();
}, },
iframeLoaded: function () { iframeLoaded: function () {
@@ -721,7 +702,7 @@ Vue.component('pretix-widget-event-form', {
+ '<div class="pretix-widget-clear"></div>' + '<div class="pretix-widget-clear"></div>'
+ '</div>' + '</div>'
+ '<div class="pretix-widget-seating-link-wrapper" v-if="this.$root.has_seating_plan">' + '<div class="pretix-widget-seating-link-wrapper" v-if="this.$root.has_seating_plan">'
+ '<button class="pretix-widget-seating-link" @click.prevent="$parent.startseating">' + '<button class="pretix-widget-seating-link" @click.prevent="$root.startseating">'
+ strings['show_seating'] + strings['show_seating']
+ '</button>' + '</button>'
+ '</div>' + '</div>'
@@ -1161,6 +1142,11 @@ var shared_root_methods = {
root.loading--; root.loading--;
root.trigger_load_callback(); root.trigger_load_callback();
} }
if (root.parent_stack.length > 0 && root.has_seating_plan && root.categories.length === 0 && !root.frame_dismissed && root.useIframe) {
// If we're on desktop and someone selects a seating-only event in a calendar, let's open it right away,
// but only if the person didn't close it before.
root.startseating()
}
}, function (error) { }, function (error) {
root.categories = []; root.categories = [];
root.currency = ''; root.currency = '';
@@ -1171,6 +1157,26 @@ var shared_root_methods = {
} }
}); });
}, },
startseating: function () {
var redirect_url = this.$root.target_url + 'w/' + widget_id;
if (this.$root.subevent){
redirect_url += '/' + this.$root.subevent;
}
redirect_url += '/seatingframe/?iframe=1&locale=' + lang;
if (this.$root.cart_id) {
redirect_url += '&take_cart_id=' + this.$root.cart_id;
}
if (this.$root.widget_data) {
redirect_url += '&widget_data=' + escape(this.$root.widget_data_json);
}
if (this.$root.useIframe) {
var iframe = this.$root.overlay.$children[0].$refs['frame-container'].children[0];
this.$root.overlay.frame_loading = true;
iframe.src = redirect_url;
} else {
window.open(redirect_url);
}
},
choose_event: function (event) { choose_event: function (event) {
root.target_url = event.event_url; root.target_url = event.event_url;
this.$root.error = null; this.$root.error = null;
@@ -1314,6 +1320,7 @@ var create_widget = function (element) {
error: null, error: null,
weeks: null, weeks: null,
date: null, date: null,
frame_dismissed: false,
events: null, events: null,
view: null, view: null,
display_add_to_cart: false, display_add_to_cart: false,
@@ -1382,6 +1389,7 @@ var create_button = function (element) {
items: items, items: items,
error: null, error: null,
filter: null, filter: null,
frame_dismissed: false,
widget_data: widget_data, widget_data: widget_data,
widget_id: 'pretix-widget-' + widget_id, widget_id: 'pretix-widget-' + widget_id,
button_text: button_text button_text: button_text