Skip to content

Commit

Permalink
drop: DjLint formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
Restioson committed Oct 8, 2024
1 parent 7865e43 commit 46040e0
Show file tree
Hide file tree
Showing 36 changed files with 1,217 additions and 1,207 deletions.
3 changes: 3 additions & 0 deletions app/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,6 @@ select = [
"I",
"W"
]

[tool.djlint]
profile = "django"
9 changes: 6 additions & 3 deletions app/templates/400.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{% extends "base_error.html" %}
{% load i18n %}

{% block error_title %}{% trans "Bad request (400)" %}{% endblock %}
{% block error_message %}{% trans "The server cannot process the request due to client error." %}{% endblock %}
{% block error_title %}
{% trans "Bad request (400)" %}
{% endblock %}
{% block error_message %}
{% trans "The server cannot process the request due to client error." %}
{% endblock %}
9 changes: 6 additions & 3 deletions app/templates/403.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{% extends "base_error.html" %}
{% load i18n %}

{% block error_title %}{% trans "Forbidden (403)" %}{% endblock %}
{% block error_message %}{% trans "You do not have permission to access on this server." %}{% endblock %}
{% block error_title %}
{% trans "Forbidden (403)" %}
{% endblock %}
{% block error_message %}
{% trans "You do not have permission to access on this server." %}
{% endblock %}
9 changes: 6 additions & 3 deletions app/templates/404.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{% extends "base_error.html" %}
{% load i18n %}

{% block error_title %}{% trans "Not found (404)" %}{% endblock %}
{% block error_message %}{% trans "The requested page was not found on this server." %}{% endblock %}
{% block error_title %}
{% trans "Not found (404)" %}
{% endblock %}
{% block error_message %}
{% trans "The requested page was not found on this server." %}
{% endblock %}
7 changes: 4 additions & 3 deletions app/templates/500.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{% extends "base_error.html" %}
{% load i18n %}

{% block error_title %}{% trans "Internal Server Error (500)" %}{% endblock %}
{% block error_title %}
{% trans "Internal Server Error (500)" %}
{% endblock %}
{% block error_message %}
{% trans "The server encountered an unexpected condition that prevented it from fulfilling the request." %}
{% trans "The server encountered an unexpected condition that prevented it from fulfilling the request." %}
{% endblock %}
33 changes: 17 additions & 16 deletions app/templates/admin/base_site.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,26 @@
should be incorporated here, and update the links above that serve as the point
of comparison.
{% endcomment %}

{% load static %}
{% load i18n %}

{% block title %}{% if subtitle %}{{ subtitle }} | {% endif %}{{ title }} | {{ site_title|default:_('Django site admin') }}{% endblock %}

{% block title %}
{% if subtitle %}{{ subtitle }} |{% endif %}
{{ title }} | {{ site_title|default:_("Django site admin") }}
{% endblock %}
{% block extrastyle %}
<link rel="stylesheet" href="{% static 'css/admin.css' %}">
<link rel="stylesheet" href="{% static 'css/dark_mode_override.css' %}">
<link rel="icon" href="{% static 'img/favicon.png' %}" sizes="32x32">
<link rel="stylesheet" href="{% static 'css/admin.css' %}">
<link rel="stylesheet" href="{% static 'css/dark_mode_override.css' %}">
<link rel="icon" href="{% static 'img/favicon.png' %}" sizes="32x32">
{% endblock %}

