Skip to content

Commit

Permalink
Generalize pretixdroid settings UI
Browse files Browse the repository at this point in the history
  • Loading branch information
raphaelm committed Jan 6, 2018
1 parent f054e70 commit f65f166
Show file tree
Hide file tree
Showing 9 changed files with 147 additions and 57 deletions.
34 changes: 19 additions & 15 deletions res/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions src/pretix/plugins/pretixdroid/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@

class PretixdroidApp(AppConfig):
name = 'pretix.plugins.pretixdroid'
verbose_name = _("pretixdroid API")
verbose_name = _("Check-in device API")

class PretixPluginMeta:
name = _("pretixdroid API")
name = _("Check-in device API")
author = _("the pretix team")
version = version
visible = True
description = _("This plugin allows you to use the pretixdroid Android app for your event.")
description = _("This plugin allows you to use the pretixdroid and pretixdesk apps for your event.")

def ready(self):
from . import signals # NOQA
Expand Down
3 changes: 2 additions & 1 deletion src/pretix/plugins/pretixdroid/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@
class AppConfigurationForm(forms.ModelForm):
class Meta:
model = AppConfiguration
fields = ('all_items', 'items', 'list', 'show_info', 'allow_search')
fields = ('all_items', 'items', 'list', 'show_info', 'allow_search', 'app')
widgets = {
'items': forms.CheckboxSelectMultiple(attrs={
'data-inverse-dependency': '#id_all_items'
}),
'app': forms.RadioSelect
}

def __init__(self, **kwargs):
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.8 on 2018-01-06 21:22
from __future__ import unicode_literals

import django.db.models.deletion
from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('pretixdroid', '0004_auto_20171124_1657'),
]

operations = [
migrations.AddField(
model_name='appconfiguration',
name='app',
field=models.CharField(choices=[('pretixdroid', 'pretixdroid – for Android smartphones'), ('pretixdesk', 'pretixdesk – for desktop computers')], default='pretixdroid', max_length=190, verbose_name='Scan software'),
),
migrations.AlterField(
model_name='appconfiguration',
name='allow_search',
field=models.BooleanField(default=True, help_text='If disabled, the device can not search for attendees by name. pretixdroid 1.6 or pretixdesk only.', verbose_name='Search allowed'),
),
migrations.AlterField(
model_name='appconfiguration',
name='list',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='pretixbase.CheckinList', verbose_name='Check-in list'),
),
migrations.AlterField(
model_name='appconfiguration',
name='show_info',
field=models.BooleanField(default=True, help_text='If disabled, the device can not see how many tickets exist and how many are already scanned. pretixdroid 1.6 or pretixdesk only.', verbose_name='Show information'),
),
]
8 changes: 6 additions & 2 deletions src/pretix/plugins/pretixdroid/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,14 @@ class AppConfiguration(models.Model):
items = models.ManyToManyField('pretixbase.Item', blank=True, verbose_name=_('Can scan these products'))
show_info = models.BooleanField(default=True, verbose_name=_('Show information'),
help_text=_('If disabled, the device can not see how many tickets exist and how '
'many are already scanned. pretixdroid 1.6 or newer only.'))
'many are already scanned. pretixdroid 1.6 or pretixdesk only.'))
allow_search = models.BooleanField(default=True, verbose_name=_('Search allowed'),
help_text=_('If disabled, the device can not search for attendees by name. '
'pretixdroid 1.6 or newer only.'))
'pretixdroid 1.6 or pretixdesk only.'))
app = models.CharField(max_length=190, verbose_name=_('Scan software'), default='pretixdroid', choices=(
('pretixdroid', _('pretixdroid – for Android smartphones')),
('pretixdesk', _('pretixdesk – for desktop computers')),
))
list = models.ForeignKey(
'pretixbase.CheckinList', on_delete=models.CASCADE, verbose_name=_('Check-in list')
)
Expand Down
4 changes: 2 additions & 2 deletions src/pretix/plugins/pretixdroid/signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ def control_nav_import(sender, request=None, **kwargs):
return []
return [
{
'label': _('pretixdroid'),
'label': _('Check-in devices'),
'url': reverse('plugins:pretixdroid:config', kwargs={
'event': request.event.slug,
'organizer': request.event.organizer.slug,
}),
'active': (url.namespace == 'plugins:pretixdroid' and url.url_name == 'config'),
'icon': 'android',
'icon': 'mobile',
}
]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,19 @@
{% load i18n %}
{% load bootstrap3 %}
{% load staticfiles %}
{% block title %}{% trans "pretixdroid configuration" %}{% endblock %}
{% block title %}{% trans "Check-in device configuration" %}{% endblock %}
{% block content %}
<h1>{% trans "pretixdroid configuration" %}</h1>
<h1>{% trans "Check-in device configuration" %}</h1>
<p>{% blocktrans trimmed %}
pretixdroid is an Android app that you can use to control tickets at the entrance of your event.
pretixdesk is the corresponding app for desktop computers.
{% endblocktrans %}</p>

{% if not configs or "create" in request.GET %}
<h2>{% trans "Create app configuration" %}</h2>
<p>
{% blocktrans trimmed %}
To start scanning tickets with our Android app, first create a configuration code here:
To start scanning tickets with our apps, first create a configuration code here:
{% endblocktrans %}
</p>
<form action="?add" method="post" class="form-horizontal">
Expand All @@ -24,6 +25,7 @@ <h2>{% trans "Create app configuration" %}</h2>
{% bootstrap_field add_form.items layout="horizontal" %}
{% bootstrap_field add_form.show_info layout="horizontal" %}
{% bootstrap_field add_form.allow_search layout="horizontal" %}
{% bootstrap_field add_form.app layout="horizontal" %}
<div class="form-group">
<div class="col-md-offset-3 col-md-9">
<button type="submit" class="btn btn-primary btn-save" name="add" value="1">
Expand Down Expand Up @@ -56,7 +58,14 @@ <h2>{% trans "Existing app configurations" %}</h2>
<tbody>
{% for ac in configs %}
<tr>
<td>{{ ac.key|slice:"0:8" }}…</td>
<td>
{% if ac.app == "pretixdroid" %}
<span class="fa fa-fw fa-android"></span>
{% elif ac.app == "pretixdesk" %}
<span class="fa fa-fw fa-desktop"></span>
{% endif %}
{{ ac.key|slice:"0:8" }}…
</td>
<td>
<a href="{% url "control:event.orders.checkinlists.show" organizer=request.event.organizer.slug event=request.event.slug list=ac.list.id %}">{{ ac.list }}</a>
</td>
Expand All @@ -74,7 +83,7 @@ <h2>{% trans "Existing app configurations" %}</h2>
<td>{% if ac.allow_search %}{% trans "Yes" %}{% else %}{% trans "No" %}{% endif %}</td>
<td class="text-right">
<a href="{% url "plugins:pretixdroid:config.code" organizer=request.event.organizer.slug event=request.event.slug config=ac.pk %}" class="btn btn-default">
<span class="fa fa-qrcode"></span> {% trans "Show QR code" %}
<span class="fa fa-qrcode"></span> {% trans "Configure device" %}
</a>
<button class="btn btn-danger" name="delete" value="{{ ac.pk }}">
<span class="fa fa-trash"></span>
Expand Down
Loading

0 comments on commit f65f166

Please sign in to comment.