diff --git a/src/pretix/base/models/orders.py b/src/pretix/base/models/orders.py index b549f6b17..ef3c8eb6d 100644 --- a/src/pretix/base/models/orders.py +++ b/src/pretix/base/models/orders.py @@ -870,6 +870,10 @@ class QuestionAnswer(models.Model): return url return "" + @property + def is_image(self): + return any(self.file.name.endswith(e) for e in ('.jpg', '.png', '.gif', '.tiff', '.bmp', '.jpeg')) + @property def file_name(self): return self.file.name.split('.', 1)[-1] diff --git a/src/pretix/control/templates/pretixcontrol/order/index.html b/src/pretix/control/templates/pretixcontrol/order/index.html index 31e8fe1f8..95dd6d36b 100644 --- a/src/pretix/control/templates/pretixcontrol/order/index.html +++ b/src/pretix/control/templates/pretixcontrol/order/index.html @@ -332,6 +332,13 @@ title="{% trans "This file has been uploaded by a user and could contain viruses or other malicious content." %}"> {% trans "UNSAFE" %} + {% if q.answer.is_image %} +
+ + + + {% endif %} {% else %} {{ q.answer|linebreaksbr }} {% endif %} diff --git a/src/pretix/static/pretixcontrol/scss/main.scss b/src/pretix/static/pretixcontrol/scss/main.scss index 5c23d4d0b..534fd32e5 100644 --- a/src/pretix/static/pretixcontrol/scss/main.scss +++ b/src/pretix/static/pretixcontrol/scss/main.scss @@ -634,6 +634,15 @@ h1 .label { margin-left: 120px; } } + +.answer-thumb img { + width: auto; + height: auto; + max-height: 100px; + max-width: 100%; + margin-top: 5px; +} + @media(max-width: $screen-sm-max) { .timeline { .col-date {