Skip to content

Commit

Permalink
refactor: use attachments.exists
Browse files Browse the repository at this point in the history
  • Loading branch information
SilvanVerhoeven committed Aug 9, 2024
1 parent 9e027aa commit 1d577c0
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion myhpi/core/templates/core/information_page.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

{% block content %}
{% with page.body|markdown as parsed_md %}
{% include "core/toc_button.html" with toc=parsed_md.1 attachments=page.attachments.all %}
{% include "core/toc_button.html" with toc=parsed_md.1 attachments=page.attachments.exists %}
<div class="row flex-column flex-lg-row">
<div class="col-lg-9">
<h1 class="page-title">
Expand Down
2 changes: 1 addition & 1 deletion myhpi/core/templates/core/minutes.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

{% block content %}
{% with page.body|markdown as parsed_md %}
{% include "core/toc_button.html" with toc=parsed_md.1 attachments=page.attachments.all %}
{% include "core/toc_button.html" with toc=parsed_md.1 attachments=page.attachments.exists %}
<div class="row flex-column flex-lg-row">
<h1 class="page-title">
<span class="underline">
Expand Down
12 changes: 7 additions & 5 deletions myhpi/core/templates/core/sidebar.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ <h1 class="side-panel-title">{% translate "Table of contents" %}</h1>
{{ parsed_md.1 }}
</aside>
{% endif %}
{% if page.attachments.all %}
{% if page.attachments.exists %}
<aside class="side-panel border-accent sidebar-container d-print-none">
<h1 class="side-panel-title">{% translate "Attachments" %}</h1>
<ul>
Expand All @@ -39,9 +39,11 @@ <h1 class="side-panel-title">{% translate "Attachments" %}</h1>
</aside>
{% endif %}
</div>

{%if parsed_md.1|hasTocContent or page.attachments.all %}
<div class="offcanvas offcanvas-bottom" tabindex="-1" id="sidebar-offcanvas" aria-labelledby="sidebar-offcanvas-label">
{% if parsed_md.1|hasTocContent or page.attachments.exists %}
<div class="offcanvas offcanvas-bottom"
tabindex="-1"
id="sidebar-offcanvas"
aria-labelledby="sidebar-offcanvas-label">
<div class="offcanvas-header">
<h5 class="offcanvas-title" id="sidebar-offcanvas-label">{% translate "Table of contents" %}</h5>
<button type="button" class="btn-close" data-bs-dismiss="offcanvas"
Expand All @@ -52,7 +54,7 @@ <h5 class="offcanvas-title" id="sidebar-offcanvas-label">{% translate "Table of
<h1 class="side-panel-title">{% translate "Table of contents" %}</h1>
{{ parsed_md.1 }}
</aside>
{% if page.attachments.all %}
{% if page.attachments.exists %}
<aside class="side-panel border-accent sidebar-container d-print-none">
<h1 class="side-panel-title">{% translate "Attachments" %}</h1>
<ul>
Expand Down

0 comments on commit 1d577c0

Please sign in to comment.