diff --git a/doc/user/events/widget.rst b/doc/user/events/widget.rst index 289615798..f46f747c2 100644 --- a/doc/user/events/widget.rst +++ b/doc/user/events/widget.rst @@ -96,6 +96,18 @@ attribute:: +Always show event’s info +------------------------ + +If you want the widget to show the event’s info such as title, location and frontpage text, you can pass the optional +``display-event-info`` attribute with either a value of ``"false"``, ``"true"`` or ``"auto"`` – the latter being the +default if the attribute is not present at all. + +Note that any other value than ``"false"`` or ``"auto"`` means ``"true"``:: + + + + Pre-selecting a voucher ----------------------- diff --git a/src/pretix/static/pretixpresale/js/widget/widget.js b/src/pretix/static/pretixpresale/js/widget/widget.js index 9693652d9..92e76af03 100644 --- a/src/pretix/static/pretixpresale/js/widget/widget.js +++ b/src/pretix/static/pretixpresale/js/widget/widget.js @@ -999,20 +999,20 @@ Vue.component('pretix-widget-event-form', { + '' // Event name - + '
' + + '
' + '{{ $root.name }}' + '
' // Date range - + '
' + + '
' + '{{ $root.date_range }}' + '
' - // Date range - + '
' + // Location + + '
' // Form start - + '
' + + '
' + '
' + '' + '' @@ -1097,6 +1097,9 @@ Vue.component('pretix-widget-event-form', { this.$root.$off('focus_voucher_field', this.focus_voucher_field) }, computed: { + display_event_info: function () { + return this.$root.display_event_info || (this.$root.display_event_info === null && (this.$root.events || this.$root.weeks || this.$root.days)); + }, id_cart_exists_msg: function () { return this.$root.html_id + '-cart-exists'; }, @@ -1259,14 +1262,19 @@ Vue.component('pretix-widget-event-list', { + strings['back'] + '' + '
' - + '
' + + '
' + '{{ $root.name }}' + '
' - + '
' + + '
' + '' + '' + '

' + '
'), + computed: { + display_event_info: function () { + return this.$root.display_event_info || (this.$root.display_event_info === null && this.$root.parent_stack.length > 0); + }, + }, methods: { back_to_calendar: function () { this.$root.offset = 0; @@ -1477,10 +1485,10 @@ Vue.component('pretix-widget-event-calendar', { + '
' // Headline - + '
' + + '
' + '{{ $root.name }}' + '
' - + '
' + + '
' // Filter + '' @@ -1515,6 +1523,9 @@ Vue.component('pretix-widget-event-calendar', { + '' + '
'), computed: { + display_event_info: function () { + return this.$root.display_event_info || (this.$root.display_event_info === null && this.$root.parent_stack.length > 0); + }, monthname: function () { return strings['months'][this.$root.date.substr(5, 2)] + ' ' + this.$root.date.substr(0, 4); } @@ -1563,7 +1574,7 @@ Vue.component('pretix-widget-event-week-calendar', { + '' // Event header - + '
' + + '
' + '{{ $root.name }}' + '
' @@ -1571,7 +1582,7 @@ Vue.component('pretix-widget-event-week-calendar', { + '' // Calendar navigation - + '
' + + '
' + '
' + '« ' + strings['previous_week'] @@ -1593,11 +1604,14 @@ Vue.component('pretix-widget-event-week-calendar', { + '
' + '
'), computed: { + display_event_info: function () { + return this.$root.display_event_info || (this.$root.display_event_info === null && this.$root.parent_stack.length > 0); + }, weekname: function () { var curWeek = this.$root.week[1]; var curYear = this.$root.week[0]; return curWeek + ' / ' + curYear; - } + }, }, methods: { back_to_list: function () { @@ -2089,6 +2103,12 @@ var create_widget = function (element, html_id=null) { var disable_iframe = element.attributes["disable-iframe"] ? true : false; var disable_vouchers = element.attributes["disable-vouchers"] ? true : false; var disable_filters = element.attributes["disable-filters"] ? true : false; + var display_event_info = element.getAttribute("display-event-info"); // null means "auto" (as before), everything other than "false" is true + if (display_event_info !== null && display_event_info !== "auto") { + display_event_info = display_event_info !== "false"; + } else { + display_event_info = null; + } var widget_data = JSON.parse(JSON.stringify(window.PretixWidget.widget_data)); var filter = element.attributes.filter ? element.attributes.filter.value : null; var items = element.attributes.items ? element.attributes.items.value : null; @@ -2165,6 +2185,7 @@ var create_widget = function (element, html_id=null) { vouchers_exist: false, disable_vouchers: disable_vouchers, disable_filters: disable_filters, + display_event_info: display_event_info, cart_exists: false, itemcount: 0, overlay: null,