diff --git a/app/templates/utils.html b/app/templates/utils.html index aa49de4..e821739 100644 --- a/app/templates/utils.html +++ b/app/templates/utils.html @@ -97,6 +97,17 @@ {% endmacro %} +{% macro hide_sensitive_button(permalink_id) %} +
+ {% for k, v in request.query_params.items() %} + {% if not (k == "show_sensitive" and v == permalink_id) %} + + {% endif %} + {% endfor %} + +
+{% endmacro %} + {% macro show_more_button(permalink_id) %}
@@ -107,6 +118,18 @@
{% endmacro %} +{% macro show_less_button(permalink_id) %} +
+ {% for k, v in request.query_params.items() %} + {% if not (k == "show_more" and v == permalink_id) %} + + {% endif %} + {% endfor %} + +
+{% endmacro %} + + {% macro admin_reply_button(ap_object_id) %}
@@ -215,11 +238,14 @@ {% macro display_attachments(object) %} - {% if object.attachments and object.sensitive and not request.query_params.show_sensitive == object.permalink_id %} - {{ sensitive_button(object.permalink_id )}} + {% if object.attachments and object.sensitive and not object.permalink_id in request.query_params.getlist("show_sensitive") %} + {{ sensitive_button(object.permalink_id )}} {% endif %} - {% if object.attachments and (not object.sensitive or (object.sensitive and request.query_params["show_sensitive"] == object.permalink_id)) %} + {% if object.attachments and (not object.sensitive or (object.sensitive and object.permalink_id in request.query_params.getlist("show_sensitive"))) %} + {% if object.sensitive %} + {{ hide_sensitive_button(object.permalink_id) }} + {% endif %} {% for attachment in object.attachments %} {% if attachment.type == "Image" or (attachment | has_media_type("image")) %} {{ attachment.name }} @@ -250,11 +276,14 @@

{{ object.summary | clean_html(object) | safe }}

{% endif %} - {% if object.sensitive and object.summary and not request.query_params.show_more == object.permalink_id %} + {% if object.sensitive and object.summary and object.permalink_id not in request.query_params.getlist("show_more") %} {{ show_more_button(object.permalink_id) }} {% endif %} - {% if not object.sensitive or (object.sensitive and object.summary and request.query_params.show_more == object.permalink_id) %} + {% if not object.sensitive or (object.sensitive and object.summary and object.permalink_id in request.query_params.getlist("show_more")) %} + {% if object.sensitive and object.summary %} + {{ show_less_button(object.permalink_id) }} + {% endif %}
{{ object.content | clean_html(object) | safe }}