Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: hot fix toc button display with attachments and no toc #608

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ To set up a development version on your local machine, you need to execute the f
1. Create env file by copying the `.env.example` file to `.env`, e.g. `cp .env.example .env` (Notice that for some functionality like OIDC some settings must be changed)
1. Migrate the database with `python manage.py migrate`
1. Install bootstrap with `python tools/install_bootstrap.py`
1. Optionally: Compile translations with `python manage.py compilemessages` (does not work on Windows, recommended to skip this step or see [docs](https://docs.djangoproject.com/en/4.0/topics/i18n/translation/#gettext-on-windows))
1. Optionally: Compile translations with `python manage.py compilemessages -i venv` (does not work on Windows, recommended to skip this step or see [docs](https://docs.djangoproject.com/en/4.0/topics/i18n/translation/#gettext-on-windows))
1. Optionally: Create test data with `python manage.py create_test_data`
1. Create a local superuser with `python manage.py createsuperuser`
1. Start the development server with `python manage.py runserver`
Expand All @@ -43,7 +43,7 @@ If you want to do that manually, run `pre-commit run --all-files`. Next to that,

## Tips

- To create translations, run `python manage.py makemessages -l de -i venv`.
- To create translations: Run `python manage.py makemessages -l de -i venv`. Fill in the translations in `django.po`. Apply changes by running `python manage.py compilemessages -i venv`.

### Reset database

Expand Down
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 %}
{% 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 %}
{% 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 %}
<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
12 changes: 9 additions & 3 deletions myhpi/core/templates/core/toc_button.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,18 @@
{% load i18n %}
{% load bootstrap_icons %}

{%if toc|hasTocContent %}
{%if toc|hasTocContent or attachments %}
<div id="sidebar-toggle" class="d-grid d-lg-none d-print-none">
<button type="button" data-bs-toggle="offcanvas" data-bs-target="#sidebar-offcanvas"
aria-controls="sidebar-offcanvas" class="btn btn-light mb-3" aria-label="{% translate 'Table of contents' %}">
aria-controls="sidebar-offcanvas" class="btn btn-light mb-3" aria-label="{% translate 'Table of contents and Attachments' %}">
{% bs_icon 'list-ol' size='1.3rem' %}
{% translate "Table of contents" %}
{% if toc|hasTocContent and attachments %}
{% translate "Table of contents and Attachments" %}
{% elif toc|hasTocContent %}
{% translate "Table of contents" %}
{% else %}
{% translate "Attachments" %}
{% endif %}
</button>
</div>
{% endif %}
87 changes: 50 additions & 37 deletions myhpi/locale/de/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-07-29 19:26+0200\n"
"POT-Creation-Date: 2024-08-09 21:23+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
Expand Down Expand Up @@ -74,88 +74,102 @@ msgstr "verlässt"
msgid "[missing link]"
msgstr "[link fehlt]"

#: myhpi/core/templates/core/information_page.html:20
#: myhpi/core/templates/core/information_page.html:21
msgid "Last edited"
msgstr "Zuletzt bearbeitet"

#: myhpi/core/templates/core/information_page.html:22
#: myhpi/core/templates/core/information_page.html:23
msgid "A long time ago"
msgstr "Vor langer Zeit"

#: myhpi/core/templates/core/information_page.html:26
#: myhpi/core/templates/core/information_page.html:27
#, python-format
msgid "%(date)s at %(time)s"
msgstr "%(date)s um %(time)s Uhr"

#: myhpi/core/templates/core/information_page.html:32
#: myhpi/core/templates/core/information_page.html:33
msgid "by"
msgstr "von"

#: myhpi/core/templates/core/minutes.html:19
#: myhpi/core/templates/core/minutes.html:22
msgid "Date"
msgstr "Datum"

#: myhpi/core/templates/core/minutes.html:23
#: myhpi/core/templates/core/minutes.html:26
msgid "Moderator"
msgstr "Sitzungsleitung"

#: myhpi/core/templates/core/minutes.html:27
#: myhpi/core/templates/core/minutes.html:30
msgid "Minutes taker"
msgstr "Protokollführung"

#: myhpi/core/templates/core/minutes.html:31
#: myhpi/core/templates/core/minutes.html:34
msgid "Participants"
msgstr "Teilnehmende"

#: myhpi/core/templates/core/minutes.html:39
#: myhpi/core/templates/core/minutes.html:42
msgid "Guests"
msgstr "Gäste"

#: myhpi/core/templates/core/minutes.html:47
#: myhpi/core/templates/core/minutes.html:50
msgid "No guests"
msgstr "Keine Gäste"

#: myhpi/core/templates/core/minutes.html:52
#: myhpi/core/templates/core/minutes.html:55
msgid "Location"
msgstr "Ort"

#: myhpi/core/templates/core/minutes.html:57
#: myhpi/core/templates/core/minutes.html:60
msgid "Labels"
msgstr "Labels"

#: myhpi/core/templates/core/minutes.html:61
#: myhpi/core/templates/core/minutes.html:64
msgid "No labels"
msgstr "Keine Labels"

#: myhpi/core/templates/core/minutes.html:71
#: myhpi/core/templates/core/minutes.html:75
msgid "Previous minutes"
msgstr "Vorheriges Protokoll"

#: myhpi/core/templates/core/minutes.html:77
#: myhpi/core/templates/core/minutes.html:81
msgid "Next minutes"
msgstr "Nächstes Protokoll"

#: myhpi/core/templates/core/minutes_list.html:14
#: myhpi/core/templates/core/minutes_list.html:18
#: myhpi/core/templates/core/sidebar.html:7
msgid "Page has unpublished changes!"
msgstr "Seite hat unveröffentlichte Änderungen!"

#: myhpi/core/templates/core/minutes_list.html:33
#: myhpi/core/templates/core/minutes_list.html:37
msgid "No minutes available for this year."
msgstr "Keine Protokolle für dieses Jahr verfügbar."

#: myhpi/core/templates/core/sidebar.html:13
msgid "Visibility"
msgstr "Sichtbarkeit"

#: myhpi/core/templates/core/sidebar.html:22
#: myhpi/core/templates/core/sidebar.html:25
#: myhpi/core/templates/core/sidebar.html:46
#: myhpi/core/templates/core/sidebar.html:52
#: myhpi/core/templates/core/toc_button.html:15
msgid "Table of contents"
msgstr "Inhaltsverzeichnis"

#: myhpi/core/templates/core/sidebar.html:30
#: myhpi/core/templates/core/sidebar.html:31
#: myhpi/core/templates/core/sidebar.html:57
#: myhpi/core/templates/core/toc_button.html:17
msgid "Attachments"
msgstr "Anhänge"

#: myhpi/core/templates/core/sidebar.html:48 myhpi/templates/base.html:134
msgid "Close"
msgstr "Schließen"

#: myhpi/core/templates/core/toc_button.html:10
#: myhpi/core/templates/core/toc_button.html:13
msgid "Table of contents and Attachments"
msgstr "Inhaltsverzeichnis und Anhänge"

#: myhpi/polls/models.py:66
#, fuzzy
#| msgid "Not subscribed users are allowed to post."
Expand Down Expand Up @@ -199,11 +213,11 @@ msgstr "Ungültige Stimmabgabe."
msgid "A database error occured. Please try again."
msgstr "Ein Datenbankfehler ist aufgetreten. Bitte versuche es erneut."

#: myhpi/polls/templates/polls/base_poll.html:20
#: myhpi/polls/templates/polls/base_poll.html:24
msgid "You've accessed this page outside of the voting period."
msgstr "Du hast diese Seite außerhalb des Abstimmungszeitraums aufgerufen."

#: myhpi/polls/templates/polls/base_poll.html:22
#: myhpi/polls/templates/polls/base_poll.html:26
#, fuzzy
#| msgid "You have already voted and the results are not yet visible."
msgid ""
Expand All @@ -212,15 +226,15 @@ msgid ""
msgstr ""
"Du hast schon abgestimmt und die Ergebnisse sind noch nicht veröffentlicht."

#: myhpi/polls/templates/polls/base_poll.html:26
#: myhpi/polls/templates/polls/base_poll.html:32
msgid "Start Date"
msgstr "Startdatum"

#: myhpi/polls/templates/polls/base_poll.html:28
#: myhpi/polls/templates/polls/base_poll.html:34
msgid "End Date"
msgstr "Enddatum"

#: myhpi/polls/templates/polls/base_poll.html:30
#: myhpi/polls/templates/polls/base_poll.html:36
msgid "Number of participants"
msgstr "Teilnehmendenanzahl"

Expand All @@ -241,11 +255,11 @@ msgstr "Stimmen"
msgid "Percentage"
msgstr "Prozent"

#: myhpi/polls/templates/polls/poll_list.html:10
#: myhpi/polls/templates/polls/poll_list.html:14
msgid "Title"
msgstr "Titel"

#: myhpi/polls/templates/polls/poll_list.html:11
#: myhpi/polls/templates/polls/poll_list.html:15
msgid "Voting period"
msgstr "Abstimmungszeitraum"

Expand All @@ -261,7 +275,7 @@ msgstr "Stimmen"

#: myhpi/search/templates/search/search.html:7
#: myhpi/search/templates/search/search.html:12
#: myhpi/search/templates/search/search_field.html:10
#: myhpi/search/templates/search/search_field.html:8
msgid "Search"
msgstr "Suche"

Expand All @@ -278,7 +292,7 @@ msgid "No results found."
msgstr "Keine Ergebnisse gefunden."

#: myhpi/search/templates/search/search_field.html:6
#: myhpi/templates/base.html:169
#: myhpi/templates/base.html:162
msgid "Search..."
msgstr "Suchen..."

Expand Down Expand Up @@ -333,33 +347,33 @@ msgstr ""
msgid "To home page"
msgstr "Zur Startseite"

#: myhpi/templates/base.html:53
#: myhpi/templates/base.html:52
msgid "Ctrl+K"
msgstr "Strg+K"

#: myhpi/templates/base.html:75
#: myhpi/templates/base.html:71
msgid "Sign in"
msgstr "Anmelden"

#: myhpi/templates/base.html:99
#: myhpi/templates/base.html:94
msgid "Your groups:"
msgstr "Deine Gruppen"

#: myhpi/templates/base.html:108
#: myhpi/templates/base.html:104
#, fuzzy
#| msgid "Next minutes"
msgid "Create minutes"
msgstr "Protokoll erstellen"

#: myhpi/templates/base.html:117
#: myhpi/templates/base.html:113
msgid "Edit profile"
msgstr "Profil bearbeiten"

#: myhpi/templates/base.html:120
#: myhpi/templates/base.html:116
msgid "Sign out"
msgstr "Abmelden"

#: myhpi/templates/base.html:171
#: myhpi/templates/base.html:163
msgid "Start search"
msgstr "Suche starten"

Expand Down Expand Up @@ -456,7 +470,6 @@ msgstr ""
"\t"

#: myhpi/tenca_django/templates/tenca_django/delete_list.html:20
#: venv/lib/python3.12/site-packages/django/forms/formsets.py:499
#, fuzzy
#| msgid "Delete list"
msgid "Delete"
Expand Down
Loading