From 0b39dd86787d0cec29dad93b81a9fc33484f1e87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Madar=C3=A1sz?= Date: Thu, 12 Jan 2023 15:45:49 +0000 Subject: [PATCH] improved snippets feat --- app/templates/admin_snippets.html | 2 +- app/templates/layout.html | 2 +- app/templates/utils.html | 83 ++++++++++++++++++++----------- 3 files changed, 57 insertions(+), 30 deletions(-) diff --git a/app/templates/admin_snippets.html b/app/templates/admin_snippets.html index 780b81b..5b6ac95 100644 --- a/app/templates/admin_snippets.html +++ b/app/templates/admin_snippets.html @@ -9,6 +9,6 @@ {% for anybox_object in threads %}
- {{ utils.display_object(anybox_object) }} + {{ utils.display_object(anybox_object, is_code=True) }} {% endfor %} {% endblock %} diff --git a/app/templates/layout.html b/app/templates/layout.html index f789ae0..2fd2d4b 100644 --- a/app/templates/layout.html +++ b/app/templates/layout.html @@ -54,7 +54,7 @@ {% if custom_footer %} {{ custom_footer | safe }} {% else %} - Admin. + Runs a modified version of microblog.pub. Admin. {% if is_admin %} {{ header_link("followers", "Followers") }} {{ followers_count }}. {% endif %} diff --git a/app/templates/utils.html b/app/templates/utils.html index f65644f..60e8726 100644 --- a/app/templates/utils.html +++ b/app/templates/utils.html @@ -154,6 +154,15 @@ {% endblock %} {% endmacro %} +{% macro admin_raw_button(ap_object) %} +{% block admin_raw_button scoped %} +
+ + +
+{% endblock %} +{% endmacro %} + {% macro admin_force_delete_button(ap_object_id, permalink_id=None) %} {% block admin_force_delete_button scoped %}
@@ -536,7 +545,7 @@ {% endblock %} {% endmacro %} -{% macro display_object(object, likes=[], shares=[], webmentions=[], expanded=False, actors_metadata={}, is_object_page=False, is_h_entry=True) %} +{% macro display_object(object, likes=[], shares=[], webmentions=[], expanded=False, actors_metadata={}, is_object_page=False, is_h_entry=True, is_code=False) %} {% block display_object scoped %} {% set is_article_mode = object.is_from_outbox and object.ap_type == "Article" and is_object_page %} {% if object.ap_type in ["Note", "Article", "Video", "Page", "Question", "Event"] %} @@ -599,7 +608,15 @@ {% endif %}
+ {% if not is_code %} {{ object.content | clean_html(object) | safe }} + {% elif object.source %} +
+ +
+ {% else %} + Snippets can not be previewed on this page! + {% endif %}
{% if object.ap_type == "Question" %} @@ -665,17 +682,19 @@