mirror of
https://github.com/pretix/pretix.git
synced 2026-09-14 16:24:43 +00:00
Show preview of answered images
This commit is contained in:
@@ -870,6 +870,10 @@ class QuestionAnswer(models.Model):
|
|||||||
return url
|
return url
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
|
@property
|
||||||
|
def is_image(self):
|
||||||
|
return any(self.file.name.endswith(e) for e in ('.jpg', '.png', '.gif', '.tiff', '.bmp', '.jpeg'))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def file_name(self):
|
def file_name(self):
|
||||||
return self.file.name.split('.', 1)[-1]
|
return self.file.name.split('.', 1)[-1]
|
||||||
|
|||||||
@@ -332,6 +332,13 @@
|
|||||||
title="{% trans "This file has been uploaded by a user and could contain viruses or other malicious content." %}">
|
title="{% trans "This file has been uploaded by a user and could contain viruses or other malicious content." %}">
|
||||||
{% trans "UNSAFE" %}
|
{% trans "UNSAFE" %}
|
||||||
</span>
|
</span>
|
||||||
|
{% if q.answer.is_image %}
|
||||||
|
<br>
|
||||||
|
<a href="{{ q.answer.backend_file_url }}?token={% answer_token request q.answer %}" data-lightbox="order"
|
||||||
|
class="answer-thumb">
|
||||||
|
<img src="{{ q.answer.backend_file_url }}?token={% answer_token request q.answer %}">
|
||||||
|
</a>
|
||||||
|
{% endif %}
|
||||||
{% else %}
|
{% else %}
|
||||||
{{ q.answer|linebreaksbr }}
|
{{ q.answer|linebreaksbr }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
@@ -634,6 +634,15 @@ h1 .label {
|
|||||||
margin-left: 120px;
|
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) {
|
@media(max-width: $screen-sm-max) {
|
||||||
.timeline {
|
.timeline {
|
||||||
.col-date {
|
.col-date {
|
||||||
|
|||||||
Reference in New Issue
Block a user