diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 94e2784b07934b8f32f7581828ff7b598c9711a8..4ed3a9935c5fe3f9afae84d6cb4f79068d05c95e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -37,7 +37,7 @@ repos: hooks: - id: pdm-lock-check - repo: https://github.com/djlint/djLint - rev: v1.36.1 + rev: v1.36.2 hooks: - id: djlint-reformat-django - id: djlint-reformat-jinja diff --git a/src/backoffice/templates/backoffice/base.html b/src/backoffice/templates/backoffice/base.html index da3d4539bc810801363a3dadf273e9db7e8e5510..7240c92212a26d6d4e3a513ec33ddb26870a7978 100644 --- a/src/backoffice/templates/backoffice/base.html +++ b/src/backoffice/templates/backoffice/base.html @@ -266,7 +266,10 @@ {% if child.count %}<span class="badge text-bg-light ms-auto">{{ child.count }}</span>{% endif %} </a> {% if child.add_link %} - <a href="{{ child.add_link }}" class="ms-2" onclick="event.stopPropagation()" nonce={{ request.csp_nonce }}> + <a href="{{ child.add_link }}" + class="ms-2" + onclick="event.stopPropagation()" + nonce="{{ request.csp_nonce }}"> <i class="bi bi-plus-circle"></i> </a> {% endif %} diff --git a/src/plainui/jinja2/plainui/badges/manage.html.j2 b/src/plainui/jinja2/plainui/badges/manage.html.j2 index ce97e26061564498ece45164a39c8e537445ac64..f44bb7edce51b0a2d37eb96d2b50baeb947ac3ff 100644 --- a/src/plainui/jinja2/plainui/badges/manage.html.j2 +++ b/src/plainui/jinja2/plainui/badges/manage.html.j2 @@ -11,13 +11,13 @@ {{ navMacro.top_nav(_("Manage Badges", has_breadcrumbs=True) ) }} <ol class="breadcrumb hub-breadcrumbs"> <li class="breadcrumb-item"> - <a href="{{ url("plainui:index") }}">{{ conf.name }}</a> + <a href="{{ url('plainui:index') }}">{{ conf.name }}</a> </li> <li class="breadcrumb-item"> - <a href="{{ url("plainui:userprofile") }}">{{ _("Profile") }}</a> + <a href="{{ url('plainui:userprofile') }}">{{ _("Profile") }}</a> </li> <li class="breadcrumb-item"> - <a href="{{ url("plainui:manage_badges") }}">{{ _("Manage Badges") }}</a> + <a href="{{ url('plainui:manage_badges') }}">{{ _("Manage Badges") }}</a> </li> </ol> @@ -25,7 +25,7 @@ <div class="hub-card"> <h2 class="hub-section-title">{{ _("Redeem Token") }}</h2> <form method="post" - action="{{ url("plainui:manage_badges") }}{%- if request.GET.next -%}?next={{ request.GET.next }}{%- endif -%}"> + action="{{ url('plainui:manage_badges') }}{%- if request.GET.next -%}?next={{ request.GET.next }}{%- endif -%}"> <div class="flex flex-column"> {{ csrf_input }} {{ form_elements.render_form_fields(redeem_badge_form) }} @@ -54,7 +54,7 @@ <div class="hub-card"> <h3 class="hub-section-title mb-4">{{ _("Accepted Badges") }}</h3> <p> - <a class="hub-btn" href="{{ url("plainui:badges") }}">{{ _("Discover badges") }}</a> + <a class="hub-btn" href="{{ url('plainui:badges') }}">{{ _("Discover badges") }}</a> </p> <div> <div class="hub-hlayout mb-2">{{ _("badge__manage__accepted_help") }}</div> diff --git a/src/plainui/jinja2/plainui/components/calendar.html.j2 b/src/plainui/jinja2/plainui/components/calendar.html.j2 index 54e7f40f9c2cee53638497af4bc8ccb9178116d6..3e52e835005c912b8cf9851d4fab71c5335932c9 100644 --- a/src/plainui/jinja2/plainui/components/calendar.html.j2 +++ b/src/plainui/jinja2/plainui/components/calendar.html.j2 @@ -15,7 +15,9 @@ <div class="hub-fahrplan__timeline"> <h2 class="m-0 hub-fahrplan__timeline-title"> </h2> {% for step in time_steps %} - <figure class="m-0 px-2" {{ 'id=day{}'.format(step.day) if (step.new_day or loop.first) }} style="height: {{ h(step_minutes) }}"> + <figure class="m-0 px-2" + {{ 'id=day{}'.format(step.day) if (step.new_day or loop.first) }} + style="height: {{ h(step_minutes) }}"> {% if step.new_day %} <span class="fw-bolder">{{ _('Day %(n)s', n=step.day) }}</span> {% endif %} diff --git a/src/plainui/jinja2/plainui/components/form_elements.html.j2 b/src/plainui/jinja2/plainui/components/form_elements.html.j2 index 03e1c1e1340117680e986c2768589d30d57c283c..6da3b51b269bedaed4a4c2530e6c9b94e09292d1 100644 --- a/src/plainui/jinja2/plainui/components/form_elements.html.j2 +++ b/src/plainui/jinja2/plainui/components/form_elements.html.j2 @@ -17,7 +17,15 @@ </div> {% endif %} <div class="col-sm-12 col-lg-12"> - <input id="{{ my_id }}" class="form-control{% if form.has_error(name) %} is-invalid{% endif %}" name="{{ name }}" type="{{ type_ }}" value="{{ el.value() or '' }}" {%- if el.field.required %} required{% endif -%} {%- if el.field.disabled %} disabled{% endif -%} {%- for attr, value in el.field.widget.attrs.items() -%} {% if value is true %} {{ attr }}{% elif value is not false %} {{ attr }}="{{ value }}"{% endif -%} {% endfor -%}> + <input id="{{ my_id }}" + class="form-control {% if form.has_error(name) %}is-invalid{% endif %}" + name="{{ name }}" + type="{{ type_ }}" + value="{{ el.value() or '' }}" + {%- if el.field.required %} required {% endif -%} + {%- if el.field.disabled %} disabled {% endif -%} + {%- for attr, value in el.field.widget.attrs.items() -%} {% if value is true %} {{ attr }} {% elif value is not false %} {{ attr }}="{{ value }}" {% endif -%} + {% endfor -%}> {% for err in form.errors.get(name, []) %}<p class="d-block invalid-feedback">{{ _(err) }}</p>{% endfor %} {% if el.help_text %}<div class="d-block form-text fs-medium mt-1">{{ el.help_text | safe }}</div>{% endif %} </div> @@ -41,7 +49,13 @@ </label> </div> <div class="col-sm-12 col-lg-12"> - <textarea id="{{ my_id }}" class="form-control{% if form.has_error(name) %} is-invalid{% endif %}" name="{{ name }}" {%- if el.field.required %} required{% endif -%} {%- if el.field.disabled %} disabled{% endif -%} {%- for attr, value in el.field.widget.attrs.items() -%} {% if value is true %} {{attr}}{% elif value is not false %} {{attr}}="{{value}}"{% endif -%} {% endfor -%}>{{ el.value() or '' }}</textarea> + <textarea id="{{ my_id }}" + class="form-control {% if form.has_error(name) %} is-invalid {% endif %}" + name="{{ name }}" + {%- if el.field.required %} required {% endif -%} + {%- if el.field.disabled %} disabled {% endif -%} + {%- for attr, value in el.field.widget.attrs.items() -%} {% if value is true %} {{attr}} {% elif value is not false %} {{attr}}="{{value}}" {% endif -%} + {% endfor -%}>{{ el.value() or '' }}</textarea> {% for err in form.errors.get(name, []) %}<p class="d-block invalid-feedback">{{ _(err) }}</p>{% endfor %} {% if el.help_text %}<div class="d-block form-text fs-medium mt-1">{{ el.help_text | safe }}</div>{% endif %} </div> @@ -85,11 +99,19 @@ </div> <div class="col-sm-12 col-lg-12"> <div class="form-control-selectbox"> - <select id="{{ my_id }}" class="form-select{% if form.has_error(name) %} is-invalid{% endif %}" name="{{ name }}" {%- if el.field.required %} required{% endif -%} {%- if el.field.disabled %} disabled{% endif -%} {%- for attr, value in el.field.widget.attrs.items() -%} {% if value is true %} {{ attr }}{% elif value is not false %} {{ attr }}="{{ value }}"{% endif -%} {% endfor -%}> + <select id="{{ my_id }}" + class="form-select {% if form.has_error(name) %}is-invalid{% endif %}" + name="{{ name }}" + {%- if el.field.required %} required {% endif -%} + {%- if el.field.disabled %} disabled {% endif -%} + {%- for attr, value in el.field.widget.attrs.items() -%} {% if value is true %} {{ attr }} {% elif value is not false %} {{ attr }}="{{ value }}" {% endif -%} + {% endfor -%}> {% for group_name, group_choices, group_index in el.field.widget.optgroups(name, el.field.widget.format_value(el.value())) %} {% if group_name %}<optgroup label="{{ group_name }}">{% endif %} {% for option in group_choices %} - <option value="{{ option.value|string }}"{%- for attr, value in option.attrs.items() -%} {% if value is true %} {{ attr }}{% elif value is not false %} {{ attr }}="{{ value }}"{% endif -%} {% endfor -%}>{{ option.label }} + <option value="{{ option.value|string }}" + {%- for attr, value in option.attrs.items() -%} {% if value is true %} {{ attr }} {% elif value is not false %} {{ attr }}="{{ value }}" {% endif -%} + {% endfor -%}>{{ option.label }} </option> {% endfor %} {% if group_name %}</optgroup>{% endif %} @@ -130,9 +152,9 @@ {% macro errors(form) -%} {% if form.non_field_errors() -%} <ul class="list-unstyled text-left my-5"> - {% for error in form.non_field_errors() %} + {% for error_text in form.non_field_errors() %} <li class="d-block text-danger"> - <b>{{ _(error) }}</b> + <b>{{ error_text }}</b> </li> {%- endfor %} </ul> diff --git a/src/plainui/jinja2/plainui/components/nav.html.j2 b/src/plainui/jinja2/plainui/components/nav.html.j2 index 5470dc98fae01ddae1a1589f7912d88f6b2f62df..6d76e9e4a979afbb9ec97e59c96898194762d676 100644 --- a/src/plainui/jinja2/plainui/components/nav.html.j2 +++ b/src/plainui/jinja2/plainui/components/nav.html.j2 @@ -54,14 +54,14 @@ <li> {% set num_of_pending_badges = num_of_pending_badges(request) -%} <a class="dropdown-item" - href="{{ url("plainui:user", user_slug=user.slug) }}" - title="{{ _("profile") }}">{{ _("profile") }}</a> + href="{{ url('plainui:user', user_slug=user.slug) }}" + title="{{ _('profile') }}">{{ _('profile') }}</a> <a class="dropdown-item" - href="{{ url("plainui:userprofile") }}" - title="{{ _("Edit your profile") }}">{{ _("Edit your profile") }}</a> + href="{{ url('plainui:userprofile') }}" + title="{{ _('Edit your profile') }}">{{ _('Edit your profile') }}</a> <a class="dropdown-item" - href="{{ url("plainui:manage_badges") }}" - title="{{ _("Manage Badges") }}"> + href="{{ url('plainui:manage_badges') }}" + title="{{ _('Manage Badges') }}"> {{ _("Manage Badges") }} {% if num_of_pending_badges %}<span class="hub-header__badge badge">{{ num_of_pending_badges }}</span>{% endif %} </a> diff --git a/src/plainui/jinja2/plainui/header.html.j2 b/src/plainui/jinja2/plainui/header.html.j2 index a770e25b36e0dd0e5f95aa21ed9c52c7ad00a196..37fec65dd280f992405d50c8e0b7e7efdb7869d7 100644 --- a/src/plainui/jinja2/plainui/header.html.j2 +++ b/src/plainui/jinja2/plainui/header.html.j2 @@ -80,14 +80,14 @@ <li> {% set num_of_pending_badges = num_of_pending_badges(request) -%} <a class="dropdown-item" - href="{{ url("plainui:user", user_slug=user.slug) }}" - title="{{ _("profile") }}">{{ _("profile") }}</a> + href="{{ url('plainui:user', user_slug=user.slug) }}" + title="{{ _('profile') }}">{{ _('profile') }}</a> <a class="dropdown-item" - href="{{ url("plainui:userprofile") }}" - title="{{ _("Edit your profile") }}">{{ _("Edit your profile") }}</a> + href="{{ url('plainui:userprofile') }}" + title="{{ _('Edit your profile') }}">{{ _('Edit your profile') }}</a> <a class="dropdown-item" - href="{{ url("plainui:manage_badges") }}" - title="{{ _("Manage Badges") }}"> + href="{{ url('plainui:manage_badges') }}" + title="{{ _('Manage Badges') }}"> {{ _("Manage Badges") }} {% if num_of_pending_badges %}<span class="hub-header__badge badge">{{ num_of_pending_badges }}</span>{% endif %} </a> diff --git a/src/plainui/jinja2/plainui/landing.html.j2 b/src/plainui/jinja2/plainui/landing.html.j2 index 64004288ab8c802069c368ee3ff47a3feae2da9e..78a25b162e1deea4981b560fe4f120b3c98a5a73 100644 --- a/src/plainui/jinja2/plainui/landing.html.j2 +++ b/src/plainui/jinja2/plainui/landing.html.j2 @@ -22,11 +22,7 @@ <ul class="navbar-nav ms-auto"> {%- if request.user.is_authenticated %} {# TODO: look if world exists - <a - href="{{ url('plainui:world') }}" - title="{{ _("world") }}" - class="hub-header-link nav-link" - > + <a href="{{ url('plainui:world') }}" title="{{ _("world") }}" class="hub-header-link nav-link"> #} <a href="{{ url('plainui:index') }}" title="{{ _('platform') }}" diff --git a/src/plainui/jinja2/plainui/profile.html.j2 b/src/plainui/jinja2/plainui/profile.html.j2 index b30de1cde82c363974785953865231de39da08d7..5bdaa3af0472e97c6f5f5406b08d928e5f25d13b 100644 --- a/src/plainui/jinja2/plainui/profile.html.j2 +++ b/src/plainui/jinja2/plainui/profile.html.j2 @@ -25,10 +25,10 @@ <div class="hub-tag hub-tag--clear">{{ _("last login") }} {{ user.last_login | strftime }}</div> <div class="mt-3"> <p> - <a href="{{ url("plainui:user", user_slug=user.slug) }}" class="hub-btn">{{ _("View my public user page") }}</a> + <a href="{{ url('plainui:user', user_slug=user.slug) }}" class="hub-btn">{{ _("View my public user page") }}</a> </p> <p> - <a class="hub-btn" href="{{ url("plainui:manage_badges") }}">{{ _("Badges: Accept / Revoke / Visibility") }}</a> + <a class="hub-btn" href="{{ url('plainui:manage_badges') }}">{{ _("Badges: Accept / Revoke / Visibility") }}</a> </p> </div> </div> diff --git a/src/plainui/jinja2/plainui/static_page_global_history.html.j2 b/src/plainui/jinja2/plainui/static_page_global_history.html.j2 index 6cc105db5ad1dcb7fc85759776eff8bafbc10141..240a742f4a696c40ffa80124475816d11a759b70 100644 --- a/src/plainui/jinja2/plainui/static_page_global_history.html.j2 +++ b/src/plainui/jinja2/plainui/static_page_global_history.html.j2 @@ -19,9 +19,9 @@ <a href="{{ url("plainui:static_page", page_slug=history_entry.page.slug) }}?rev={{ history_entry.revision }}">{{ history_entry.page.title }} {{ _("updated at") }} {{ history_entry.timestamp.strftime("%H:%M") }}</a> {%- if history_entry.author %} {{ _("from user") }} - <a href="{{ url("plainui:user", user_slug=history_entry.author.slug) }}">{{ history_entry.author.display_name if history_entry.author else _("<Unknown User>") }}</a> + <a href="{{ url('plainui:user', user_slug=history_entry.author.slug) }}">{{ history_entry.author.display_name if history_entry.author else _("{Unknown User}") }}</a> {%- else %} - {{ _("<Unknown User>") }} + {{ _("{Unknown User}") }} {%- endif %} </li> {% endfor %} diff --git a/src/plainui/jinja2/plainui/static_page_history.html.j2 b/src/plainui/jinja2/plainui/static_page_history.html.j2 index fc061630969d9ede2c9b2b76edc25a1854015bba..dd8fdde0c72d2ab22cddad6cfaa73c0354fb959a 100644 --- a/src/plainui/jinja2/plainui/static_page_history.html.j2 +++ b/src/plainui/jinja2/plainui/static_page_history.html.j2 @@ -18,31 +18,29 @@ </nav> <article class="pb-11 staticpage"> - <a href="{{ url('plainui:static_page', page_slug=page_slug) }}" class="btn btn-dark m-2">{{ _('Back') }}</a> + <a href="{{ url('plainui:static_page', page_slug=page_slug) }}" + class="btn btn-dark m-2">{{ _("Back") }}</a> - <form method="get" class="hub-card" + <form method="get" + class="hub-card" action="{{ url('plainui:static_page_diff', page_slug=page_slug) }}"> - <h2 class="hub-section-title">{{ _('History') }}</h2> + <h2 class="hub-section-title">{{ _("History") }}</h2> - <p> - {{ _('Wiki__history__rev_help') }} - </p> + <p>{{ _("Wiki__history__rev_help") }}</p> <ul> {% for history_entry in history %} <li class="list-unstyled"> <input type="radio" name="rev" value="{{ history_entry.revision }}"> <input type="radio" name="rev2" value="{{ history_entry.revision }}"> - {{ _('updated at') }} + {{ _("updated at") }} {%- if loop.first %} <span class="time"><a href="{{ url('plainui:static_page', page_slug=page_slug) }}">{{ history_entry.timestamp | strftime }}</a></span> {% else %} <span class="time"><a href="{{ url('plainui:static_page', page_slug=page_slug) }}?rev={{ history_entry.revision }}">{{ history_entry.timestamp | strftime }}</a></span> {% endif %} - {{ _('from user') }} - {# djlint:off H025 #} - <a href="{{ url('plainui:user', user_slug=history_entry.author.slug) }}">{{ history_entry.author.display_name if history_entry.author else _("<Unknown User>") }}</a> - {# djlint:on #} + {{ _("from user") }} + <a href="{{ url('plainui:user', user_slug=history_entry.author.slug) }}">{{ history_entry.author.display_name if history_entry.author else _("{Unknown User}") }}</a> </li> {% endfor %} </ul> diff --git a/src/plainui/jinja2/plainui/user.html.j2 b/src/plainui/jinja2/plainui/user.html.j2 index 420ad3701e287a400e973847ac7d7f0078262b9e..9b38cc59bd9d78bbb19f8aa9e8ea3a342b6bfaac 100644 --- a/src/plainui/jinja2/plainui/user.html.j2 +++ b/src/plainui/jinja2/plainui/user.html.j2 @@ -55,7 +55,7 @@ </div> <div class="pt-4"> <p> - <a class="hub-btn" href="{{ url("plainui:badges") }}">{{ _("Discover badges") }}</a> + <a class="hub-btn" href="{{ url('plainui:badges') }}">{{ _("Discover badges") }}</a> </p> </div> </div> diff --git a/src/plainui/locale/de/LC_MESSAGES/django.po b/src/plainui/locale/de/LC_MESSAGES/django.po index 76c8955f360a0f4fd2754feb45beb993d7292320..15e04eda7755b5e9a868301d0831d6c7faf978f9 100644 --- a/src/plainui/locale/de/LC_MESSAGES/django.po +++ b/src/plainui/locale/de/LC_MESSAGES/django.po @@ -804,8 +804,8 @@ msgstr "geändert am" msgid "from user" msgstr "von Nutzer" -msgid "<Unknown User>" -msgstr "<Unbekannter Nutzer>" +msgid "{Unknown User}" +msgstr "{Unbekannter Nutzer}" msgid "Wiki__history__rev_help" msgstr "Wähle 2 Versionen um sie zu vergleichen." diff --git a/src/plainui/locale/en/LC_MESSAGES/django.po b/src/plainui/locale/en/LC_MESSAGES/django.po index f6af3f9b40d7d268619cb942b2327406404b5879..718759fb820576b7595b62794ab9ae99cab4ecba 100644 --- a/src/plainui/locale/en/LC_MESSAGES/django.po +++ b/src/plainui/locale/en/LC_MESSAGES/django.po @@ -804,7 +804,7 @@ msgstr "updated at" msgid "from user" msgstr "from user" -msgid "<Unknown User>" +msgid "{Unknown User}" msgstr "" msgid "Wiki__history__rev_help" diff --git a/src/plainui/templates/403.html b/src/plainui/templates/403.html index 49548cc55e9967b6046e0dbae82b70bfdfb3b895..ca5a57bedcaf2201698c6d16ef2309c9b014bf2e 100644 --- a/src/plainui/templates/403.html +++ b/src/plainui/templates/403.html @@ -33,7 +33,9 @@ <body> <article> <a href="{% hub_absolute "plainui:index" %}" class="row my-8"> - <img src="{% static "error_pages/403.svg" %}" alt="403 - Forbidden" title="403 - Forbidden" /> + <img src="{% static "error_pages/403.svg" %}" + alt="403 - Forbidden" + title="403 - Forbidden" /> </a> </article> </body> diff --git a/src/plainui/templates/404.html b/src/plainui/templates/404.html index 41f97f4432040b709c9a6bf41c2f3665d7190b23..4633c08836dbbc146cbbb7bde1b5d0504e0a1067 100644 --- a/src/plainui/templates/404.html +++ b/src/plainui/templates/404.html @@ -33,7 +33,9 @@ <body> <article> <a href="{% hub_absolute "plainui:index" %}" class="row my-8"> - <img src="{% static "error_pages/404.svg" %}" alt="404 Error" title="404 Error" /> + <img src="{% static "error_pages/404.svg" %}" + alt="404 Error" + title="404 Error" /> </a> </article> </body> diff --git a/src/plainui/templates/500.html b/src/plainui/templates/500.html index d683c1a8ca637f660e91e1cd989ea42f26479ad9..0e5c6011760400544fff403875132384d50f730e 100644 --- a/src/plainui/templates/500.html +++ b/src/plainui/templates/500.html @@ -33,7 +33,9 @@ <body> <article> <a href="{% hub_absolute "plainui:index" %}" class="row my-8"> - <img src="{% static "error_pages/500.svg" %}" alt="500 - internal Server error" title="500 - internal Server error" /> + <img src="{% static "error_pages/500.svg" %}" + alt="500 - internal Server error" + title="500 - internal Server error" /> </a> </article> </body>