diff --git a/server.py b/server.py index b75ec3f8ae61a404909b7a9feae51cd61b478206..d88bd313cc755e768d5e2a661d384d5ee07335d8 100755 --- a/server.py +++ b/server.py @@ -475,7 +475,10 @@ def show_protocol(protocol): documents_table = DocumentsTable(visible_documents) document_upload_form = DocumentUploadForm() source_upload_form = KnownProtocolSourceUploadForm() - return render_template("protocol-show.html", protocol=protocol, errors_table=errors_table, documents_table=documents_table, document_upload_form=document_upload_form, source_upload_form=source_upload_form) + time_diff = protocol.date - datetime.now().date() + print(time_diff) + large_time_diff = not protocol.is_done() and time_diff.days > 0 + return render_template("protocol-show.html", protocol=protocol, errors_table=errors_table, documents_table=documents_table, document_upload_form=document_upload_form, source_upload_form=source_upload_form, time_diff=time_diff, large_time_diff=large_time_diff) @app.route("/protocol/delete/<int:protocol_id>") @login_required diff --git a/templates/protocol-show.html b/templates/protocol-show.html index 47d116b8b4633843f4886d5b13b9aabf77d584f5..9673b8ee5abf6ca67bc3a9da0cd085321e1179ba 100644 --- a/templates/protocol-show.html +++ b/templates/protocol-show.html @@ -23,7 +23,7 @@ {% endif %} <a class="btn {% if protocol.is_done() %}btn-success{% else %}btn-default{% endif %}" href="{{url_for("update_protocol", protocol_id=protocol.id)}}">Editieren</a> {% if config.ETHERPAD_ACTIVE %} - <a class="btn btn-primary" href="{{url_for("etherpush_protocol", protocol_id=protocol.id)}}">Etherpad</a> + <a class="btn btn-primary" href="{{url_for("etherpush_protocol", protocol_id=protocol.id)}}"{% if large_time_diff %} onclick="return confirm('Bist du dir sicher, dass du das Template bereits in das Etherpad kopieren willst? Die Sitzung ist erst in {{time_diff.days}} Tagen.');"{% endif %}>Etherpad</a> {% endif %} {% if not protocol.is_done() %} <a class="btn btn-default" href="{{url_for("get_protocol_template", protocol_id=protocol.id)}}">Vorlage</a>