From a601c759231909f91ca35fcabd5d5c5d444e026a Mon Sep 17 00:00:00 2001 From: Martin Gross Date: Mon, 18 Nov 2024 17:50:43 +0100 Subject: [PATCH] CheckIns: Display a source_type icon (barcode/nfc) where known (#4628) Co-authored-by: Raphael Michel --- src/pretix/base/media.py | 13 +++ .../pretixcontrol/checkin/checkins.html | 3 +- .../checkin/fragment_checkin_source_type.html | 15 +++ .../pretixcontrol/checkin/index.html | 1 + src/pretix/control/views/checkin.py | 12 ++- .../pretixbase/img/media/nfc_secure.svg | 76 ++++++++++++++++ .../static/pretixbase/img/media/nfc_uid.svg | 91 +++++++++++++++++++ 7 files changed, 205 insertions(+), 6 deletions(-) create mode 100644 src/pretix/control/templates/pretixcontrol/checkin/fragment_checkin_source_type.html create mode 100644 src/pretix/static/pretixbase/img/media/nfc_secure.svg create mode 100644 src/pretix/static/pretixbase/img/media/nfc_uid.svg diff --git a/src/pretix/base/media.py b/src/pretix/base/media.py index 6e3b635fbb..0808e68691 100644 --- a/src/pretix/base/media.py +++ b/src/pretix/base/media.py @@ -37,6 +37,16 @@ class BaseMediaType: def verbose_name(self): raise NotImplementedError() + @property + def icon(self): + """ + This can be: + + - The name of a Font Awesome icon to represent this channel type. + - The name of a SVG icon file that is resolvable through the static file system. We recommend to design for a size of 18x14 pixels. + """ + return "circle" + def generate_identifier(self, organizer): if self.medium_created_by_server: raise NotImplementedError() @@ -59,6 +69,7 @@ class BaseMediaType: class BarcodePlainMediaType(BaseMediaType): identifier = 'barcode' verbose_name = _('Barcode / QR-Code') + icon = 'qrcode' medium_created_by_server = True supports_giftcard = False supports_orderposition = True @@ -75,6 +86,7 @@ class BarcodePlainMediaType(BaseMediaType): class NfcUidMediaType(BaseMediaType): identifier = 'nfc_uid' verbose_name = _('NFC UID-based') + icon = 'pretixbase/img/media/nfc_uid.svg' medium_created_by_server = False supports_giftcard = True supports_orderposition = False @@ -114,6 +126,7 @@ class NfcUidMediaType(BaseMediaType): class NfcMf0aesMediaType(BaseMediaType): identifier = 'nfc_mf0aes' verbose_name = 'NFC Mifare Ultralight AES' + icon = 'pretixbase/img/media/nfc_secure.svg' medium_created_by_server = False supports_giftcard = True supports_orderposition = False diff --git a/src/pretix/control/templates/pretixcontrol/checkin/checkins.html b/src/pretix/control/templates/pretixcontrol/checkin/checkins.html index 3d40d15261..87117e05bd 100644 --- a/src/pretix/control/templates/pretixcontrol/checkin/checkins.html +++ b/src/pretix/control/templates/pretixcontrol/checkin/checkins.html @@ -127,6 +127,7 @@ {{ c.position.order.code }}-{{ c.position.positionid }} + {% include "pretixcontrol/checkin/fragment_checkin_source_type.html" with source_type=c.raw_source_type %} {% if c.position.attendee_name %}
@@ -143,7 +144,7 @@ {% endif %} {% else %} - + {% include "pretixcontrol/checkin/fragment_checkin_source_type.html" with source_type=c.raw_source_type %} {{ c.raw_barcode|slice:":16" }}{% if c.raw_barcode|length > 16 %}…{% endif %}