{% block branding %}
<h1 class="header-title">
<a href="{% url 'home' %}">
<img src="{% static 'img/lwimilinks.svg' %}" class="main-logo" alt="{% trans 'LwimiLinks' %}">
</a>
</h1>
{% if user.is_anonymous %}
{% include "admin/color_theme_toggle.html" %}
{% endif %}
<h1 class="header-title">
<a href="{% url 'home' %}">
<img src="{% static 'img/lwimilinks.svg' %}"
class="main-logo"
alt="{% trans 'LwimiLinks' %}">
</a>
</h1>
{% if user.is_anonymous %}
{% include "admin/color_theme_toggle.html" %}
{% endif %}
{% endblock %}
4 changes: 1 addition & 3 deletions app/templates/app/_nav_item.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<li class="nav-item me-1">
<a href="{% url view %}"
{% if current_page == view %} class="nav-link active px-3" aria-current="page"
{% else %} class="nav-link px-3"
{% endif %}>
{% if current_page == view %} class="nav-link active px-3" aria-current="page" {% else %} class="nav-link px-3" {% endif %}>
{{ label }}
</a>
</li>
22 changes: 11 additions & 11 deletions app/templates/app/_navbar_items.html
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{% load i18n %}
{% spaceless %}
<div class="collapse navbar-collapse" id="navbarPills" hx-swap-oob="true">
<ul class="nav-pills navbar-nav me-auto mb-2 mb-lg-0">
{% include "app/_nav_item.html" with view="home" label=_("Home") %}
{% include "app/_nav_item.html" with view="search" label=_("Search") %}
{% include "app/_nav_item.html" with view="institutions" label=_("Institutions") %}
{% include "app/_nav_item.html" with view="projects" label=_("Projects") %}
{% include "app/_nav_item.html" with view="documents" label=_("Documents") %}
{% include "app/_nav_item.html" with view="languages" label=_("Languages") %}
{% include "app/_nav_item.html" with view="subjects" label=_("Subjects") %}
</ul>
</div>
<div class="collapse navbar-collapse" id="navbarPills" hx-swap-oob="true">
<ul class="nav-pills navbar-nav me-auto mb-2 mb-lg-0">
{% include "app/_nav_item.html" with view="home" label=_("Home") %}
{% include "app/_nav_item.html" with view="search" label=_("Search") %}
{% include "app/_nav_item.html" with view="institutions" label=_("Institutions") %}
{% include "app/_nav_item.html" with view="projects" label=_("Projects") %}
{% include "app/_nav_item.html" with view="documents" label=_("Documents") %}
{% include "app/_nav_item.html" with view="languages" label=_("Languages") %}
{% include "app/_nav_item.html" with view="subjects" label=_("Subjects") %}
</ul>
</div>
{% endspaceless %}
76 changes: 46 additions & 30 deletions app/templates/app/_pagination.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{% load i18n %}
{% spaceless %}
{% if page_obj.has_previous or page_obj.has_next %}
<nav aria-label="{% trans 'Pages' %}" class="my-3">
{# TODO: ideal accessibility combination of aria-label and h4? #}
<h4 class="d-sm-none">{% trans "Pages" %}</h4>
{% comment %}
{% if page_obj.has_previous or page_obj.has_next %}
<nav aria-label="{% trans 'Pages' %}" class="my-3">
{# TODO: ideal accessibility combination of aria-label and h4? #}
<h4 class="d-sm-none">{% trans "Pages" %}</h4>
{% comment %}
Notes:
* Below small or with long translations, there is likely not enough
horisontal space.
Expand All @@ -26,44 +26,60 @@ <h4 class="d-sm-none">{% trans "Pages" %}</h4>
* text-center is mostly for the vertical case to center the text.
* &nbsp; is a non-breaking space that avoids an arrow wrapping separately
from the label.
{% endcomment %}
<style>
{% endcomment %}
<style>
@media (max-width: 575px) {
.page-item:first-child .page-link { border-radius: 0 }
.page-item:last-child .page-link { border-radius: 0 }
}
</style>
{% with lefter='class="page-link pe-4 pe-sm-3"' righter='class="page-link ps-4 ps-sm-3"' %}
{% with disabled='class="page-item disabled d-none d-sm-block" aria-hidden="true"' %}
<ul class="pagination flex-wrap justify-content-center text-center list-group list-group-horizontal-sm px-5 px-sm-0">
{% if page_obj.has_previous %}
<li class="page-item"><a {{ lefter }} href="?{{ url_params }}&page=1">&laquo;&nbsp;{% trans "Start" %}</a></li>
<li class="page-item"><a {{ lefter }} href="?{{ url_params }}&page={{ page_obj.previous_page_number }}">&lsaquo;&nbsp;{% trans "Previous" %}</a></li>
{% else %}
<li {{ disabled }}><span {{ lefter }}>&laquo;&nbsp;{% trans "First" %}</span></li>
<li {{ disabled }}><span {{ lefter }}>&lsaquo;&nbsp;{% trans "Previous" %}</span></li>
</style>
{% with lefter='class="page-link pe-4 pe-sm-3"' righter='class="page-link ps-4 ps-sm-3"' %}
{% with disabled='class="page-item disabled d-none d-sm-block" aria-hidden="true"' %}
<ul class="pagination flex-wrap justify-content-center text-center list-group list-group-horizontal-sm px-5 px-sm-0">
{% if page_obj.has_previous %}
<li class="page-item">
<a {{ lefter }} href="?{{ url_params }}&page=1">&laquo;&nbsp;{% trans "Start" %}</a>
</li>
<li class="page-item">
<a {{ lefter }} href="?{{ url_params }}&page={{ page_obj.previous_page_number }}">&lsaquo;&nbsp;{% trans "Previous" %}</a>
</li>
{% else %}
<li {{ disabled }}><span {{ lefter }}>&laquo;&nbsp;{% trans "First" %}</span>
</li>
<li {{ disabled }}><span {{ lefter }}>&lsaquo;&nbsp;{% trans "Previous" %}</span>
</li>
{% endif %}

{% for num in page_obj.paginator.page_range %}
{% if page_obj.number == num %}
<li class="page-item active"><a aria-current="page" class="page-link" href="#">{{ num }}</a></li>
<li class="page-item active">
<a aria-current="page" class="page-link" href="#">{{ num }}</a>
</li>
{% elif num > page_obj.number|add:-3 and num < page_obj.number|add:3 %}
<li class="page-item"><a class="page-link" href="?{{ url_params }}&page={{ num }}">{{ num }}</a></li>
<li class="page-item">
<a class="page-link" href="?{{ url_params }}&page={{ num }}">{{ num }}</a>
</li>
{% elif num == page_obj.number|add:-4 or num == page_obj.number|add:4 %}
<li class="page-item"><span aria-hidden="true" class="page-link">...</span></li>
<li class="page-item">
<span aria-hidden="true" class="page-link">...</span>
</li>
{% endif %}
{% endfor %}

{% if page_obj.has_next %}
<li class="page-item"><a {{ righter }} href="?{{ url_params }}&page={{ page_obj.next_page_number }}" preload>{% trans "Next" %}&nbsp;&rsaquo;</a></li>
<li class="page-item"><a {{ righter }} href="?{{ url_params }}&page={{ page_obj.paginator.num_pages }}">{% trans "Last" %}&nbsp;&raquo;</a></li>
<li class="page-item">
<a {{ righter }} href="?{{ url_params }}&page={{ page_obj.next_page_number }}" preload>{% trans "Next" %}&nbsp;&rsaquo;</a>
</li>
<li class="page-item">
<a {{ righter }} href="?{{ url_params }}&page={{ page_obj.paginator.num_pages }}">{% trans "Last" %}&nbsp;&raquo;</a>
</li>
{% else %}
<li {{ disabled }}><span {{ righter }}>{% trans "Next" %}&nbsp;&rsaquo;</span></li>
<li {{ disabled }}><span {{ righter }}>{% trans "Last" %}&nbsp;&raquo;</span></li>
{% endif %}
</ul>
{% endwith %}
{% endwith %}
<li {{ disabled }}><span {{ righter }}>{% trans "Next" %}&nbsp;&rsaquo;</span>
</li>
<li {{ disabled }}><span {{ righter }}>{% trans "Last" %}&nbsp;&raquo;</span>
</li>
{% endif %}
</ul>
{% endwith %}
{% endwith %}
</nav>
{% endif %}
{% endspaceless %}
23 changes: 12 additions & 11 deletions app/templates/app/_search_filter.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
{% spaceless %}
<fieldset class="checkbox-container form-control mb-4">
<legend>{{ field.label }}</legend>
<details {% if field.value %}open{% endif%}>{# open if currently filtering on this field #}
<summary>{{ summary }}</summary>
{% for checkbox in field %}
<div class="form-check">
<label>{{ checkbox.tag }}{{ checkbox.choice_label }}</label>
</div>
{% endfor %}
</details>
</fieldset>
<fieldset class="checkbox-container form-control mb-4">
<legend>{{ field.label }}</legend>
<details {% if field.value %}open{% endif %}>
{# open if currently filtering on this field #}
<summary>{{ summary }}</summary>
{% for checkbox in field %}
<div class="form-check">
<label>{{ checkbox.tag }}{{ checkbox.choice_label }}</label>
</div>
{% endfor %}
</details>
</fieldset>
{% endspaceless %}
84 changes: 42 additions & 42 deletions app/templates/app/_subj_lang_institution_filter.html
Original file line number Diff line number Diff line change
@@ -1,47 +1,47 @@
{% load i18n %}
{% spaceless %}
<form method="GET" action="{% url view %}" class="mb-3">
<div class="d-flex flex-wrap gap-2">
<div class="form-group flex-fill mb-2">
<label for="subject">{% trans "Subject" %}</label>
<select id="subject" name="subject" class="form-select">
<option value="">{% trans "All Subjects" %}</option>
{% for subject in subjects %}
<option value="{{ subject.id }}"
{% if request.GET.subject == subject.id|stringformat:"s" %}selected{% endif %}>
{{ subject.name }}
</option>
{% endfor %}
</select>
<form method="GET" action="{% url view %}" class="mb-3">
<div class="d-flex flex-wrap gap-2">
<div class="form-group flex-fill mb-2">
<label for="subject">{% trans "Subject" %}</label>
<select id="subject" name="subject" class="form-select">
<option value="">{% trans "All Subjects" %}</option>
{% for subject in subjects %}
<option value="{{ subject.id }}"
{% if request.GET.subject == subject.id|stringformat:"s" %}selected{% endif %}>
{{ subject.name }}
</option>
{% endfor %}
</select>
</div>
<div class="form-group flex-fill mb-2">
<label for="language">{% trans "Language" %}</label>
<select id="language" name="language" class="form-select">
<option value="">{% trans "All Languages" %}</option>
{% for language in languages %}
<option value="{{ language.id }}"
{% if request.GET.language == language.id|stringformat:"s" %}selected{% endif %}>
{{ language.name }}
</option>
{% endfor %}
</select>
</div>
<div class="form-group flex-fill mb-2">
<label for="institution">{% trans "Institution" %}</label>
<select id="institution" name="institution" class="form-select">
<option value="">{% trans "All Institutions" %}</option>
{% for institution in institutions %}
<option value="{{ institution.id }}"
{% if request.GET.institution == institution.id|stringformat:"s" %}selected{% endif %}>
{{ institution }}
</option>
{% endfor %}
</select>
</div>
</div>
<div class="form-group flex-fill mb-2">
<label for="language">{% trans "Language" %}</label>
<select id="language" name="language" class="form-select">
<option value="">{% trans "All Languages" %}</option>
{% for language in languages %}
<option value="{{ language.id }}"
{% if request.GET.language == language.id|stringformat:"s" %}selected{% endif %}>
{{ language.name }}
</option>
{% endfor %}
</select>
<div class="d-flex flex-wrap">
<button type="submit" class="btn btn-primary mt-2 me-2">{% trans "Filter" %}</button>
<a href="{% url view %}" class="btn btn-secondary mt-2">{% trans "Reset" %}</a>
</div>
<div class="form-group flex-fill mb-2">
<label for="institution">{% trans "Institution" %}</label>
<select id="institution" name="institution" class="form-select">
<option value="">{% trans "All Institutions" %}</option>
{% for institution in institutions %}
<option value="{{ institution.id }}"
{% if request.GET.institution == institution.id|stringformat:"s" %}selected{% endif %}>
{{ institution }}
</option>
{% endfor %}
</select>
</div>
</div>
<div class="d-flex flex-wrap">
<button type="submit" class="btn btn-primary mt-2 me-2">{% trans "Filter" %}</button>
<a href="{% url view %}" class="btn btn-secondary mt-2">{% trans "Reset" %}</a>
</div>
</form>
</form>
{% endspaceless %}
Loading

0 comments on commit 46040e0

Please sign in to comment.