Improve UX of ticket download settings

This commit is contained in:
Raphael Michel
2020-04-02 18:16:22 +02:00
parent 7b1e1a48ef
commit 0c0fe58bbf
6 changed files with 66 additions and 41 deletions

View File

@@ -820,8 +820,8 @@ DEFAULTS = {
'serializer_class': serializers.BooleanField,
'form_class': forms.BooleanField,
'form_kwargs': dict(
label=_("Use feature"),
help_text=_("Use pretix to generate tickets for the user to download and print out."),
label=_("Allow users to download tickets"),
help_text=_("If this is off, nobody can download a ticket."),
)
},
'ticket_download_date': {
@@ -842,7 +842,11 @@ DEFAULTS = {
'serializer_class': serializers.BooleanField,
'form_class': forms.BooleanField,
'form_kwargs': dict(
label=_("Offer to download tickets separately for add-on products"),
label=_("Generate tickets for add-on products"),
help_text=_('By default, tickets are only issued for products selected individually, not for add-on '
'products. With this option, a separate ticket is issued for every add-on product as well.'),
widget=forms.CheckboxInput(attrs={'data-checkbox-dependency': '#id_ticket_download',
'data-checkbox-dependency-visual': 'on'}),
)
},
'ticket_download_nonadm': {
@@ -851,7 +855,11 @@ DEFAULTS = {
'serializer_class': serializers.BooleanField,
'form_class': forms.BooleanField,
'form_kwargs': dict(
label=_("Generate tickets for non-admission products"),
label=_("Generate tickets for all products"),
help_text=_('If turned off, tickets are only issued for products that are marked as an "admission ticket"'
'in the product settings. You can also turn off tickt issuing in every product separately.'),
widget=forms.CheckboxInput(attrs={'data-checkbox-dependency': '#id_ticket_download',
'data-checkbox-dependency-visual': 'on'}),
)
},
'ticket_download_pending': {
@@ -860,7 +868,10 @@ DEFAULTS = {
'serializer_class': serializers.BooleanField,
'form_class': forms.BooleanField,
'form_kwargs': dict(
label=_("Offer to download tickets even before an order is paid"),
label=_("Generate tickets for pending orders"),
help_text=_('If turned off, ticket downloads are only possible after an order has been marked as paid.'),
widget=forms.CheckboxInput(attrs={'data-checkbox-dependency': '#id_ticket_download',
'data-checkbox-dependency-visual': 'on'}),
)
},
'event_list_availability': {

View File

@@ -142,7 +142,7 @@ class BaseTicketOutput:
return OrderedDict([
('_enabled',
forms.BooleanField(
label=_('Enable output'),
label=_('Enable ticket format'),
required=False,
)),
])

View File

@@ -1,11 +1,12 @@
{% extends "pretixcontrol/event/settings_base.html" %}
{% load i18n %}
{% load getitem %}
{% load bootstrap3 %}
{% block inside %}
<form action="" method="post" class="form-horizontal" enctype="multipart/form-data">
{% csrf_token %}
<h1>{% trans "Ticket download" %}</h1>
<div class="tabbed-form">
<div class="">
<fieldset>
<legend>{% trans "Download settings" %}</legend>
{% if request.event.settings.ticket_download and not any_enabled %}
@@ -17,11 +18,10 @@
</div>
{% endif %}
{% bootstrap_form_errors form %}
{% bootstrap_field form.ticket_download layout="control" %}
{% bootstrap_field form.ticket_download_date layout="control" %}
{% bootstrap_field form.ticket_download_addons layout="control" %}
{% bootstrap_field form.ticket_download_nonadm layout="control" %}
{% bootstrap_field form.ticket_download_pending layout="control" %}
{% bootstrap_field form.ticket_download layout="control" horizontal_label_class='sr-only' horizontal_field_class='col-md-12' %}
{% bootstrap_field form.ticket_download_addons layout="control" horizontal_label_class='sr-only' horizontal_field_class='col-md-12' %}
{% bootstrap_field form.ticket_download_nonadm layout="control" horizontal_label_class='sr-only' horizontal_field_class='col-md-12' %}
{% bootstrap_field form.ticket_download_pending layout="control" horizontal_label_class='sr-only' horizontal_field_class='col-md-12' %}
</fieldset>
<fieldset>
<legend>{% trans "Download formats" %}</legend>
@@ -33,11 +33,15 @@
target="_blank">
{% trans "Preview" %}
</a>
<h3 class="panel-title">{{ provider.verbose_name }}</h3>
<h3 class="panel-title">
{% with 'ticketoutput_'|add:provider.identifier|add:'__enabled' as field_name %}
{% bootstrap_field provider.form|getitem:field_name layout='inline' label=provider.verbose_name %}
{% endwith %}
</h3>
<div class="clear"></div>
</div>
<div class="panel-body">
{% bootstrap_form provider.form layout='horizontal' %}
{% bootstrap_form provider.form exclude='ticketoutput_'|add:provider.identifier|add:'__enabled' layout='horizontal' %}
{% with c=provider.settings_content %}
{% if c %}{{ c|safe }}{% endif %}
{% endwith %}
@@ -53,6 +57,10 @@
</div>
{% endfor %}
</fieldset>
<fieldset>
<legend>{% trans "Download time" %}</legend>
{% bootstrap_field form.ticket_download_date layout="control" %}
</fieldset>
</div>
<div class="form-group submit-group">
<button type="submit" class="btn btn-primary btn-save">

View File

@@ -1,26 +1,20 @@
{% load i18n %}
<div class="form-group">
<label class="col-md-3 control-label">
{% trans "Ticket design" %}
</label>
<div class="col-md-9">
<p>
{% blocktrans trimmed %}
You can customize the ticket design with our PDF ticket editor. There, you can upload a PDF file used
as a background for the tickets and then place various texts and QR codes on the background at the
positions of your choice. The editor is easy to use thanks to its drag-and-drop user interface, but it
requires a modern browser and a decent internet connection.
{% endblocktrans %}
</p>
<p>
<a class="btn btn-primary" target="_blank"
href="{% url "plugins:ticketoutputpdf:getdefault" organizer=request.organizer.slug event=request.event.slug %}">
{% trans "Change default layout in a new tab" %}
</a>
<a class="btn btn-default" target="_blank"
href="{% url "plugins:ticketoutputpdf:index" organizer=request.organizer.slug event=request.event.slug %}">
{% trans "Advanced mode (multiple layouts)" %}
</a>
</p>
</div>
</div>
<p>
{% blocktrans trimmed %}
You can customize the ticket design with our PDF ticket editor. There, you can upload a PDF file used
as a background for the tickets and then place various texts and QR codes on the background at the
positions of your choice. The editor is easy to use thanks to its drag-and-drop user interface, but it
requires a modern browser and a decent internet connection.
{% endblocktrans %}
</p>
<p>
<a class="btn btn-primary btn-lg" target="_blank"
href="{% url "plugins:ticketoutputpdf:getdefault" organizer=request.organizer.slug event=request.event.slug %}">
<span class="fa fa-paint-brush"></span>
{% trans "Open Layout Designer" %}
</a>
<a class="btn btn-default btn-lg" target="_blank"
href="{% url "plugins:ticketoutputpdf:index" organizer=request.organizer.slug event=request.event.slug %}">
{% trans "Advanced mode (multiple layouts)" %}
</a>
</p>

View File

@@ -251,7 +251,7 @@ var form_handlers = function (el) {
update = function () {
var enabled = dependency.prop('checked');
dependent.prop('disabled', !enabled).parents('.form-group').toggleClass('disabled', !enabled);
if (!enabled) {
if (!enabled && !$(this).is('[data-checkbox-dependency-visual]')) {
dependent.prop('checked', false);
}
};
@@ -750,4 +750,4 @@ $(document).ready(function () {
$('form[method=post]').filter(function () {
return $(this).find("button:not([type=button]), input[type=submit]").length > 0;
}).areYouSure( {'message': gettext('You have unsaved changes!')});
});
});

View File

@@ -406,6 +406,18 @@ table td > .checkbox input[type="checkbox"] {
line-height: 40px;
}
}
.ticketoutput-panel .panel-heading {
.checkbox {
padding: 0;
input[type=checkbox] {
margin-top: 0;
margin-right: 5px;
margin-left: 0px;
position: relative;
top: 1px;
}
}
}
.accordion-radio {
display: block;
margin: 0;