Skip to content
Snippets Groups Projects
Unverified Commit 75088536 authored by Robin Sonnabend's avatar Robin Sonnabend
Browse files

Allow downloading decision PDFs

Closes #183
parent 381479f0
Branches
No related tags found
No related merge requests found
......@@ -1506,6 +1506,17 @@ def print_decision(decisiondocument):
"show_protocol", protocol_id=decisiondocument.decision.protocol.id)
@app.route("/decision/download/<int:decisiondocument_id>")
@login_required
@protect_csrf
@db_lookup(DecisionDocument)
@require_private_view_right()
def download_decision(decisiondocument):
return send_file(
decisiondocument.as_file_like(), cache_timeout=1,
as_attachment=True, attachment_filename=decisiondocument.name)
@app.route("/errors/list")
@back.anchor
@login_required
......
......@@ -103,9 +103,12 @@
{% for decision in protocol.decisions %}
<li>
{{decision.content}}
{% if config.PRINTING_ACTIVE and has_private_view_right and decision.document is not none %}
{% if has_private_view_right and decision.document is not none %}
{% if config.PRINTING_ACTIVE %}
<a href="{{url_for("print_decision", decisiondocument_id=decision.document.id, csrf_token=get_csrf_token())}}">Drucken</a>
{% endif %}
<a href="{{url_for("download_decision", decisiondocument_id=decision.document.id, csrf_token=get_csrf_token())}}">Download</a>
{% endif %}
{{render_likes(decision.likes, decision_id=decision.id)}}</h2>
</li>
{% endfor %}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment