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, 'serializer_class': serializers.BooleanField,
'form_class': forms.BooleanField, 'form_class': forms.BooleanField,
'form_kwargs': dict( 'form_kwargs': dict(
label=_("Use feature"), label=_("Allow users to download tickets"),
help_text=_("Use pretix to generate tickets for the user to download and print out."), help_text=_("If this is off, nobody can download a ticket."),
) )
}, },
'ticket_download_date': { 'ticket_download_date': {
@@ -842,7 +842,11 @@ DEFAULTS = {
'serializer_class': serializers.BooleanField, 'serializer_class': serializers.BooleanField,
'form_class': forms.BooleanField, 'form_class': forms.BooleanField,
'form_kwargs': dict( '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': { 'ticket_download_nonadm': {
@@ -851,7 +855,11 @@ DEFAULTS = {
'serializer_class': serializers.BooleanField, 'serializer_class': serializers.BooleanField,
'form_class': forms.BooleanField, 'form_class': forms.BooleanField,
'form_kwargs': dict( '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': { 'ticket_download_pending': {
@@ -860,7 +868,10 @@ DEFAULTS = {
'serializer_class': serializers.BooleanField, 'serializer_class': serializers.BooleanField,
'form_class': forms.BooleanField, 'form_class': forms.BooleanField,
'form_kwargs': dict( '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': { 'event_list_availability': {

View File

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

View File

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

View File

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

View File

@@ -251,7 +251,7 @@ var form_handlers = function (el) {
update = function () { update = function () {
var enabled = dependency.prop('checked'); var enabled = dependency.prop('checked');
dependent.prop('disabled', !enabled).parents('.form-group').toggleClass('disabled', !enabled); dependent.prop('disabled', !enabled).parents('.form-group').toggleClass('disabled', !enabled);
if (!enabled) { if (!enabled && !$(this).is('[data-checkbox-dependency-visual]')) {
dependent.prop('checked', false); dependent.prop('checked', false);
} }
}; };

View File

@@ -406,6 +406,18 @@ table td > .checkbox input[type="checkbox"] {
line-height: 40px; 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 { .accordion-radio {
display: block; display: block;
margin: 0; margin: 0;