diff --git a/app/pyproject.toml b/app/pyproject.toml index 5be1384..3f54884 100644 --- a/app/pyproject.toml +++ b/app/pyproject.toml @@ -8,3 +8,6 @@ select = [ "I", "W" ] + +[tool.djlint] +profile = "django" diff --git a/app/templates/400.html b/app/templates/400.html index da81bca..5659e1f 100644 --- a/app/templates/400.html +++ b/app/templates/400.html @@ -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 %} diff --git a/app/templates/403.html b/app/templates/403.html index 8b8dbb5..33fa6d6 100644 --- a/app/templates/403.html +++ b/app/templates/403.html @@ -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 %} diff --git a/app/templates/404.html b/app/templates/404.html index 649e22c..1b152ae 100644 --- a/app/templates/404.html +++ b/app/templates/404.html @@ -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 %} diff --git a/app/templates/500.html b/app/templates/500.html index be6be8d..1782d0c 100644 --- a/app/templates/500.html +++ b/app/templates/500.html @@ -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 %} diff --git a/app/templates/admin/base_site.html b/app/templates/admin/base_site.html index 84dfac5..f9e2fdd 100644 --- a/app/templates/admin/base_site.html +++ b/app/templates/admin/base_site.html @@ -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 %} diff --git a/app/templates/app/_nav_item.html b/app/templates/app/_nav_item.html index 5fc7f8e..fde3473 100644 --- a/app/templates/app/_nav_item.html +++ b/app/templates/app/_nav_item.html @@ -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> diff --git a/app/templates/app/_navbar_items.html b/app/templates/app/_navbar_items.html index 5cf6bcd..13e41d4 100644 --- a/app/templates/app/_navbar_items.html +++ b/app/templates/app/_navbar_items.html @@ -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 %} diff --git a/app/templates/app/_pagination.html b/app/templates/app/_pagination.html index 9579749..d9224e3 100644 --- a/app/templates/app/_pagination.html +++ b/app/templates/app/_pagination.html @@ -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. @@ -26,44 +26,60 @@ <h4 class="d-sm-none">{% trans "Pages" %}</h4> * text-center is mostly for the vertical case to center the text. * 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">« {% trans "Start" %}</a></li> - <li class="page-item"><a {{ lefter }} href="?{{ url_params }}&page={{ page_obj.previous_page_number }}">‹ {% trans "Previous" %}</a></li> - {% else %} - <li {{ disabled }}><span {{ lefter }}>« {% trans "First" %}</span></li> - <li {{ disabled }}><span {{ lefter }}>‹ {% 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">« {% trans "Start" %}</a> + </li> + <li class="page-item"> + <a {{ lefter }} href="?{{ url_params }}&page={{ page_obj.previous_page_number }}">‹ {% trans "Previous" %}</a> + </li> + {% else %} + <li {{ disabled }}><span {{ lefter }}>« {% trans "First" %}</span> + </li> + <li {{ disabled }}><span {{ lefter }}>‹ {% 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" %} ›</a></li> - <li class="page-item"><a {{ righter }} href="?{{ url_params }}&page={{ page_obj.paginator.num_pages }}">{% trans "Last" %} »</a></li> + <li class="page-item"> + <a {{ righter }} href="?{{ url_params }}&page={{ page_obj.next_page_number }}" preload>{% trans "Next" %} ›</a> + </li> + <li class="page-item"> + <a {{ righter }} href="?{{ url_params }}&page={{ page_obj.paginator.num_pages }}">{% trans "Last" %} »</a> + </li> {% else %} - <li {{ disabled }}><span {{ righter }}>{% trans "Next" %} ›</span></li> - <li {{ disabled }}><span {{ righter }}>{% trans "Last" %} »</span></li> - {% endif %} - </ul> - {% endwith %} - {% endwith %} + <li {{ disabled }}><span {{ righter }}>{% trans "Next" %} ›</span> + </li> +<li {{ disabled }}><span {{ righter }}>{% trans "Last" %} »</span> +</li> +{% endif %} +</ul> +{% endwith %} +{% endwith %} </nav> {% endif %} {% endspaceless %} diff --git a/app/templates/app/_search_filter.html b/app/templates/app/_search_filter.html index ddb229b..b003fd6 100644 --- a/app/templates/app/_search_filter.html +++ b/app/templates/app/_search_filter.html @@ -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 %} diff --git a/app/templates/app/_subj_lang_institution_filter.html b/app/templates/app/_subj_lang_institution_filter.html index 158ea7e..78a63a7 100644 --- a/app/templates/app/_subj_lang_institution_filter.html +++ b/app/templates/app/_subj_lang_institution_filter.html @@ -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 %} diff --git a/app/templates/app/contact.html b/app/templates/app/contact.html index 3cec35b..1654ba1 100644 --- a/app/templates/app/contact.html +++ b/app/templates/app/contact.html @@ -1,60 +1,73 @@ {% extends BASE_TEMPLATE %} {% load static %} {% load i18n %} - {% block content %} -{% spaceless %} -<div class="m-4"> - <div class="card p-3"> - <h1 id="main-heading" class="card-title">{% trans "Contact us" %}</h1> - <div class="row"> - <div class="col-md-4 contact-info"> - <h2 class="fs-4">{% trans "Contact details for more information" %}</h2> - <p> - {% blocktrans trimmed %} - Juan Steyn<br> - South African Centre for Digital Language Resources (SADiLaR)<br> - North-West University<br> - South Africa - {% endblocktrans %} - </p> - <p><a href="tel:+27182852750">+27 (0)18 285-2750</a></p> - <p><a href="mailto:info@sadilar.org">info@sadilar.org</a></p> - </div> - - <div class="col-md-4 contact-info"> - <h2 class="fs-4">{% trans "Physical address" %}</h2> - <address> - {% blocktrans trimmed %} - Buildings F16 C & F16 D<br> - North-West University<br> - Potchefstroom Campus<br> - Potchefstroom<br> - South Africa - {% endblocktrans %} - </address> - <p> - <a href="https://www.google.com/maps/place/26%C2%B041'13.8%22S+27%C2%B005'41.4%22E/@-26.687157,27.094845,17z/data=!3m1!4b1!4m4!3m3!8m2!3d-26.687157!4d27.094845?entry=ttu"> - {% trans "Directions" %} - </a> - </p> - </div> - - <div class="col-md-4 contact-info"> - <h2 class="fs-4">{% trans "Postal address" %}</h2> - <address> - {% blocktrans trimmed %} - SADiLaR<br> - Internal Box 340<br> - Private bag X6001<br> - Potchefstroom<br> - South Africa<br> - 2520 - {% endblocktrans %} - </address> + {% spaceless %} + <div class="m-4"> + <div class="card p-3"> + <h1 id="main-heading" class="card-title">{% trans "Contact us" %}</h1> + <div class="row"> + <div class="col-md-4 contact-info"> + <h2 class="fs-4">{% trans "Contact details for more information" %}</h2> + <p> + {% blocktrans trimmed %} + Juan Steyn + <br> + South African Centre for Digital Language Resources (SADiLaR) + <br> + North-West University + <br> + South Africa + {% endblocktrans %} + </p> + <p> + <a href="tel:+27182852750">+27 (0)18 285-2750</a> + </p> + <p> + <a href="mailto:info@sadilar.org">info@sadilar.org</a> + </p> + </div> + <div class="col-md-4 contact-info"> + <h2 class="fs-4">{% trans "Physical address" %}</h2> + <address> + {% blocktrans trimmed %} + Buildings F16 C & F16 D + <br> + North-West University + <br> + Potchefstroom Campus + <br> + Potchefstroom + <br> + South Africa + {% endblocktrans %} + </address> + <p> + <a href="https://www.google.com/maps/place/26%C2%B041'13.8%22S+27%C2%B005'41.4%22E/@-26.687157,27.094845,17z/data=!3m1!4b1!4m4!3m3!8m2!3d-26.687157!4d27.094845?entry=ttu"> + {% trans "Directions" %} + </a> + </p> + </div> + <div class="col-md-4 contact-info"> + <h2 class="fs-4">{% trans "Postal address" %}</h2> + <address> + {% blocktrans trimmed %} + SADiLaR + <br> + Internal Box 340 + <br> + Private bag X6001 + <br> + Potchefstroom + <br> + South Africa + <br> + 2520 + {% endblocktrans %} + </address> + </div> + </div> </div> </div> - </div> -</div> -{% endspaceless %} + {% endspaceless %} {% endblock content %} diff --git a/app/templates/app/document_detail.html b/app/templates/app/document_detail.html index 5a62493..0de675f 100644 --- a/app/templates/app/document_detail.html +++ b/app/templates/app/document_detail.html @@ -2,76 +2,62 @@ {% load static %} {% load i18n %} {% load bs_icons %} - {% block title %}{{ document.title }}{% endblock %} - {% block content %} -{% spaceless %} -<div class="text-break m-4"> - <p><a href="{% url 'documents' %}">{% trans "Documents" %}</a> > {{ document.title }}</p> - - <div> - <h1 id="main-heading">{{ document.title }}</h1> - {% if document.url %} - <div class="mb-2"> - <a href="{{ document.url }}" target="_blank" - title="{% trans 'External link' %}"> - {{ document.url }} - </a> + {% spaceless %} + <div class="text-break m-4"> + <p> + <a href="{% url 'documents' %}">{% trans "Documents" %}</a> > {{ document.title }} + </p> + <div> + <h1 id="main-heading">{{ document.title }}</h1> + {% if document.url %} + <div class="mb-2"> + <a href="{{ document.url }}" + target="_blank" + title="{% trans 'External link' %}">{{ document.url }}</a> + </div> + {% endif %} + {% if document.uploaded_file %} + <div class="mb-3"> + <a href="{{ document.uploaded_file.url }}" target="_blank" download> + <button class="btn btn-primary" type="submit">{% icon "download" %}{% trans "Download File" %}</button> + </a> + </div> + {% endif %} + <div class="limit-text-width">{{ document.description | linebreaks }}</div> + <p> + <a href="{% url 'institution_detail' document.institution.id %}">{{ document.institution.name }}</a> + </p> + <p> + <strong>{% trans "License:" %}</strong> {{ document.license }} + </p> + <p> + <strong>{% trans "Category:" %}</strong> {{ document.document_type }} + </p> + </div> + <div class="row"> + {% if document.subjects.all %} + <div class="col-md-6"> + <h2>{% trans "Subjects" %}</h2> + <ul class="list-unstyled"> + {% for subject in document.subjects.all %} + <li class="m-2">{% icon "subject" %}{{ subject.name }}</li> + {% endfor %} + </ul> + </div> + {% endif %} + {% if document.languages.all %} + <div class="col-md-6"> + <h2>{% trans "Languages" %}</h2> + <ul class="list-unstyled"> + {% for language in document.languages.all %} + <li class="m-2">{% icon "language" %}{{ language.name }}</li> + {% endfor %} + </ul> + </div> + {% endif %} + </div> </div> - {% endif %} - - {% if document.uploaded_file %} - <div class="mb-3"> - <a href="{{ document.uploaded_file.url }}" target="_blank" download> - <button class="btn btn-primary" type="submit"> - {% icon "download" %}{% trans "Download File" %} - </button> - </a> - </div> - {% endif %} - - <div class="limit-text-width"> - {{ document.description | linebreaks}} - </div> - - <p> - <a href="{% url 'institution_detail' document.institution.id %}"> - {{ document.institution.name }} - </a> - </p> - - <p><strong>{% trans "License:" %}</strong> {{ document.license }}</p> - <p><strong>{% trans "Category:" %}</strong> {{ document.document_type }}</p> - </div> - - - <div class="row"> - {% if document.subjects.all %} - <div class="col-md-6"> - <h2>{% trans "Subjects" %}</h2> - <ul class="list-unstyled"> - {% for subject in document.subjects.all %} - <li class="m-2">{% icon "subject" %}{{ subject.name }}</li> - {% endfor %} - </ul> - </div> - {% endif %} - - {% if document.languages.all %} - <div class="col-md-6"> - <h2>{% trans "Languages" %}</h2> - <ul class="list-unstyled"> - {% for language in document.languages.all %} - <li class="m-2">{% icon "language" %}{{ language.name }}</li> - {% endfor %} - </ul> - </div> - {% endif %} - - </div> - -</div> - -{% endspaceless %} + {% endspaceless %} {% endblock content %} diff --git a/app/templates/app/documents.html b/app/templates/app/documents.html index ecb1839..842972f 100644 --- a/app/templates/app/documents.html +++ b/app/templates/app/documents.html @@ -2,52 +2,43 @@ {% load static %} {% load i18n %} {% load bs_icons %} - -{% block title %}{% trans "Documents" %}{% endblock %} - +{% block title %} + {% trans "Documents" %} +{% endblock %} {% block content %} -{% spaceless %} -<div class="text-break m-4"> - <h1 id="main-heading">{% trans "Documents" %}</h1> - - {% include "app/_subj_lang_institution_filter.html" with view="documents"%} - - {% for item in documents %} - <div class="mt-4">{# additional indent simplifies comparison with projects.html #} - <h2> - <a href="{% url 'document_detail' item.document.id %}" class="text-decoration-none"> - {{ item.document.title }} - </a> - </h2> - {% if item.document.url %} - <div> - <a href="{{ item.document.url }}" target="_blank" - title="{% trans 'External link' %}"> - {{ item.document.url }} - </a> - </div> - {% endif %} - <div class="fs-5"> - {{ item.institution_name }} - </div> - <p class="limit-text-width"> - {{ item.description|truncatewords:30 }} - <a href="{% url 'document_detail' item.document.id %}">{% trans "Read more" %}</a> - </p> - - {% if item.languages %} - <div>{% icon "language" %} {{ item.languages }}</div> - {% endif %} - - {% if item.subjects %} - <div>{% icon "subject" %} {{ item.subjects }}</div> - {% endif %} + {% spaceless %} + <div class="text-break m-4"> + <h1 id="main-heading">{% trans "Documents" %}</h1> + {% include "app/_subj_lang_institution_filter.html" with view="documents" %} + {% for item in documents %} + <div class="mt-4"> + {# additional indent simplifies comparison with projects.html #} + <h2> + <a href="{% url 'document_detail' item.document.id %}" + class="text-decoration-none">{{ item.document.title }}</a> + </h2> + {% if item.document.url %} + <div> + <a href="{{ item.document.url }}" + target="_blank" + title="{% trans 'External link' %}">{{ item.document.url }}</a> + </div> + {% endif %} + <div class="fs-5">{{ item.institution_name }}</div> + <p class="limit-text-width"> + {{ item.description|truncatewords:30 }} + <a href="{% url 'document_detail' item.document.id %}">{% trans "Read more" %}</a> + </p> + {% if item.languages %} + <div>{% icon "language" %} {{ item.languages }}</div> + {% endif %} + {% if item.subjects %} + <div>{% icon "subject" %} {{ item.subjects }}</div> + {% endif %} + </div> + <hr> + {% endfor %} + {% include "app/_pagination.html" %} </div> - <hr> - {% endfor %} - - {% include "app/_pagination.html" %} - -</div> -{% endspaceless %} + {% endspaceless %} {% endblock content %} diff --git a/app/templates/app/home.html b/app/templates/app/home.html index 0698c3e..b53912a 100644 --- a/app/templates/app/home.html +++ b/app/templates/app/home.html @@ -1,85 +1,74 @@ {% extends BASE_TEMPLATE %} {% load static %} {% load i18n %} - {% block content %} -{% spaceless %} -<h1 id="main-heading" class="visually-hidden">{% trans "LwimiLinks" %}</h1> -<section class="m-3 card"> - <div class="card-body limit-text-width"> - <h2 class="fs-3 card-title">{% trans "Explore" %}</h2> - <p> - {% blocktrans trimmed %} - LwimiLinks is a place for multilingual terminology and other useful language - resources. We encourage institutions to upload their resources, and to register - information on related projects. - {% endblocktrans %} - </p> - <form method="get" action="{% url 'search' %}"> - <input type="search" name="search" placeholder="{% trans 'Search term...' %}" - class="form-control search-input"> - <input type="submit" value="{% trans 'Search' %}" class="btn btn-primary mt-2"> - </form> - <p class="pt-3"> - {% trans "Browse through the available information by one of the following categories:" %} - </p> - <ul class="list-unstyled d-md-flex flex-md-row"> - <li class="m-2"> - <a href="{% url 'institutions' %}" class="btn btn-secondary"> - {% trans "Institutions" %} - </a> - </li> - <li class="m-2"> - <a href="{% url 'projects' %}" class="btn btn-secondary"> - {% trans "Projects" %} - </a> - </li> - <li class="m-2"> - <a href="{% url 'documents' %}" class="btn btn-secondary"> - {% trans "Documents" %} - </a> - </li> - <li class="m-2"> - <a href="{% url 'languages' %}" class="btn btn-secondary"> - {% trans "Languages" %} - </a> - </li> - <li class="m-2"> - <a href="{% url 'subjects' %}" class="btn btn-secondary"> - {% trans "Subject fields" %} - </a> - </li> - </ul> - </div> -</section> - -<section class="m-3 card"> - <div class="card-body limit-text-width"> - <h2 class="fs-3 card-title">{% trans "Background information" %}</h2> - <p> - {% blocktrans trimmed %} - The South African Centre for Digital Language Resources (SADiLaR) is a national research - infrastructure that aims to ensure a digital future for our official languages. - It supports researchers in the fields of digital humanities and social sciences and also - assists institutions in their language implementation plans. - {% endblocktrans %} - <a href="https://sadilar.org">{% blocktrans %}Read more about SADiLaR.{% endblocktrans %}</a> - </p> - <p> - {% blocktrans trimmed %} - SADiLaR conducted an audit at South African public higher education institutions that highlighted - areas that require attention. - {% endblocktrans %} - <a href="https://sadilar.org/usaf_report_2023">{% blocktrans %}Read the report.{% endblocktrans %}</a> - </p> - <p> - {% blocktrans trimmed %} - This platform highlights previous and current work at institutions to encourage collaboration and - disseminate resources. - {% endblocktrans %} - </p> - </div> -</section> - -{% endspaceless %} + {% spaceless %} + <h1 id="main-heading" class="visually-hidden">{% trans "LwimiLinks" %}</h1> + <section class="m-3 card"> + <div class="card-body limit-text-width"> + <h2 class="fs-3 card-title">{% trans "Explore" %}</h2> + <p> + {% blocktrans trimmed %} + LwimiLinks is a place for multilingual terminology and other useful language + resources. We encourage institutions to upload their resources, and to register + information on related projects. + {% endblocktrans %} + </p> + <form method="get" action="{% url 'search' %}"> + <input type="search" + name="search" + placeholder="{% trans 'Search term...' %}" + class="form-control search-input"> + <input type="submit" + value="{% trans 'Search' %}" + class="btn btn-primary mt-2"> + </form> + <p class="pt-3">{% trans "Browse through the available information by one of the following categories:" %}</p> + <ul class="list-unstyled d-md-flex flex-md-row"> + <li class="m-2"> + <a href="{% url 'institutions' %}" class="btn btn-secondary">{% trans "Institutions" %}</a> + </li> + <li class="m-2"> + <a href="{% url 'projects' %}" class="btn btn-secondary">{% trans "Projects" %}</a> + </li> + <li class="m-2"> + <a href="{% url 'documents' %}" class="btn btn-secondary">{% trans "Documents" %}</a> + </li> + <li class="m-2"> + <a href="{% url 'languages' %}" class="btn btn-secondary">{% trans "Languages" %}</a> + </li> + <li class="m-2"> + <a href="{% url 'subjects' %}" class="btn btn-secondary">{% trans "Subject fields" %}</a> + </li> + </ul> + </div> + </section> + <section class="m-3 card"> + <div class="card-body limit-text-width"> + <h2 class="fs-3 card-title">{% trans "Background information" %}</h2> + <p> + {% blocktrans trimmed %} + The South African Centre for Digital Language Resources (SADiLaR) is a national research + infrastructure that aims to ensure a digital future for our official languages. + It supports researchers in the fields of digital humanities and social sciences and also + assists institutions in their language implementation plans. + {% endblocktrans %} + <a href="https://sadilar.org">{% blocktrans %}Read more about SADiLaR.{% endblocktrans %}</a> + </p> + <p> + {% blocktrans trimmed %} + SADiLaR conducted an audit at South African public higher education institutions that highlighted + areas that require attention. + {% endblocktrans %} + <a href="https://sadilar.org/usaf_report_2023">{% blocktrans %}Read the report.{% endblocktrans %}</a> + </p> + <p> + {% blocktrans trimmed %} + This platform highlights previous and current work at institutions to encourage collaboration and + disseminate resources. + {% endblocktrans %} + </p> + </div> + </section> + {% endspaceless %} {% endblock content %} diff --git a/app/templates/app/institution_detail.html b/app/templates/app/institution_detail.html index 75cea3d..fb20c7f 100644 --- a/app/templates/app/institution_detail.html +++ b/app/templates/app/institution_detail.html @@ -2,61 +2,61 @@ {% load static %} {% load i18n %} {% load bs_icons %} - {% block title %}{{ institution.name }}{% endblock %} - {% block content %} -{% spaceless %} -<div class="text-break m-4"> - <p><a href="{% url 'institutions' %}">{% trans "Institutions" %}</a> > {{ institution.name }}</p> - - <div class="mb-3 row"> - <div class="{% if institution.logo %}col-md-6{% else %}col-md-12{% endif %}"> - <h1 id="main-heading">{{ institution.name }} ({{ institution.abbreviation }})</h1> - {% if institution.url %} - <p><a href="{{ institution.url }}">{{ institution.url }}</a></p> - {% endif %} - {% if institution.email %} - <p><a href="mailto:{{ institution.email }}">{{ institution.email }}</a></p> - {% endif %} + {% spaceless %} + <div class="text-break m-4"> + <p> + <a href="{% url 'institutions' %}">{% trans "Institutions" %}</a> > {{ institution.name }} + </p> + <div class="mb-3 row"> + <div class="{% if institution.logo %}col-md-6{% else %}col-md-12{% endif %}"> + <h1 id="main-heading">{{ institution.name }} ({{ institution.abbreviation }})</h1> + {% if institution.url %} + <p> + <a href="{{ institution.url }}">{{ institution.url }}</a> + </p> + {% endif %} + {% if institution.email %} + <p> + <a href="mailto:{{ institution.email }}">{{ institution.email }}</a> + </p> + {% endif %} + </div> + {% if institution.logo %} + <div class="col-md-6"> + <img src="{{ institution.logo.url }}" alt="" class="logo100"> + </div> + {% endif %} + </div> + <div class="mb-3 row"> + {% if projects %} + <div class="col-md-6"> + <h2>{% trans "Projects" %}</h2> + <ul class="list-unstyled"> + {% for project in projects %} + <li class="m-2"> + {% icon "project" %} + <a href="{% url 'project_detail' project.id %}">{{ project.name }}</a> + </li> + {% endfor %} + </ul> + </div> + {% endif %} + {% if documents %} + <div class="col-md-6"> + <h2>{% trans "Documents" %}</h2> + <ul class="list-unstyled"> + {% for document in documents %} + <li class="m-2"> + {% icon "document" %} + <a href="{% url 'document_detail' document.id %}">{{ document.title }}</a> + </li> + {% endfor %} + </ul> + </div> + {% endif %} + </div> </div> - - {% if institution.logo %} - <div class="col-md-6"> - <img src="{{ institution.logo.url }}" alt="" class="logo100"> - </div> - {% endif %} - </div> - - <div class="mb-3 row"> - {% if projects %} - <div class="col-md-6"> - <h2>{% trans "Projects" %}</h2> - <ul class="list-unstyled"> - {% for project in projects %} - <li class="m-2"> - {% icon "project" %} - <a href="{% url 'project_detail' project.id %}">{{ project.name }}</a> - </li> - {% endfor %} - </ul> - </div> - {% endif %} - {% if documents %} - <div class="col-md-6"> - <h2>{% trans "Documents" %}</h2> - <ul class="list-unstyled"> - {% for document in documents %} - <li class="m-2"> - {% icon "document" %} - <a href="{% url 'document_detail' document.id %}">{{ document.title }}</a> - </li> - {% endfor %} - </ul> - </div> - {% endif %} - </div> -</div> - -{% endspaceless %} + {% endspaceless %} {% endblock content %} diff --git a/app/templates/app/institutions.html b/app/templates/app/institutions.html index 0c67a99..e4c4a1e 100644 --- a/app/templates/app/institutions.html +++ b/app/templates/app/institutions.html @@ -2,54 +2,56 @@ {% load static %} {% load i18n %} {% load bs_icons %} - -{% block title %}{% trans "Institutions" %}{% endblock %} - +{% block title %} + {% trans "Institutions" %} +{% endblock %} {% block content %} -{% spaceless %} -<h1 id="main-heading" class="visually-hidden">{% trans "Overview of institutions" %}</h1> -<div class="w-100 row row-cols-1 row-cols-lg-2 m-0 p-2">{# row has unwanted margin #} - {% for institution in institutions %} - <div class="all-cards col p-2"> - <div class="card"> - <div class="row row-cols-auto row-cols-md-2 p-3" style="min-height: 160px;"> - <div class="col"> - <h2 class="fs-5"> - <a href="{% url 'institution_detail' institution.id %}">{{ institution.name }}</a> - </h2> - <p>{{ institution.abbreviation }}</p> - {% if institution.project_count %} - <p> - {% icon "project" %} - {% blocktrans count project_count=institution.project_count trimmed %} - {{ project_count }} project - {% plural %} - {{ project_count }} projects - {% endblocktrans %} - </p> - {% endif %} - {% if institution.document_count %} - <p> - {% icon "document" %} - {% blocktrans count document_count=institution.document_count trimmed %} - {{ document_count }} document - {% plural %} - {{ document_count }} documents - {% endblocktrans %} - </p> - {% endif %} - </div> - {% if institution.logo %} - <div class="col"> - <img src="{{ institution.logo.url }}" class="logo100" style="max-height: 65px" - alt="" {# name already mentioned elsewhere #} - > - </div> - {% endif %} + {% spaceless %} + <h1 id="main-heading" class="visually-hidden">{% trans "Overview of institutions" %}</h1> + <div class="w-100 row row-cols-1 row-cols-lg-2 m-0 p-2"> + {# row has unwanted margin #} + {% for institution in institutions %} + <div class="all-cards col p-2"> + <div class="card"> + <div class="row row-cols-auto row-cols-md-2 p-3" + style="min-height: 160px"> + <div class="col"> + <h2 class="fs-5"> + <a href="{% url 'institution_detail' institution.id %}">{{ institution.name }}</a> + </h2> + <p>{{ institution.abbreviation }}</p> + {% if institution.project_count %} + <p> + {% icon "project" %} + {% blocktrans count project_count=institution.project_count trimmed %} + {{ project_count }} project + {% plural %} + {{ project_count }} projects + {% endblocktrans %} + </p> + {% endif %} + {% if institution.document_count %} + <p> + {% icon "document" %} + {% blocktrans count document_count=institution.document_count trimmed %} + {{ document_count }} document + {% plural %} + {{ document_count }} documents + {% endblocktrans %} + </p> + {% endif %} + </div> + {% if institution.logo %} + <div class="col"> + <img src="{{ institution.logo.url }}" class="logo100" style="max-height: 65px" + alt="" {# name already mentioned elsewhere #} + > + </div> + {% endif %} + </div> + </div> + </div> + {% endfor %} </div> - </div> - </div> - {% endfor %} -</div> -{% endspaceless %} -{% endblock content %} + {% endspaceless %} + {% endblock content %} diff --git a/app/templates/app/languages.html b/app/templates/app/languages.html index b417c69..8804a6a 100644 --- a/app/templates/app/languages.html +++ b/app/templates/app/languages.html @@ -2,63 +2,61 @@ {% load static %} {% load i18n %} {% load bs_icons %} - -{% block title %}{% trans "Languages" %}{% endblock %} - +{% block title %} + {% trans "Languages" %} +{% endblock %} {% block content %} -{% spaceless %} -<div class="text-break m-4 text-decoration-none"> - <h1 id="main-heading">{% trans "Information by language" %}</h1> - <div class="row"> - {% for item in language_data %} - <h2>{{ item.language.name }}</h2> - <div class="col-md-6"> - {% if item.documents.exists %} - <h3 class="fs-4">{% trans "Documents" %}</h3> - <div class="documents"> - <ul class="list-unstyled"> - {% for document in item.documents %} - <li class="mb-2"> - {% icon "document" %} - <a href="{% url 'document_detail' document.id %}">{{ document.title }}</a> - </li> - {% endfor %} - </ul> + {% spaceless %} + <div class="text-break m-4 text-decoration-none"> + <h1 id="main-heading">{% trans "Information by language" %}</h1> + <div class="row"> + {% for item in language_data %} + <h2>{{ item.language.name }}</h2> + <div class="col-md-6"> + {% if item.documents.exists %} + <h3 class="fs-4">{% trans "Documents" %}</h3> + <div class="documents"> + <ul class="list-unstyled"> + {% for document in item.documents %} + <li class="mb-2"> + {% icon "document" %} + <a href="{% url 'document_detail' document.id %}">{{ document.title }}</a> + </li> + {% endfor %} + </ul> + </div> + {% else %} + {# Only show this in two-column mode to ensure consistent layout and placement #} + <div aria-hidden="true" class="d-none d-md-block"> + <h3 class="fs-4">{% trans "Documents" %}</h3> + <p>{% trans "No documents available for this language." %}</p> + </div> + {% endif %} + </div> + <div class="col-md-6"> + {% if item.projects.exists %} + <h3 class="fs-4">{% trans "Projects" %}</h3> + <div class="projects"> + <ul class="list-unstyled"> + {% for project in item.projects %} + <li class="mb-2"> + {% icon "project" %} + <a href="{% url 'project_detail' project.id %}">{{ project.name }}</a> + </li> + {% endfor %} + </ul> + </div> + {% else %} + {# Only show this in two-column mode to ensure consistent layout and placement #} + <div aria-hidden="true" class="d-none d-md-block"> + <h3 class="fs-4">{% trans "Projects" %}</h3> + <p>{% trans "No projects available for this language." %}</p> + </div> + {% endif %} + </div> + <hr> + {% endfor %} </div> - {% else %} - {# Only show this in two-column mode to ensure consistent layout and placement #} - <div aria-hidden="true" class="d-none d-md-block"> - <h3 class="fs-4">{% trans "Documents" %}</h3> - <p>{% trans "No documents available for this language." %}</p> - </div> - {% endif %} </div> - <div class="col-md-6"> - {% if item.projects.exists %} - <h3 class="fs-4">{% trans "Projects" %}</h3> - <div class="projects"> - <ul class="list-unstyled"> - {% for project in item.projects %} - <li class="mb-2"> - {% icon "project" %} - <a href="{% url 'project_detail' project.id %}">{{ project.name }}</a> - </li> - {% endfor %} - </ul> - </div> - {% else %} - {# Only show this in two-column mode to ensure consistent layout and placement #} - <div aria-hidden="true" class="d-none d-md-block"> - <h3 class="fs-4">{% trans "Projects" %}</h3> - <p>{% trans "No projects available for this language." %}</p> - </div> - {% endif %} - </div> - <hr> - {% endfor %} - </div> - -</div> - -{% endspaceless %} + {% endspaceless %} {% endblock content %} diff --git a/app/templates/app/legal_notices.html b/app/templates/app/legal_notices.html index 05f520b..a5659cc 100644 --- a/app/templates/app/legal_notices.html +++ b/app/templates/app/legal_notices.html @@ -1,85 +1,86 @@ {% extends BASE_TEMPLATE %} {% load static %} {% load i18n %} - {% block content %} -{% spaceless %} -<div class="m-4"> - <div class="card p-3"><div class="limit-text-width"> - <h1 id="main-heading">{% trans "Legal Notices" %}</h1> - <h2 class="card-title">{% trans "Terms of use" %}</h2> - <p> - <a href="https://sadilar.org/en/terms-of-use/"> - {% trans "The terms of use statement for the SADiLaR website and services" %} - </a> - </p> - <h2 class="card-title">{% trans "Copyright" %}</h2> - <p> - {% blocktrans trimmed %} - Intellectual property rights concerning the materials shared via this website and the website - as such belong to the original creator or to SADiLaR. Where exceptions apply, the license - agreement governing a particular resource will be explicitly listed. - {% endblocktrans %} - {% blocktrans trimmed %} - Content included in the website is shared under the Creative Commons License Attribution - 2.0, unless indicated otherwise for specific materials. This license agreement does not allow - the inclusion of any elements contained in the website (such as images, logos, videos and - other resources) in a frame-set or an in-line link to another web page without giving due - credit to the origin of the material. - {% endblocktrans %} - </p> - <h3 class="card-title">{% trans "Disclaimer" %}</h3> - <p> - {% blocktrans trimmed %} - SADiLaR and its partners make a conscious effort to obtain copyright clearance for any - materials shared on or used in creation of the website before publication. Should you notice - any potential infringement on your own or anyone else’s intellectual property rights, we ask - that you inform us directly so that we may remove the material and/or clear any outstanding - copyright matters with the rightful owner immediately. - {% endblocktrans %} - </p> - <h2 class="card-title">{% trans "Privacy Policy and Privacy Statement" %}</h2> - <p> - {% blocktrans trimmed %} - Please find the privacy policy and privacy statement for the SADiLaR website and services here. - {% endblocktrans %} - </p> - <h3 class="card-title">{% trans "Protection of Personal Information" %}</h3> - <p> - {% blocktrans with url="https://www.nwu.ac.za/POPIA_Policy_NWU" trimmed %} - The purpose of the South African Protection of Personal Information Act 4 of 2013 (POPIA) - is to ensure responsible handling of an individual’s personal information and to hold all South - African institutions accountable should they not safeguard the collection, storing or sharing - of such information against possible abuse in any way. SADiLaR is strongly committed to - protecting personal information/data and strives to adhere to the - <a href="{{ url }}">guidelines</a> - as set out by the host institution for the Centre, the North-West University. - {% endblocktrans %} - </p> - <h3 class="card-title">{% trans "Use of cookies" %}</h3> - <p> - {% blocktrans with url="https://www.nwu.ac.za/POPIA_Policy_NWU" trimmed %} - Cookies are data saved on the device with which you access this website to customise your - experience or provide essential functions of the website such as enabling you to log in to - secure areas, e.g. the Repository. You can learn more about the different types of cookies - and how to disable non-essential cookies <a href="{{ url }}">here</a>. - {% endblocktrans %} - </p> - <p> - {% blocktrans trimmed %} - By using the SADiLaR website, you consent to our use of cookies and storage thereof on - your device. Should you not accept our use of cookies (or your browser is set to block all - cookies), your ability to access all functions on this website might be impaired. - {% endblocktrans %} - </p> - <h3 class="card-title">{% trans "User support" %}</h3> - <p> - {% blocktrans with address="info@sadilar.org" trimmed %} - Any questions concerning the website or services offered via the website can be addressed - to SADiLaR via email to <a href="mailto:{{ address }}">{{ address }}</a>. - {% endblocktrans %} - </p> - </div></div> -</div> -{% endspaceless %} + {% spaceless %} + <div class="m-4"> + <div class="card p-3"> + <div class="limit-text-width"> + <h1 id="main-heading">{% trans "Legal Notices" %}</h1> + <h2 class="card-title">{% trans "Terms of use" %}</h2> + <p> + <a href="https://sadilar.org/en/terms-of-use/"> + {% trans "The terms of use statement for the SADiLaR website and services" %} + </a> + </p> + <h2 class="card-title">{% trans "Copyright" %}</h2> + <p> + {% blocktrans trimmed %} + Intellectual property rights concerning the materials shared via this website and the website + as such belong to the original creator or to SADiLaR. Where exceptions apply, the license + agreement governing a particular resource will be explicitly listed. + {% endblocktrans %} + {% blocktrans trimmed %} + Content included in the website is shared under the Creative Commons License Attribution + 2.0, unless indicated otherwise for specific materials. This license agreement does not allow + the inclusion of any elements contained in the website (such as images, logos, videos and + other resources) in a frame-set or an in-line link to another web page without giving due + credit to the origin of the material. + {% endblocktrans %} + </p> + <h3 class="card-title">{% trans "Disclaimer" %}</h3> + <p> + {% blocktrans trimmed %} + SADiLaR and its partners make a conscious effort to obtain copyright clearance for any + materials shared on or used in creation of the website before publication. Should you notice + any potential infringement on your own or anyone else’s intellectual property rights, we ask + that you inform us directly so that we may remove the material and/or clear any outstanding + copyright matters with the rightful owner immediately. + {% endblocktrans %} + </p> + <h2 class="card-title">{% trans "Privacy Policy and Privacy Statement" %}</h2> + <p> + {% blocktrans trimmed %} + Please find the privacy policy and privacy statement for the SADiLaR website and services here. + {% endblocktrans %} + </p> + <h3 class="card-title">{% trans "Protection of Personal Information" %}</h3> + <p> + {% blocktrans with url="https://www.nwu.ac.za/POPIA_Policy_NWU" trimmed %} + The purpose of the South African Protection of Personal Information Act 4 of 2013 (POPIA) + is to ensure responsible handling of an individual’s personal information and to hold all South + African institutions accountable should they not safeguard the collection, storing or sharing + of such information against possible abuse in any way. SADiLaR is strongly committed to + protecting personal information/data and strives to adhere to the + <a href="{{ url }}">guidelines</a> + as set out by the host institution for the Centre, the North-West University. + {% endblocktrans %} + </p> + <h3 class="card-title">{% trans "Use of cookies" %}</h3> + <p> + {% blocktrans with url="https://www.nwu.ac.za/POPIA_Policy_NWU" trimmed %} + Cookies are data saved on the device with which you access this website to customise your + experience or provide essential functions of the website such as enabling you to log in to + secure areas, e.g. the Repository. You can learn more about the different types of cookies + and how to disable non-essential cookies <a href="{{ url }}">here</a>. + {% endblocktrans %} + </p> + <p> + {% blocktrans trimmed %} + By using the SADiLaR website, you consent to our use of cookies and storage thereof on + your device. Should you not accept our use of cookies (or your browser is set to block all + cookies), your ability to access all functions on this website might be impaired. + {% endblocktrans %} + </p> + <h3 class="card-title">{% trans "User support" %}</h3> + <p> + {% blocktrans with address="info@sadilar.org" trimmed %} + Any questions concerning the website or services offered via the website can be addressed + to SADiLaR via email to <a href="mailto:{{ address }}">{{ address }}</a>. + {% endblocktrans %} + </p> + </div> + </div> + </div> + {% endspaceless %} {% endblock content %} diff --git a/app/templates/app/project_detail.html b/app/templates/app/project_detail.html index e765662..19a8884 100644 --- a/app/templates/app/project_detail.html +++ b/app/templates/app/project_detail.html @@ -2,86 +2,69 @@ {% load static %} {% load i18n %} {% load bs_icons %} - {% block title %}{{ project.name }}{% endblock %} - {% block content %} -{% spaceless %} -<div class="text-break m-4"> - <p><a href="{% url 'projects' %}">{% trans "Projects" %}</a> > {{ project.name }}</p> - - <div class="mb-3 row"> - {# incorrect indent facilitates comparison with document_detail.html #} - <div class="{% if logo %}col-md-6{% else %}col-md-12{% endif %}"> - <h1 id="main-heading">{{ project.name }}</h1> - {% if project.url %} - <div class="mb-2"> - <a href="{{ project.url }}" target="_blank" - title="{% trans 'External link' %}"> - {{ project.url }} - </a> - </div> - {% endif %} - <div class="limit-text-width"> - {{ project.description | linebreaks }} - </div> - - <p> - <a href="{% url 'institution_detail' project.institution.id %}"> - {{ project.institution.name }} - </a> - </p> - - <div class="row"> - <p class="col-lg-6"> - {% icon "date" %} - {% trans "Start Date:" %} {{ project.start_date|date:"Y-m-d" }} - </p> - - <p class="col-lg-6"> - {% icon "date" %} - {% trans "End Date:" %} {{ project.end_date|date:"Y-m-d" }} - </p> - </div> - - </div> - - <div class="col-md-6"> - {% if logo %} - <img src="{{ logo.url }}" class="logo100" - alt="" {# name already mentioned elsewhere #} - > - {% endif %} - </div> - - </div> - - <div class="row"> - {% if subjects %} - <div class="col-md-6"> - <h2>{% trans "Subjects" %}</h2> - <ul class="list-unstyled"> - {% for subject in subjects %} - <li class="m-2">{% icon "subject" %}{{ subject.name }}</li> - {% endfor %} - </ul> - </div> - {% endif %} - - {% if languages %} - <div class="col-md-6"> - <h2>{% trans "Languages" %}</h2> - <ul class="list-unstyled"> - {% for language in languages %} - <li class="m-2">{% icon "language" %}{{ language.name }}</li> - {% endfor %} - </ul> - </div> - {% endif %} - - </div> - -</div> - -{% endspaceless %} -{% endblock content %} + {% spaceless %} + <div class="text-break m-4"> + <p> + <a href="{% url 'projects' %}">{% trans "Projects" %}</a> > {{ project.name }} + </p> + <div class="mb-3 row"> + {# incorrect indent facilitates comparison with document_detail.html #} + <div class="{% if logo %}col-md-6{% else %}col-md-12{% endif %}"> + <h1 id="main-heading">{{ project.name }}</h1> + {% if project.url %} + <div class="mb-2"> + <a href="{{ project.url }}" + target="_blank" + title="{% trans 'External link' %}">{{ project.url }}</a> + </div> + {% endif %} + <div class="limit-text-width">{{ project.description | linebreaks }}</div> + <p> + <a href="{% url 'institution_detail' project.institution.id %}">{{ project.institution.name }}</a> + </p> + <div class="row"> + <p class="col-lg-6"> + {% icon "date" %} + {% trans "Start Date:" %} {{ project.start_date|date:"Y-m-d" }} + </p> + <p class="col-lg-6"> + {% icon "date" %} + {% trans "End Date:" %} {{ project.end_date|date:"Y-m-d" }} + </p> + </div> + </div> + <div class="col-md-6"> + {% if logo %} + <img src="{{ logo.url }}" class="logo100" + alt="" {# name already mentioned elsewhere #} + > + {% endif %} + </div> + </div> + <div class="row"> + {% if subjects %} + <div class="col-md-6"> + <h2>{% trans "Subjects" %}</h2> + <ul class="list-unstyled"> + {% for subject in subjects %} + <li class="m-2">{% icon "subject" %}{{ subject.name }}</li> + {% endfor %} + </ul> + </div> + {% endif %} + {% if languages %} + <div class="col-md-6"> + <h2>{% trans "Languages" %}</h2> + <ul class="list-unstyled"> + {% for language in languages %} + <li class="m-2">{% icon "language" %}{{ language.name }}</li> + {% endfor %} + </ul> + </div> + {% endif %} + </div> + </div> + {% endspaceless %} + {% endblock content %} diff --git a/app/templates/app/projects.html b/app/templates/app/projects.html index 64a21c6..1e1e24f 100644 --- a/app/templates/app/projects.html +++ b/app/templates/app/projects.html @@ -2,71 +2,58 @@ {% load static %} {% load i18n %} {% load bs_icons %} - -{% block title %}{% trans "Projects" %}{% endblock %} - +{% block title %} + {% trans "Projects" %} +{% endblock %} {% block content %} -{% spaceless %} -<div class="text-break m-4"> - <h1 id="main-heading">{% trans "Projects" %}</h1> - - {% include "app/_subj_lang_institution_filter.html" with view="projects" %} - - {% for item in projects %} - <div class="container-fluid mt-4 mb-5 p-0">{# container adds unwanted padding #} - - <div class="row" style="max-width: 1024px;"> - <div class="col-md-8">{# "wrong" indent simplifies comparison with documents.html #} - <h2> - <a href="{% url 'project_detail' item.project.id %}" class="text-decoration-none"> - {{ item.project.name }} - </a> - </h2> - {% if item.project.url %} - <div> - <a href="{{ item.project.url }}" target="_blank" - title="{% trans 'External link' %}"> - {{ item.project.url }} - </a> + {% spaceless %} + <div class="text-break m-4"> + <h1 id="main-heading">{% trans "Projects" %}</h1> + {% include "app/_subj_lang_institution_filter.html" with view="projects" %} + {% for item in projects %} + <div class="container-fluid mt-4 mb-5 p-0"> + {# container adds unwanted padding #} + <div class="row" style="max-width: 1024px;"> + <div class="col-md-8"> + {# "wrong" indent simplifies comparison with documents.html #} + <h2> + <a href="{% url 'project_detail' item.project.id %}" + class="text-decoration-none">{{ item.project.name }}</a> + </h2> + {% if item.project.url %} + <div> + <a href="{{ item.project.url }}" + target="_blank" + title="{% trans 'External link' %}">{{ item.project.url }}</a> + </div> + {% endif %} + <div class="fs-5">{{ item.institution_name }}</div> + </div> + <div class="col-md-4"> + {% if item.logo %} + <img src="{{ item.logo.url }}" class="logo100" + alt=""{# name already mentioned elsewhere #} + > + {% endif %} + </div> + </div> + <div> + <p class="limit-text-width"> + {{ item.description|truncatewords:30 }} + <a href="{% url 'project_detail' item.project.id %}">{% trans "Read more" %}</a> + </p> + {% if item.languages %} + <div>{% icon "language" %} {{ item.languages }}</div> + {% endif %} + {% if item.subjects %} + <div>{% icon "subject" %} {{ item.subjects }}</div> + {% endif %} + {% if item.date %} + <div>{% icon "date" %} {{ item.date }}</div> + {% endif %} + </div> + </div> + {% endfor %} </div> - {% endif %} - <div class="fs-5"> - {{ item.institution_name }} - </div> - - </div> - <div class="col-md-4"> - {% if item.logo %} - <img src="{{ item.logo.url }}" class="logo100" - alt=""{# name already mentioned elsewhere #} - > - {% endif %} - </div> - </div> - - <div> - <p class="limit-text-width"> - {{ item.description|truncatewords:30 }} - <a href="{% url 'project_detail' item.project.id %}">{% trans "Read more" %}</a> - </p> - - {% if item.languages %} - <div>{% icon "language" %} {{ item.languages }}</div> - {% endif %} - - {% if item.subjects %} - <div>{% icon "subject" %} {{ item.subjects }}</div> - {% endif %} - - {% if item.date %} - <div>{% icon "date" %} {{ item.date }}</div> - {% endif %} - - </div> - - </div> - {% endfor %} - -</div> -{% endspaceless %} -{% endblock content %} + {% endspaceless %} + {% endblock content %} diff --git a/app/templates/app/search.html b/app/templates/app/search.html index c3ba9eb..4ca0c78 100644 --- a/app/templates/app/search.html +++ b/app/templates/app/search.html @@ -10,113 +10,116 @@ {% endcomment %} {% load static %} {% load i18n %} - -{% block title %}{{ request.GET.search }} - {% trans "Search" %}{% endblock %} - +{% block title %} + {{ request.GET.search }} - {% trans "Search" %} +{% endblock %} {% block content %} -{% spaceless %} -<div class="text-break card m-3 p-2"> - <h1 id="main-heading" class="visually-hidden">{% trans "Search and filter for information" %}</h1> - <form action="{% url 'search' %}" class="card-body row" hx-target="#search-main" hx-select="#search-main"> - <div id="search-main" class="col-md-8"> - - {# Search #} - <section aria-label="{% trans 'Search form' %}" class="limit-text-width mb-3" - hx-target="#search-main" hx-select="#search-main" - > - <div id="search" class="col-auto">{# Target for link at bottom #} - <h2 class="fs-5 card-title mt-2">{% trans "Search a term" %}</h2> - </div> - <div class="col mb-2"> - <input type="search" name="{{ filter.form.search.name }}" - placeholder="{% trans 'Search...' %}" - class="form-control" - value="{{ request.GET.search }}"> - </div> - <div class="col-auto"> - <input type="submit" class="btn btn-primary me-4"> - <a href="{% url 'search' %}" hx-target="#main" hx-select="#main" class="btn btn-secondary">{% trans 'Reset' %}</a> - </div> - {% if page_obj.paginator.num_pages > 1 %} - <div class="mt-2"> - <a href="#filters" class="d-md-none">{% trans "Filter results below" %}</a> - </div> - {% endif %} - </section> -{% endspaceless %} - - {# Results #} - <section aria-label="{% trans 'Search results' %}" hx-target="#main" hx-select="#main" - {% if request.htmx.target == 'search-main' %}tabindex="-1" autofocus{% endif %} - > - {% for result in page_obj %} -{% spaceless %} - <div class="row"> - <div class="col limit-text-width"> - <h3> - <a class="text-decoration-none" href="{% url result.view result.id %}"> - {{ result.heading }} - </a> - </h3> - - {% if result.associated_url %} - <a href="{{ result.associated_url }}" target="_blank" - title="{% trans 'External link' %}"> - {{ result.associated_url }} - </a> + {% spaceless %} + <div class="text-break card m-3 p-2"> + <h1 id="main-heading" class="visually-hidden">{% trans "Search and filter for information" %}</h1> + <form action="{% url 'search' %}" + class="card-body row" + hx-target="#search-main" + hx-select="#search-main"> + <div id="search-main" class="col-md-8"> + {# Search #} + <section aria-label="{% trans 'Search form' %}" + class="limit-text-width mb-3" + hx-target="#search-main" + hx-select="#search-main"> + <div id="search" class="col-auto"> + {# Target for link at bottom #} + <h2 class="fs-5 card-title mt-2">{% trans "Search a term" %}</h2> + </div> + <div class="col mb-2"> + <input type="search" + name="{{ filter.form.search.name }}" + placeholder="{% trans 'Search...' %}" + class="form-control" + value="{{ request.GET.search }}"> + </div> + <div class="col-auto"> + <input type="submit" class="btn btn-primary me-4"> + <a href="{% url 'search' %}" + hx-target="#main" + hx-select="#main" + class="btn btn-secondary">{% trans 'Reset' %}</a> + </div> + {% if page_obj.paginator.num_pages > 1 %} + <div class="mt-2"> + <a href="#filters" class="d-md-none">{% trans "Filter results below" %}</a> + </div> {% endif %} - - {% if result.extra %} - <p>{{ result.extra|truncatewords:20 }}</p> - {% endif %} -{% endspaceless %} - {% if result.search_headline.strip %} - <blockquote aria-label="{% trans 'Excerpt' %}" class="text-secondary mx-lg-5"> - <p>… {{ result.search_headline|safe }} …</p> - </blockquote> - {% endif %} - {% comment "Left for debugging of search ranking" %} + </section> + {% endspaceless %} + {# Results #} + <section aria-label="{% trans 'Search results' %}" + hx-target="#main" + hx-select="#main" + {% if request.htmx.target == 'search-main' %}tabindex="-1" autofocus{% endif %}> + {% for result in page_obj %} + {% spaceless %} + <div class="row"> + <div class="col limit-text-width"> + <h3> + <a class="text-decoration-none" href="{% url result.view result.id %}">{{ result.heading }}</a> + </h3> + {% if result.associated_url %} + <a href="{{ result.associated_url }}" + target="_blank" + title="{% trans 'External link' %}">{{ result.associated_url }}</a> + {% endif %} + {% if result.extra %}<p>{{ result.extra|truncatewords:20 }}</p>{% endif %} + {% endspaceless %} + {% if result.search_headline.strip %} + <blockquote aria-label="{% trans 'Excerpt' %}" class="text-secondary mx-lg-5"> + <p>… {{ result.search_headline|safe }} …</p> + </blockquote> + {% endif %} + {% comment "Left for debugging of search ranking" %} <p>{{ result.rank }}</p> - {% endcomment %} - </div> - {% if result.logo_url %} - <div class="d-none d-sm-block col-auto mb-4"> - <img src="/media/{{ result.logo_url }}" alt="" {# Name already mentioned elsewhere #} - class="logo100"> - </div> - {% endif %} - </div> - {% empty %} - <p>{% trans "No results." %}</p> - {% endfor %} - </section> - - {# Pagination #} - {% include "app/_pagination.html" %} - - </div> - - {# Filters #} -{% spaceless %} - {% if request.htmx.target != "search-main" %} - <section id="filters" aria-labelledby="filter-heading" class="col-md-4 ps-md-4">{# target for link at the top #} - <h2 id="filter-heading" class="fs-5 card-title">{% trans "Filters" %}</h2> - <div class="row mb-2"> - {% with form=filter.form %} - {% include "app/_search_filter.html" with field=form.institution summary=_("Filter by institution") %} - {% include "app/_search_filter.html" with field=form.subjects summary=_("Filter by subject") %} - {% include "app/_search_filter.html" with field=form.languages summary=_("Filter by language") %} - {% endwith %} - <div class="mt-2"> - <a href="#search" class="d-md-none">{% trans "Alter search terms above" %}</a> + {% endcomment %} + </div> + {% if result.logo_url %} + <div class="d-none d-sm-block col-auto mb-4"> + <img src="/media/{{ result.logo_url }}" alt="" {# Name already mentioned elsewhere #} + class="logo100"> + </div> + {% endif %} + </div> + {% empty %} + <p>{% trans "No results." %}</p> + {% endfor %} + </section> + {# Pagination #} + {% include "app/_pagination.html" %} </div> + {# Filters #} + {% spaceless %} + {% if request.htmx.target != "search-main" %} + <section id="filters" + aria-labelledby="filter-heading" + class="col-md-4 ps-md-4"> + {# target for link at the top #} + <h2 id="filter-heading" class="fs-5 card-title">{% trans "Filters" %}</h2> + <div class="row mb-2"> + {% with form=filter.form %} + {% include "app/_search_filter.html" with field=form.institution summary=_("Filter by institution") %} + {% include "app/_search_filter.html" with field=form.subjects summary=_("Filter by subject") %} + {% include "app/_search_filter.html" with field=form.languages summary=_("Filter by language") %} + {% endwith %} + <div class="mt-2"> + <a href="#search" class="d-md-none">{% trans "Alter search terms above" %}</a> + </div> + </div> + <input type="submit" class="btn btn-primary me-4"> + <a href="{% url 'search' %}" + hx-target="#main" + hx-select="#main" + class="btn btn-secondary">{% trans 'Reset' %}</a> + </section> + {% endif %} + </form> </div> - <input type="submit" class="btn btn-primary me-4"> - <a href="{% url 'search' %}" hx-target="#main" hx-select="#main" class="btn btn-secondary">{% trans 'Reset' %}</a> - </section> - {% endif %} - - </form> -</div> -{% endspaceless %} -{% endblock content %} + {% endspaceless %} + {% endblock content %} diff --git a/app/templates/app/subjects.html b/app/templates/app/subjects.html index d143eb6..a9d3496 100644 --- a/app/templates/app/subjects.html +++ b/app/templates/app/subjects.html @@ -2,64 +2,62 @@ {% load static %} {% load i18n %} {% load bs_icons %} - -{% block title %}{% trans "Subjects" %}{% endblock %} - +{% block title %} + {% trans "Subjects" %} +{% endblock %} {% block content %} -{% spaceless %} -<div class="text-break m-4 text-decoration-none"> - <h1 id="main-heading">{% trans "Information by subject" %}</h1> - <div class="row"> - {% for item in subject_data %} - <h2>{{ item.subject.name }}</h2> - <div class="col-md-6"> - {% if item.documents.exists %} - <h3 class="fs-4">{% trans "Documents" %}</h3> - <div class="documents"> - <ul class="list-unstyled"> - {% for document in item.documents %} - <li class="mb-2"> - {% icon "document" %} - <a href="{% url 'document_detail' document.id %}">{{ document.title }}</a> - </li> - {% endfor %} - </ul> + {% spaceless %} + <div class="text-break m-4 text-decoration-none"> + <h1 id="main-heading">{% trans "Information by subject" %}</h1> + <div class="row"> + {% for item in subject_data %} + <h2>{{ item.subject.name }}</h2> + <div class="col-md-6"> + {% if item.documents.exists %} + <h3 class="fs-4">{% trans "Documents" %}</h3> + <div class="documents"> + <ul class="list-unstyled"> + {% for document in item.documents %} + <li class="mb-2"> + {% icon "document" %} + <a href="{% url 'document_detail' document.id %}">{{ document.title }}</a> + </li> + {% endfor %} + </ul> + </div> + {% else %} + {# Only show this in two-column mode to ensure consistent layout and placement #} + <div aria-hidden="true" class="d-none d-md-block"> + <h3 class="fs-4">{% trans "Documents" %}</h3> + <p>{% trans "No documents available for this subject." %}</p> + </div> + {% endif %} + </div> + <div class="col-md-6"> + {% if item.projects.exists %} + <h3 class="fs-4">{% trans "Projects" %}</h3> + <div class="projects"> + <ul class="list-unstyled"> + {% for project in item.projects %} + <li class="mb-2"> + {% icon "project" %} + <a href="{% url 'project_detail' project.id %}">{{ project.name }}</a> + </li> + {% endfor %} + </ul> + </div> + {% else %} + {# Only show this in two-column mode to ensure consistent layout and placement #} + <div aria-hidden="true" class="d-none d-md-block"> + <h3 class="fs-4">{% trans "Projects" %}</h3> + <p>{% trans "No projects available for this subject." %}</p> + </div> + {% endif %} + </div> + <hr> + {% endfor %} </div> - {% else %} - {# Only show this in two-column mode to ensure consistent layout and placement #} - <div aria-hidden="true" class="d-none d-md-block"> - <h3 class="fs-4">{% trans "Documents" %}</h3> - <p>{% trans "No documents available for this subject." %}</p> - </div> - {% endif %} + {% include "app/_pagination.html" %} </div> - <div class="col-md-6"> - {% if item.projects.exists %} - <h3 class="fs-4">{% trans "Projects" %}</h3> - <div class="projects"> - <ul class="list-unstyled"> - {% for project in item.projects %} - <li class="mb-2"> - {% icon "project" %} - <a href="{% url 'project_detail' project.id %}">{{ project.name }}</a> - </li> - {% endfor %} - </ul> - </div> - {% else %} - {# Only show this in two-column mode to ensure consistent layout and placement #} - <div aria-hidden="true" class="d-none d-md-block"> - <h3 class="fs-4">{% trans "Projects" %}</h3> - <p>{% trans "No projects available for this subject." %}</p> - </div> - {% endif %} - </div> - <hr> - {% endfor %} - </div> - - {% include "app/_pagination.html" %} - -</div> -{% endspaceless %} + {% endspaceless %} {% endblock content %} diff --git a/app/templates/base.html b/app/templates/base.html index c736d04..996e6d5 100644 --- a/app/templates/base.html +++ b/app/templates/base.html @@ -2,135 +2,159 @@ {% load i18n %} {% load bs_icons %} {% spaceless %} -<!DOCTYPE html> -<html lang="en"> -<head> - <title>{% block title %}{% trans "LwimiLinks" %}{% endblock %}</title> - <meta name="description" content="{% block description %}{% trans 'Terminology and other language resources' %}{% endblock %}"> - <meta name="keywords" content="{% block keywords %}{% trans 'language, terminology' %}{% endblock %}"> - <meta name="viewport" content="width=device-width, initial-scale=1"> - <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous"> - <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css" integrity="sha256-9kPW/n5nn53j4WMRYAxe9c1rCY96Oogo/MKSVdKzPmI=" crossorigin="anonymous"> - <link rel="icon" href="{% static 'img/favicon.png' %}" sizes="32x32"> - {# htmx JS at the end of body seems to create problems when navigating through browser history #} - <script src="https://cdn.jsdelivr.net/npm/htmx.org@2.0.2/dist/htmx.min.js" integrity="sha256-4XRtl1nsDUPFwoRFIzOjELtf1yheusSy3Jv0TXK1qIc=" crossorigin="anonymous"></script> - <meta name="htmx-config" content='{% include "app/htmx-config.json" %}'> - <style>{% include "app/css/local.css" %}</style> -</head> - -<body hx-boost="true" hx-target="#main" hx-select="#main" hx-swap="outerHTML show:window:top" hx-push-url="true" hx-indicator="#loader"> -<header> -{% block header %} - <div id="loader" class="htmx-indicator" role="status" ><span id="loader-text" class="visually-hidden"></span></div> - <nav class="navbar navbar-expand-lg navbar-light"> - <div class="container-fluid"> - <a href="{% url 'home' %}" class="navbar-brand"> - <img src="{% static 'img/lwimilinks.svg' %}" width="180" height="40" alt="{% trans 'Front page' %}"> - </a> - <button class="navbar-toggler" type="button" - data-bs-toggle="collapse" data-bs-target="#navbarPills" - aria-controls="navbarPills" aria-expanded="false" aria-label="{% trans 'Toggle navigation' %}"> - <span class="navbar-toggler-icon"></span> - </button> - {% include "app/_navbar_items.html" %} - </div> - </nav> -{% endblock header %} -</header> - -{% block error %} -{# Render the error block hidden, so that it can be updated on the front-end. #} -<section id="error-block" role="alert" aria-labelledby="error-title" - class="m-3 card text-center body-card" hx-swap-oob="true" - {% if not show_error %}hidden{% endif %} -> - <div class="card-body"> - <h1 id="error-title" class="card-title">{% block error_title %}Error{% endblock %}</h1> - <p id="error-message" class="card-text">{% block error_message %}An error occurred{% endblock %}</p> - </div> -</section> -{% endblock error %} - -{% endspaceless %} - -<main id="main" aria-labelledby="main-heading"> -{% block content %} - {% comment %} + <!DOCTYPE html> + <html lang="en"> + <head> + <title> + {% block title %} + {% trans "LwimiLinks" %} + {% endblock %} + </title> + <meta name="description" + content="{% block description %}{% trans 'Terminology and other language resources' %}{% endblock %}"> + <meta name="keywords" + content="{% block keywords %}{% trans 'language, terminology' %}{% endblock %}"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" + rel="stylesheet" + integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" + crossorigin="anonymous"> + <link rel="stylesheet" + href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css" + integrity="sha256-9kPW/n5nn53j4WMRYAxe9c1rCY96Oogo/MKSVdKzPmI=" + crossorigin="anonymous"> + <link rel="icon" href="{% static 'img/favicon.png' %}" sizes="32x32"> + {# htmx JS at the end of body seems to create problems when navigating through browser history #} + <script src="https://cdn.jsdelivr.net/npm/htmx.org@2.0.2/dist/htmx.min.js" + integrity="sha256-4XRtl1nsDUPFwoRFIzOjELtf1yheusSy3Jv0TXK1qIc=" + crossorigin="anonymous"></script> + <meta name="htmx-config" content='{% include "app/htmx-config.json" %}'> + <style>{% include "app/css/local.css" %}</style> + </head> + <body hx-boost="true" + hx-target="#main" + hx-select="#main" + hx-swap="outerHTML show:window:top" + hx-push-url="true" + hx-indicator="#loader"> + <header> + {% block header %} + <div id="loader" class="htmx-indicator" role="status"> + <span id="loader-text" class="visually-hidden"></span> + </div> + <nav class="navbar navbar-expand-lg navbar-light"> + <div class="container-fluid"> + <a href="{% url 'home' %}" class="navbar-brand"> + <img src="{% static 'img/lwimilinks.svg' %}" + width="180" + height="40" + alt="{% trans 'Front page' %}"> + </a> + <button class="navbar-toggler" + type="button" + data-bs-toggle="collapse" + data-bs-target="#navbarPills" + aria-controls="navbarPills" + aria-expanded="false" + aria-label="{% trans 'Toggle navigation' %}"> + <span class="navbar-toggler-icon"></span> + </button> + {% include "app/_navbar_items.html" %} + </div> + </nav> + {% endblock header %} + </header> + {% block error %} + {# Render the error block hidden, so that it can be updated on the front-end. #} + <section id="error-block" + role="alert" + aria-labelledby="error-title" + class="m-3 card text-center body-card" + hx-swap-oob="true" + {% if not show_error %}hidden{% endif %}> + <div class="card-body"> + <h1 id="error-title" class="card-title"> + {% block error_title %}Error{% endblock %} + </h1> + <p id="error-message" class="card-text"> + {% block error_message %}An error occurred{% endblock %} + </p> + </div> + </section> + {% endblock error %} + {% endspaceless %} + <main id="main" aria-labelledby="main-heading"> + {% block content %} + {% comment %} The content block should probably be overridden by all pages. The `aria-labelledby` means this base template expects some element with id="main-heading" in the child template, otherwise this is invalid HTML. - {% endcomment %} -{% endblock content %} -</main> - -{% spaceless %} -<footer class="footer container-fluid text-bg-primary py-3 link-light" - style="--bs-link-color-rgb: 255, 255, 255; --bs-link-color:#fff; --bs-btn-color:#fff;"> - <div class="row text-center"> - - <div class="col col-sm-8 col-md-6 offset-md-3"> - <p> - <a href="https://sadilar.org" title="{% trans 'External link'%}"> - {% trans "Developed by SADiLaR" %} - </a> - </p> - <div class="d-md-flex justify-content-center"> - <div class="px-2"> - <a href="{% url 'legal_notices' %}" class="btn btn-link p-0">{% trans "Legal Notices" %}</a> - </div> - <div class="px-2"> - <a href="{% url 'contact' %}" class="btn btn-link p-0">{% trans "Contact Us" %}</a> - </div> - {% if user.is_authenticated %} - <div class="px-2" hx-disable> - <a href="{% url 'admin:index' %}" class="btn btn-link p-0">{% trans "Admin" %}</a> + {% endcomment %} + {% endblock content %} + </main> + {% spaceless %} + <footer class="footer container-fluid text-bg-primary py-3 link-light" + style="--bs-link-color-rgb: 255, 255, 255; + --bs-link-color:#fff; + --bs-btn-color:#fff"> + <div class="row text-center"> + <div class="col col-sm-8 col-md-6 offset-md-3"> + <p> + <a href="https://sadilar.org" title="{% trans 'External link' %}">{% trans "Developed by SADiLaR" %}</a> + </p> + <div class="d-md-flex justify-content-center"> + <div class="px-2"> + <a href="{% url 'legal_notices' %}" class="btn btn-link p-0">{% trans "Legal Notices" %}</a> + </div> + <div class="px-2"> + <a href="{% url 'contact' %}" class="btn btn-link p-0">{% trans "Contact Us" %}</a> + </div> + {% if user.is_authenticated %} + <div class="px-2" hx-disable> + <a href="{% url 'admin:index' %}" class="btn btn-link p-0">{% trans "Admin" %}</a> + </div> + <div class="px-2" hx-disable> + <form id="logout-form" method="post" action="{% url 'logout' %}"> + {% csrf_token %} + <button type="submit" class="btn btn-link p-0">{% trans "Logout" %}</button> + </form> + </div> + {% else %} + <div class="px-2" hx-disable> + <a href="{% url 'login' %}" class="btn btn-link p-0">{% trans "Login" %}</a> + </div> + {% endif %} + </div> </div> - <div class="px-2" hx-disable> - <form id="logout-form" method="post" action="{% url 'logout' %}"> + <div class="col col-sm-4 col-md-3 pt-2"> + <form action="{% url 'set_language' %}" method="post"> {% csrf_token %} - <button type="submit" class="btn btn-link p-0">{% trans "Logout" %}</button> + <label for="ui-language">{% trans "Language:" %}</label> + <select class=form-select-sm name="language" id="ui-language"> + {% get_current_language as LANGUAGE_CODE %} + {% get_available_languages as LANGUAGES %} + {% for lang in LANGUAGES %} + <option value="{{ lang.0 }}" + {% if lang.0 == LANGUAGE_CODE %}selected{% endif %}>{{ lang.1 }}</option> + {% endfor %} + </select> + <input class="btn btn-light btn-sm m-2" + type="submit" + value="{% trans 'Change language' %}"> </form> </div> - {% else %} - <div class="px-2" hx-disable> - <a href="{% url 'login' %}" class="btn btn-link p-0">{% trans "Login" %}</a> - </div> - {% endif %} - </div> - </div> - - <div class="col col-sm-4 col-md-3 pt-2"> - <form action="{% url 'set_language' %}" method="post"> - {% csrf_token %} - <label for="ui-language">{% trans "Language:" %}</label> - <select class=form-select-sm name="language" id="ui-language"> - {% get_current_language as LANGUAGE_CODE %} - {% get_available_languages as LANGUAGES %} - {% for lang in LANGUAGES %} - <option value="{{ lang.0 }}"{% if lang.0 == LANGUAGE_CODE %} selected{% endif %}> - {{ lang.1 }} - </option> - {% endfor %} - </select> - <input class="btn btn-light btn-sm m-2" type="submit" value="{% trans 'Change language' %}"> - </form> - </div> - - </div> -</footer> -{% endspaceless %} - -<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.min.js" integrity="sha384-0pUGZvbkm6XF6gxjEnlmuGrJXVbNuzT9qBBavbLwCsOGabYfZo0T0to5eqruptLy" crossorigin="anonymous"></script> -<script> -{% include "app/js/page-status.js" %} -</script> -{% if debug %} - {% load django_htmx %} - {% django_htmx_script %} -{% endif %} -{% if debug_toolbar %} -<script> - {% include "app/js/debug-toolbar-handler.js" %} -</script> -{% endif %} -</body> + </div> + </footer> + {% endspaceless %} + <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.min.js" + integrity="sha384-0pUGZvbkm6XF6gxjEnlmuGrJXVbNuzT9qBBavbLwCsOGabYfZo0T0to5eqruptLy" + crossorigin="anonymous"></script> + <script>{% include "app/js/page-status.js" %}</script> + {% if debug %} + {% load django_htmx %} + {% django_htmx_script %} + {% endif %} + {% if debug_toolbar %} + <script>{% include "app/js/debug-toolbar-handler.js" %}</script> + {% endif %} + </body> diff --git a/app/templates/base_error.html b/app/templates/base_error.html index 1a18e52..150ef74 100644 --- a/app/templates/base_error.html +++ b/app/templates/base_error.html @@ -1,11 +1,9 @@ {% extends BASE_TEMPLATE|default:"base.html" %} {# BASE_TEMPLATE can be undefined in certain error conditions, therefore `default` #} {% load i18n %} - -{% block title %}{% trans "Error" %}{% endblock %} - +{% block title %} + {% trans "Error" %} +{% endblock %} {% block error %} -{% with show_error=True%} - {{ block.super }} -{% endwith %} + {% with show_error=True %}{{ block.super }}{% endwith %} {% endblock %} diff --git a/app/templates/base_htmx.html b/app/templates/base_htmx.html index 28dd7c4..d04fbb2 100644 --- a/app/templates/base_htmx.html +++ b/app/templates/base_htmx.html @@ -1,37 +1,40 @@ {% load i18n %} {% spaceless %} -<html lang="en">{# Required for HTMX title swapping to work #} -<head> - <title>{% block title %}{% trans "LwimiLinks" %}{% endblock %}</title> -</head> - -{% comment %} + <html lang="en"> + {# Required for HTMX title swapping to work #} + <head> + <title> + {% block title %} + {% trans "LwimiLinks" %} + {% endblock %} + </title> + </head> + {% comment %} Some elements outside of <main> might need to be updated. - Navbar with indication of active/current page. - Error messages These use hx-swap-oob so that they are swapped in from the HTMX response. The document title is automatically swapped by HTMX. -{% endcomment %} - -{% include "app/_navbar_items.html" %} - -{% block error %} - {% if show_error %} - <h1 id="error-title" class="card-title" hx-swap-oob="true">{% block error_title %}{% endblock %}</h1> - <p id="error-message" class="card-text" hx-swap-oob="true">{% block error_message %}{% endblock %}</p> - {% endif %} -{% endblock %} - -{% endspaceless %} -<main id="main" tabindex="-1" autofocus aria-labelledby="main-heading"> -{% block content %}{# See notes in base.html #}{% endblock content %} -</main> -{% spaceless %} - -{% if debug_toolbar %} -<script> - {% include "app/js/debug-toolbar-handler.js" %} -</script> -{% endif %} - -{% endspaceless %} + {% endcomment %} + {% include "app/_navbar_items.html" %} + {% block error %} + {% if show_error %} + <h1 id="error-title" class="card-title" hx-swap-oob="true"> + {% block error_title %}{% endblock %} + </h1> + <p id="error-message" class="card-text" hx-swap-oob="true"> + {% block error_message %}{% endblock %} + </p> + {% endif %} + {% endblock %} + {% endspaceless %} + <main id="main" tabindex="-1" autofocus aria-labelledby="main-heading"> + {% block content %} + {# See notes in base.html #} + {% endblock content %} + </main> + {% spaceless %} + {% if debug_toolbar %} + <script>{% include "app/js/debug-toolbar-handler.js" %}</script> + {% endif %} + {% endspaceless %} diff --git a/app/templates/django/forms/field.html b/app/templates/django/forms/field.html index 2df6154..58fccbd 100644 --- a/app/templates/django/forms/field.html +++ b/app/templates/django/forms/field.html @@ -6,16 +6,21 @@ - bootstrap classes {% endcomment %} {% spaceless %} -<div class="mb-3"> -{% if field.use_fieldset %} - <fieldset> - {% if field.label %}{{ field.legend_tag }}{% endif %} -{% else %} - {% if field.label %}{{ field.label_tag }}{% endif %} -{% endif %} -{{ field.errors }} -{{ field }} -{% if field.help_text %}<div class="text-muted"{% if field.auto_id %} id="{{ field.auto_id }}_helptext"{% endif %}>{{ field.help_text|safe }}</div>{% endif %} -{% if field.use_fieldset %}</fieldset>{% endif %} -</div> + <div class="mb-3"> + {% if field.use_fieldset %} + <fieldset> + {% if field.label %}{{ field.legend_tag }}{% endif %} + {% else %} + {% if field.label %}{{ field.label_tag }}{% endif %} + {% endif %} + {{ field.errors }} + {{ field }} + {% if field.help_text %} + <div class="text-muted" + {% if field.auto_id %}id="{{ field.auto_id }}_helptext"{% endif %}> + {{ field.help_text|safe }} + </div> + {% endif %} + {% if field.use_fieldset %}</fieldset>{% endif %} + </div> {% endspaceless %} diff --git a/app/templates/registration/login.html b/app/templates/registration/login.html index 10968cc..42d590a 100644 --- a/app/templates/registration/login.html +++ b/app/templates/registration/login.html @@ -1,20 +1,19 @@ {% extends "registration/registration_base.html" %} {% load i18n %} - -{% block title %}{% trans "Log In" %}{% endblock %} - +{% block title %} + {% trans "Log In" %} +{% endblock %} {% block account_content %} -<h1 id="main-heading">{% trans "Log In" %}</h1> -<form method="post" hx-disable> - {% csrf_token %} - {{ form }} - <a href="{% url 'password_reset' %}" class="d-block mb-2">{% trans "Forgot Password?" %}</a> - <button type="submit" class="btn btn-primary">{% trans "Log In" %}</button> -</form> - -<hr> -<p> - {% trans "Don’t have an account?" %} - <a href="{% url 'accounts_register' %}">{% trans "Create one" %}</a> -</p> + <h1 id="main-heading">{% trans "Log In" %}</h1> + <form method="post" hx-disable> + {% csrf_token %} + {{ form }} + <a href="{% url 'password_reset' %}" class="d-block mb-2">{% trans "Forgot Password?" %}</a> + <button type="submit" class="btn btn-primary">{% trans "Log In" %}</button> + </form> + <hr> + <p> + {% trans "Don’t have an account?" %} + <a href="{% url 'accounts_register' %}">{% trans "Create one" %}</a> + </p> {% endblock %} diff --git a/app/templates/registration/password_change_done.html b/app/templates/registration/password_change_done.html index 24d2f91..90dbbf4 100644 --- a/app/templates/registration/password_change_done.html +++ b/app/templates/registration/password_change_done.html @@ -1,9 +1,10 @@ {% extends "registration/registration_base.html" %} {% load i18n %} - -{% block title %}{% trans "Password change successful" %}{% endblock %} - -{% block account_content %} -<h1 id="main-heading">{% trans "Password change successful" %}</h1> -<p>{% trans "Your password was changed." %} +{% block title %} + {% trans "Password change successful" %} {% endblock %} +{% block account_content %} + <h1 id="main-heading">{% trans "Password change successful" %}</h1> + <p> + {% trans "Your password was changed." %} + {% endblock %} diff --git a/app/templates/registration/password_change_form2.html b/app/templates/registration/password_change_form2.html index 762359e..91f45be 100644 --- a/app/templates/registration/password_change_form2.html +++ b/app/templates/registration/password_change_form2.html @@ -1,19 +1,21 @@ {% extends "registration/registration_base.html" %} {% load i18n %} - -{% block title %}{% trans "Enter new password" %}{% endblock %} - +{% block title %} + {% trans "Enter new password" %} +{% endblock %} {% block account_content %} -<h1 id="main-heading">{% trans "Enter new password" %}</h1> -<p> - {% blocktrans trimmed %} - Please enter your old password, for security’s sake, and then enter your new - password twice so we can verify you typed it in correctly. - {% endblocktrans %} -</p> -<form method="post"> - {% csrf_token %} - {{ form }} - <input type="submit" class="btn btn-primary" value="{% trans 'Reset my password' %}"> -</form> + <h1 id="main-heading">{% trans "Enter new password" %}</h1> + <p> + {% blocktrans trimmed %} + Please enter your old password, for security’s sake, and then enter your new + password twice so we can verify you typed it in correctly. + {% endblocktrans %} + </p> + <form method="post"> + {% csrf_token %} + {{ form }} + <input type="submit" + class="btn btn-primary" + value="{% trans 'Reset my password' %}"> + </form> {% endblock %} diff --git a/app/templates/registration/password_reset_complete.html b/app/templates/registration/password_reset_complete.html index 2dc8c0d..ae939d1 100644 --- a/app/templates/registration/password_reset_complete.html +++ b/app/templates/registration/password_reset_complete.html @@ -1,12 +1,12 @@ {% extends "registration/registration_base.html" %} {% load i18n %} - -{% block title %}{% trans "Password reset complete" %}{% endblock %} - +{% block title %} + {% trans "Password reset complete" %} +{% endblock %} {% block account_content %} -<h1 id="main-heading">{% trans "Password was successfully set" %}</h1> -<p>{% trans "Your password has been set. You may go ahead and log in now." %}</p> -<p> - <a href="{{ login_url }}" class="btn btn-primary">{% trans "Log in" %}</a> -</p> + <h1 id="main-heading">{% trans "Password was successfully set" %}</h1> + <p>{% trans "Your password has been set. You may go ahead and log in now." %}</p> + <p> + <a href="{{ login_url }}" class="btn btn-primary">{% trans "Log in" %}</a> + </p> {% endblock %} diff --git a/app/templates/registration/password_reset_confirm.html b/app/templates/registration/password_reset_confirm.html index 4ab6510..c0d7695 100644 --- a/app/templates/registration/password_reset_confirm.html +++ b/app/templates/registration/password_reset_confirm.html @@ -1,26 +1,26 @@ {% extends "registration/registration_base.html" %} {% load i18n %} - -{% block title %}{% trans "Enter new password" %}{% endblock %} - +{% block title %} + {% trans "Enter new password" %} +{% endblock %} {% block account_content %} {% if validlink %} - <h1 id="main-heading">{% trans "Enter new password" %}</h1> - <p>{% trans "Please enter your new password twice so we can verify you typed it in correctly." %}</p> - - <form method="post">{% csrf_token %} - {{ form }} - <input type="submit" class="btn btn-primary" value="{% trans 'Change my password' %}"> - </form> - + <h1 id="main-heading">{% trans "Enter new password" %}</h1> + <p>{% trans "Please enter your new password twice so we can verify you typed it in correctly." %}</p> + <form method="post"> + {% csrf_token %} + {{ form }} + <input type="submit" + class="btn btn-primary" + value="{% trans 'Change my password' %}"> + </form> {% else %} - - <h1 id="main-heading">{% trans "Password reset link was invalid" %}</h1> - <p> - {% blocktrans trimmed %} - The password reset link was invalid, possibly because it has - already been used. Please request a new password reset. - {% endblocktrans %} - </p> + <h1 id="main-heading">{% trans "Password reset link was invalid" %}</h1> + <p> + {% blocktrans trimmed %} + The password reset link was invalid, possibly because it has + already been used. Please request a new password reset. + {% endblocktrans %} + </p> {% endif %} {% endblock %} diff --git a/app/templates/registration/password_reset_done.html b/app/templates/registration/password_reset_done.html index 390d970..ab89bc7 100644 --- a/app/templates/registration/password_reset_done.html +++ b/app/templates/registration/password_reset_done.html @@ -1,20 +1,18 @@ {% extends "registration/registration_base.html" %} {% load i18n %} - {% block title %}Password reset sent{% endblock %} - {% block account_content %} -<h1 id="main-heading">{% trans "Password reset sent" %}</h1> -<p> - {% blocktrans trimmed %} - We’ve emailed you instructions for setting your password, if an account - exists with the email you entered. You should receive them shortly. - {% endblocktrans %} -</p> -<p> - {% blocktrans trimmed %} - If you don’t receive an email, please make sure you’ve entered the address - you registered with, and check your spam folder. - {% endblocktrans %} -</p> + <h1 id="main-heading">{% trans "Password reset sent" %}</h1> + <p> + {% blocktrans trimmed %} + We’ve emailed you instructions for setting your password, if an account + exists with the email you entered. You should receive them shortly. + {% endblocktrans %} + </p> + <p> + {% blocktrans trimmed %} + If you don’t receive an email, please make sure you’ve entered the address + you registered with, and check your spam folder. + {% endblocktrans %} + </p> {% endblock %} diff --git a/app/templates/registration/password_reset_form.html b/app/templates/registration/password_reset_form.html index 2927734..773422e 100644 --- a/app/templates/registration/password_reset_form.html +++ b/app/templates/registration/password_reset_form.html @@ -1,19 +1,21 @@ {% extends "registration/registration_base.html" %} {% load i18n %} - -{% block title %}{% trans "Password reset" %}{% endblock %} - +{% block title %} + {% trans "Password reset" %} +{% endblock %} {% block account_content %} -<h1 id="main-heading">{% trans "Password reset" %}</h1> -<p> - {% blocktrans trimmed %} - Forgotten your password? Enter your email address below, and we’ll email - instructions for setting a new one. - {% endblocktrans %} -</p> -<form method="post"> - {% csrf_token %} - {{ form }} - <input type="submit" class="btn btn-primary" value="{% trans 'Reset my password' %}"> -</form> + <h1 id="main-heading">{% trans "Password reset" %}</h1> + <p> + {% blocktrans trimmed %} + Forgotten your password? Enter your email address below, and we’ll email + instructions for setting a new one. + {% endblocktrans %} + </p> + <form method="post"> + {% csrf_token %} + {{ form }} + <input type="submit" + class="btn btn-primary" + value="{% trans 'Reset my password' %}"> + </form> {% endblock %} diff --git a/app/templates/registration/register.html b/app/templates/registration/register.html index 7988010..0cec1ac 100644 --- a/app/templates/registration/register.html +++ b/app/templates/registration/register.html @@ -1,13 +1,13 @@ {% extends "registration/registration_base.html" %} {% load i18n %} - -{% block title %}{% trans "Register" %}{% endblock %} - +{% block title %} + {% trans "Register" %} +{% endblock %} {% block account_content %} -<h1 id="main-heading">{% trans "Register" %}</h1> -<form method="post"> - {% csrf_token %} - {{ form }} - <input type="submit" class="btn btn-primary" value="{% trans 'Register' %}"> -</form> + <h1 id="main-heading">{% trans "Register" %}</h1> + <form method="post"> + {% csrf_token %} + {{ form }} + <input type="submit" class="btn btn-primary" value="{% trans 'Register' %}"> + </form> {% endblock %} diff --git a/app/templates/registration/registration_base.html b/app/templates/registration/registration_base.html index d72902b..30c9721 100644 --- a/app/templates/registration/registration_base.html +++ b/app/templates/registration/registration_base.html @@ -1,14 +1,12 @@ {% extends BASE_TEMPLATE %} - {% spaceless %} -{% block content %} -<div class="container limit-text-width"> - <div class="card"> - <div class="card-body"> - {% block account_content%} - {% endblock %} + {% block content %} + <div class="container limit-text-width"> + <div class="card"> + <div class="card-body"> + {% block account_content %}{% endblock %} + </div> + </div> </div> - </div> -</div> -{% endblock %} + {% endblock %} {% endspaceless %}