From 74bc64a00d8fd2443f27f43f701ffca89d6cd34c Mon Sep 17 00:00:00 2001 From: UlrichB22 <97119703+UlrichB22@users.noreply.github.com> Date: Thu, 5 Jun 2025 23:01:16 +0200 Subject: [PATCH 1/2] Remove show.html template from theme 'focus' --- src/moin/templates/show.html | 2 +- .../themes/focus/templates/itemviews.html | 246 +++++++++--------- src/moin/themes/focus/templates/show.html | 58 ----- 3 files changed, 125 insertions(+), 181 deletions(-) delete mode 100644 src/moin/themes/focus/templates/show.html diff --git a/src/moin/templates/show.html b/src/moin/templates/show.html index 5c48effd1..086e7bc98 100644 --- a/src/moin/templates/show.html +++ b/src/moin/templates/show.html @@ -2,7 +2,7 @@ {% import "utils.html" as utils with context %} {% import "snippets.html" as snippets with context %} -{% import "itemviews.html" as itemviews with context %} +{% import theme("itemviews.html") as itemviews with context %} {% set footer_meta = snippets.footer_meta() %} diff --git a/src/moin/themes/focus/templates/itemviews.html b/src/moin/themes/focus/templates/itemviews.html index 518f444d9..0c55fac14 100644 --- a/src/moin/themes/focus/templates/itemviews.html +++ b/src/moin/themes/focus/templates/itemviews.html @@ -17,146 +17,148 @@ {{ label }} {%- endmacro %} -
- {%- for endpoint, label, title, check_exists in cfg.item_views if not endpoint in cfg.endpoints_excluded %} - {% set icon_class = icon_classes[endpoint] %} - {%- if may.write and not_trash %} - {%- if current_path.startswith("/+") - and endpoint == 'frontend.show_item' +
+
+ {%- for endpoint, label, title, check_exists in cfg.item_views if not endpoint in cfg.endpoints_excluded %} + {% set icon_class = icon_classes[endpoint] %} + {%- if may.write and not_trash %} + {%- if current_path.startswith("/+") + and endpoint == 'frontend.show_item' + %} +
+ {{ a_label(icon_class, label) }} +
+ {%- elif not current_path.startswith("/+") + and endpoint == 'frontend.modify_item' %} +
+ {{ a_label(icon_class, label) }} +
+ {%- endif %} + {%- endif %} + {%- endfor %} +
+ +
+ +
+
+ {%- for endpoint, label, title, check_exists in cfg.item_views if not endpoint in cfg.endpoints_excluded %} + {% set icon_class = icon_classes[endpoint] %} + {%- if may.write + and not_trash + and endpoint == 'frontend.modify_item' + and current_path.startswith("/+") + and not current_path.startswith("/+modify/") %} - {%- elif not current_path.startswith("/+") - and endpoint == 'frontend.modify_item' %} + {%- endif %} + {%- if endpoint in [ + 'frontend.show_item_meta', + 'frontend.history', + 'frontend.download_item', + ] %} {%- endif %} - {%- endif %} - {%- endfor %} -
- -
- -
-
- {%- for endpoint, label, title, check_exists in cfg.item_views if not endpoint in cfg.endpoints_excluded %} - {% set icon_class = icon_classes[endpoint] %} - {%- if may.write - and not_trash - and endpoint == 'frontend.modify_item' - and current_path.startswith("/+") - and not current_path.startswith("/+modify/") - %} - - {%- endif %} - {%- if endpoint in [ - 'frontend.show_item_meta', - 'frontend.history', - 'frontend.download_item', - ] %} - - {%- endif %} - {%- if not_trash and endpoint in [ - 'frontend.index', - 'frontend.refs', - 'frontend.sitemap', - 'frontend.similar_names', - 'frontend.copy_item', - ] %} - - {%- endif %} + {%- if not_trash and endpoint in [ + 'frontend.index', + 'frontend.refs', + 'frontend.sitemap', + 'frontend.similar_names', + 'frontend.copy_item', + ] %} + + {%- endif %} - {%- if endpoint == 'frontend.highlight_item' and item and ('text' in item.contenttype or 'docbook' in item.contenttype) %} - - {%- endif %} + {%- if endpoint == 'frontend.highlight_item' and item and ('text' in item.contenttype or 'docbook' in item.contenttype) %} + + {%- endif %} - {%- if endpoint in [ - 'frontend.rename_item', 'frontend.delete_item', - ] and may.write and not_trash %} - - {%- endif %} + {%- if endpoint in [ + 'frontend.rename_item', 'frontend.delete_item', + ] and may.write and not_trash %} + + {%- endif %} - {%- if endpoint in [ - 'frontend.convert_item', - ] and may.write and item and theme_supp.is_markup_or_text(item.contenttype) and not_trash %} - - {%- endif %} + {%- if endpoint in [ + 'frontend.convert_item', + ] and may.write and item and theme_supp.is_markup_or_text(item.contenttype) and not_trash %} + + {%- endif %} - {%- if endpoint == 'frontend.destroy_item' and may.destroy %} - - {%- endif %} + {%- if endpoint == 'frontend.destroy_item' and may.destroy %} + + {%- endif %} - {%- if endpoint == 'frontend.quicklink_item' and user.valid and not_trash %} - - {%- endif %} + {%- if endpoint == 'frontend.quicklink_item' and user.valid and not_trash %} + + {%- endif %} - {%- if endpoint == 'frontend.subscribe_item' and user.valid and not_trash %} - - {%- endif %} + {%- if endpoint == 'frontend.subscribe_item' and user.valid and not_trash %} + + {%- endif %} - {%- if endpoint == 'special.comments' and not_trash %} - - {%- endif %} + {%- if endpoint == 'special.comments' and not_trash %} + + {%- endif %} - {% if endpoint == 'special.transclusions' and not_trash -%} - - {%- endif %} + {% if endpoint == 'special.transclusions' and not_trash -%} + + {%- endif %} - {%- if endpoint == 'special.supplementation' and fqname %} - {%- for sub_item_name in cfg.supplementation_item_names %} - {%- set current_sub = item_name.rsplit('/', 1)[-1] %} - {%- if not current_sub in cfg.supplementation_item_names %} - {%- set supp_name = '%s/%s/%s' % (fqname.namespace, item_name, sub_item_name) %} - {%- if not_trash and (storage.has_item(supp_name) or user.may.write(supp_name)) %} - {% set title = _('Discuss contents of this item') %} - + {%- if endpoint == 'special.supplementation' and fqname %} + {%- for sub_item_name in cfg.supplementation_item_names %} + {%- set current_sub = item_name.rsplit('/', 1)[-1] %} + {%- if not current_sub in cfg.supplementation_item_names %} + {%- set supp_name = '%s/%s/%s' % (fqname.namespace, item_name, sub_item_name) %} + {%- if not_trash and (storage.has_item(supp_name) or user.may.write(supp_name)) %} + {% set title = _('Discuss contents of this item') %} + + {%- endif %} {%- endif %} - {%- endif %} + {%- endfor %} + {%- endif %} {%- endfor %} - {%- endif %} - {%- endfor %} +
diff --git a/src/moin/themes/focus/templates/show.html b/src/moin/themes/focus/templates/show.html deleted file mode 100644 index e152a2c22..000000000 --- a/src/moin/themes/focus/templates/show.html +++ /dev/null @@ -1,58 +0,0 @@ -{% extends theme("layout.html") %} - -{% import "utils.html" as utils with context %} -{% import "snippets.html" as snippets with context %} -{% import theme("itemviews.html") as itemviews with context %} - -{% set footer_meta = snippets.footer_meta() %} - -{% block head_links %} - {{ super() }} - - {# universal edit button support #} - {%- if may.write and 'frontend.modify_item' not in cfg.endpoints_excluded -%} - - {%- endif %} -{% endblock %} - -{% block header_itemviews %} -
- {{ itemviews }} -
-{% endblock %} - -{% block content %} - {% block headline %} - {% if item.meta['summary'] %} - {% block item_summary %} -
- {{ _('Summary: {summary}').format(summary=item.meta['summary']) }} -
- {% endblock %} - {% endif %} - {{ utils.rev_navigation(rev_navigation_ids_dates, fqname, view='frontend.show_item', item=item) }} - {% endblock %} - - {% block content_data %} - {% if data_rendered %} -
- {{ data_rendered }} -
- {% endif %} - {% endblock %} -{% endblock %} - -{% block footer_hr %}{% endblock %} - -{% block footer_meta %} - {{ footer_meta }} -{% endblock %} - -{% block options_for_javascript %} - {%- if item_name and user.edit_on_doubleclick and may.write and data_rendered and not form -%} -
- {%- endif %} - {%- if user.show_comments -%} -
- {%- endif %} -{% endblock %} From 018610af95d08b191e3493c4c6f7ff5a6a116716 Mon Sep 17 00:00:00 2001 From: UlrichB22 <97119703+UlrichB22@users.noreply.github.com> Date: Thu, 5 Jun 2025 23:02:20 +0200 Subject: [PATCH 2/2] itemviews: reduce consecutive line breaks and beautify html --- src/moin/templates/itemviews.html | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/src/moin/templates/itemviews.html b/src/moin/templates/itemviews.html index 6a57a4759..3d9f94ae1 100644 --- a/src/moin/templates/itemviews.html +++ b/src/moin/templates/itemviews.html @@ -7,13 +7,12 @@ Comment and Transclusion links may be hidden by Javascript if item lacks content. #} -{% set item = item %} -{% set not_trash = not item_is_deleted if item_is_deleted is defined else True %} -{% set icon_classes = theme_supp.get_endpoint_iconmap() %} +{%- set item = item -%} +{%- set not_trash = not item_is_deleted if item_is_deleted is defined else True -%} +{%- set icon_classes = theme_supp.get_endpoint_iconmap() -%} {%- macro a_label(icon_class, label) %} - - {{ label }} + {{ label }} {%- endmacro %}