receipts/view: Display PDFs in iframe

PDF attachments can now be shown on the receipt view page in an
`iframe`.
bugfix/ci-buildah
Dustin 2025-03-14 20:26:27 -05:00
parent da3d3e4c8e
commit 83a4ca0ad5
1 changed files with 13 additions and 0 deletions

View File

@ -11,9 +11,18 @@
margin-right: 1em; margin-right: 1em;
} }
.photo {
flex-grow: 1;
}
.photo img { .photo img {
max-width: 100%; max-width: 100%;
} }
.photo iframe {
width: 100%;
aspect-ratio: 8.5 / 11;
}
} }
</style> </style>
{% endblock %} {% block main %} {% endblock %} {% block main %}
@ -52,7 +61,11 @@
</div> </div>
<div class="photo"> <div class="photo">
<p> <p>
{% if filename is ending_with(".pdf") %}
<iframe src="/receipts/{{ id }}/view/{{ filename }}"></iframe>
{% else %}
<img src="/receipts/{{ id }}/view/{{ filename }}" /> <img src="/receipts/{{ id }}/view/{{ filename }}" />
{% endif %}
</p> </p>
</div> </div>
</article> </article>