Skip to content

Commit

Permalink
[DONE] Fix links (accessibility) (#931)
Browse files Browse the repository at this point in the history
* Change all user_str

* Add titles in header

* Improve breadcrumbs and header

* Fix label content

* Change translation

* Improvements of code

* Easier breadcrumb in base.html

* Improve QoC

* Improve QoC ... again

* Add aria-hidden
  • Loading branch information
AymericJak authored Sep 1, 2023
1 parent 00c225f commit ef4e456
Show file tree
Hide file tree
Showing 22 changed files with 248 additions and 154 deletions.
14 changes: 10 additions & 4 deletions pod/authentication/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,16 @@
FILES_DIR = getattr(settings, "FILES_DIR", "files")


def get_name(self):
if HIDE_USERNAME:
return "%s %s" % (self.first_name, self.last_name)
return "%s %s (%s)" % (self.first_name, self.last_name, self.username)
def get_name(self) -> str:
"""
Returns the user's full name, including the username if not hidden.
Returns:
str: The user's full name and username if not hidden.
"""
if HIDE_USERNAME or not self.is_authenticated:
return self.get_full_name().strip()
return f"{self.get_full_name()} ({self.get_username()})".strip()


User.add_to_class("__str__", get_name)
Expand Down
4 changes: 2 additions & 2 deletions pod/enrichment/templates/enrichment/video_enrichment.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<meta property="og:image:width" content="{% if video.thumbnail.file_exist %}{{video.thumbnail.file.width}}{% else %}640{% endif %}">
<meta property="og:image:height" content="{% if video.thumbnail.file_exist %}{{video.thumbnail.file.height}}{% else %}360{% endif %}">

<meta property="og:description" content="{% if video.description or tag_list %}{{ video.description|metaformat|safe|striptags|truncatechars:250 }} {% if tag_list %}{% for tag in tag_list %}{{tag}} {%endfor%}%{% endif %}{% endif %} {% trans 'Added by' %}: {{ video.owner.get_full_name }}">
<meta property="og:description" content="{% if video.description or tag_list %}{{ video.description|metaformat|safe|striptags|truncatechars:250 }} {% if tag_list %}{% for tag in tag_list %}{{tag}} {%endfor%}%{% endif %}{% endif %} {% trans 'Added by:' %} {{ video.owner.get_full_name }}">

<meta property="og:type" content="video">
<meta property="og:video" content="{% if request.is_secure %}https{% else %}http{% endif %}://{{ request.META.HTTP_HOST }}{% url 'enrichment:video_enrichment' slug=video.slug %}?is_iframe=true">
Expand All @@ -32,7 +32,7 @@
<meta name="twitter:site" content="{{ TITLE_SITE }}">
<meta name="twitter:url" content="{% if request.is_secure %}https{% else %}http{% endif %}://{{ request.META.HTTP_HOST }}{% url 'enrichment:video_enrichment' slug=video.slug %}">
<meta name="twitter:title" content="{{ video.title }}">
<meta name="twitter:description" content="{% if video.description or tag_list %}{{ video.description|metaformat|safe|striptags|truncatechars:250 }} {% if tag_list %}{% for tag in tag_list %}{{tag}} {%endfor%}%{% endif %}{% endif %} {% trans 'Added by' %}: {{ video.owner.get_full_name }}">
<meta name="twitter:description" content="{% if video.description or tag_list %}{{ video.description|metaformat|safe|striptags|truncatechars:250 }} {% if tag_list %}{% for tag in tag_list %}{{tag}} {%endfor%}%{% endif %}{% endif %} {% trans 'Added by:' %} {{ video.owner.get_full_name }}">
<meta name="twitter:image" content="{% if request.is_secure %}https{% else %}http{% endif %}:{{ video.get_thumbnail_url }}">

<meta name="twitter:player" content="{% if request.is_secure %}https{% else %}http{% endif %}://{{ request.META.HTTP_HOST }}{% url 'video:video' slug=video.slug %}?is_iframe=true">
Expand Down
5 changes: 3 additions & 2 deletions pod/live/templates/live/event-info.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,14 @@ <h3 class="meta-title">{% trans 'Location:' %}</h3>
<li class="col-6 col-md-4">
<h3 class="meta-title">{% trans 'Added by:' %}</h3>
<div>
<a class="btn btn-link btn-sm" href="{% url 'videos:videos' %}?owner={{ event.owner.username }}" {% if request.GET.is_iframe %}target="_blank"{% endif %}>
<a class="btn btn-link btn-sm" href="{% url 'videos:videos' %}?owner={{ event.owner.get_username }}" {% if request.GET.is_iframe %}target="_blank"{% endif %}>
{% if event.owner.owner.userpicture.file %}
{% thumbnail event.owner.owner.userpicture.file "x34" as im %}
<img src="{{ im.url }}" width="{{ im.width }}" height="{{ im.height }}" class='userpicture rounded' alt="" loading="lazy">
{% endthumbnail %}
{% endif %}
{{ event.owner.get_full_name }}</a>
{{ event.owner }}
</a>
</div>
</li>
<li class="col-6 col-md-4">
Expand Down
Binary file modified pod/locale/fr/LC_MESSAGES/django.mo
Binary file not shown.
74 changes: 58 additions & 16 deletions pod/locale/fr/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Pod\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-08-31 12:25+0000\n"
"POT-Creation-Date: 2023-09-01 09:54+0000\n"
"PO-Revision-Date: \n"
"Last-Translator: obado <[email protected]>\n"
"Language-Team: Pod Team [email protected]\n"
Expand Down Expand Up @@ -2133,9 +2133,12 @@ msgid "Enriched"
msgstr "Enrichi"

#: pod/enrichment/templates/enrichment/video_enrichment.html
#: pod/live/templates/live/event-info.html
#: pod/video/templates/videos/video-info.html
#: pod/video/templates/videos/video_opengraph.html
msgid "Added by"
msgstr "Ajouté par"
#: pod/video/templates/videos/video_page_content.html
msgid "Added by:"
msgstr "Ajouté par :"

#: pod/enrichment/templates/enrichment/video_enrichment.html
msgid "Informations"
Expand Down Expand Up @@ -2400,7 +2403,7 @@ msgid "Tags"
msgstr "Mots clés"

#: pod/import_video/templates/import_video/filter_aside.html
#: pod/main/templates/navbar.html pod/main/templates/navbar_collapse.html
#: pod/main/templates/navbar_collapse.html
#: pod/meeting/templates/meeting/filter_aside_recording.html
#: pod/video/templates/videos/filter_aside.html
#: pod/video/templates/videos/filter_aside_category.html
Expand Down Expand Up @@ -3169,7 +3172,7 @@ msgid "Home"
msgstr "Accueil"

#: pod/live/templates/live/direct.html
#: pod/live/templates/live/event-script.html
#: pod/live/templates/live/event-script.html pod/main/templates/footer.html
#: pod/video/templates/videos/video-script.html
msgid "New window"
msgstr "Nouvelle fenêtre"
Expand Down Expand Up @@ -3264,12 +3267,6 @@ msgstr "%(start_date)s au %(end_date)s"
msgid "Location:"
msgstr "Lieu :"

#: pod/live/templates/live/event-info.html
#: pod/video/templates/videos/video-info.html
#: pod/video/templates/videos/video_page_content.html
msgid "Added by:"
msgstr "Ajouté par :"

#: pod/live/templates/live/event-info.html
#: pod/video/templates/videos/video-info.html
msgid "Type:"
Expand Down Expand Up @@ -4518,8 +4515,8 @@ msgid "Back to the previous page"
msgstr "Retour à la page précédente"

#: pod/main/templates/footer.html
msgid "Go to top"
msgstr "Haut de page"
msgid "Return to top of page"
msgstr "Retourner en haut de la page"

#: pod/main/templates/footer.html
msgid ""
Expand All @@ -4534,8 +4531,12 @@ msgid "Esup Portal"
msgstr "ESUP-Portail"

#: pod/main/templates/footer.html
msgid "Pod Project"
msgstr "Projet Pod"
msgid "Show Esup-Pod project"
msgstr "Afficher le projet Esup-Pod"

#: pod/main/templates/footer.html
msgid "Esup-Pod Project"
msgstr "Projet Esup-Pod"

#: pod/main/templates/footer.html pod/video/feeds.py
msgid "video platform of"
Expand Down Expand Up @@ -4615,14 +4616,38 @@ msgstr "Listes de lecture promues"
msgid "Channels"
msgstr "Chaînes"

#: pod/main/templates/navbar.html
msgid "Search for a media on"
msgstr "Rechercher un média sur"

#: pod/main/templates/navbar.html
msgid "Search a media"
msgstr "Rechercher un média"

#: pod/main/templates/navbar.html
msgid "Start media search on"
msgstr "Lancer la recherche d'un média sur"

#: pod/main/templates/navbar.html
msgid "Some features are unavailable"
msgstr "Certaines fonctionnalités sont indisponibles"

#: pod/main/templates/navbar.html
msgid "Add a new video on"
msgstr "Ajouter une nouvelle vidéo sur"

#: pod/main/templates/navbar.html
msgid "Add a video"
msgstr "Ajouter une vidéo"

#: pod/main/templates/navbar.html
msgid "Show all my videos on"
msgstr "Afficher toutes mes vidéos sur"

#: pod/main/templates/navbar.html
msgid "Show all my meetings on"
msgstr "Afficher toutes mes réunions sur"

#: pod/main/templates/navbar.html
#: pod/meeting/templates/meeting/add_or_edit.html
#: pod/meeting/templates/meeting/delete.html
Expand Down Expand Up @@ -4659,7 +4684,11 @@ msgstr "Utilise une police plus adaptée aux personnes atteintes de dyslexie."

#: pod/main/templates/navbar.html
msgid "Dyslexia mode"
msgstr "Police ‘Open Dyslexic’"
msgstr "Mode dyslexie"

#: pod/main/templates/navbar.html
msgid "Toggle user menu"
msgstr "Basculer le menu utilisateur"

#: pod/main/templates/navbar.html
msgid "Add your picture"
Expand Down Expand Up @@ -4714,6 +4743,10 @@ msgstr "Nombre de vidéos :"
msgid "Number of playlists:"
msgstr "Nombre de listes de lecture :"

#: pod/main/templates/navbar.html
msgid "Open login page"
msgstr "Ouvrir la page de connexion"

#: pod/main/templates/navbar_collapse.html
msgid "Types of videos"
msgstr "Types de vidéos"
Expand Down Expand Up @@ -8444,6 +8477,15 @@ msgstr "Résultats de la recherche"
msgid "Esup-Pod xAPI"
msgstr "xAPI Esup-Pod"

#~ msgid "Added by"
#~ msgstr "Ajouté par"

#~ msgid "Toggle your action menu"
#~ msgstr "Basculer votre menu d'actions"

#~ msgid "Go to top"
#~ msgstr "Haut de page"

#~ msgid "Edit the overlay"
#~ msgstr "Éditer la superposition"

Expand Down
2 changes: 1 addition & 1 deletion pod/locale/fr/LC_MESSAGES/djangojs.po
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Esup-Pod\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-08-31 12:25+0000\n"
"POT-Creation-Date: 2023-09-01 09:54+0000\n"
"PO-Revision-Date: \n"
"Last-Translator: obado <[email protected]>\n"
"Language-Team: \n"
Expand Down
57 changes: 45 additions & 12 deletions pod/locale/nl/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Pod\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-08-31 12:25+0000\n"
"POT-Creation-Date: 2023-09-01 09:54+0000\n"
"PO-Revision-Date: 2023-06-08 14:37+0200\n"
"Last-Translator: obado <[email protected]>\n"
"Language-Team: \n"
Expand Down Expand Up @@ -2026,8 +2026,11 @@ msgid "Enriched"
msgstr ""

#: pod/enrichment/templates/enrichment/video_enrichment.html
#: pod/live/templates/live/event-info.html
#: pod/video/templates/videos/video-info.html
#: pod/video/templates/videos/video_opengraph.html
msgid "Added by"
#: pod/video/templates/videos/video_page_content.html
msgid "Added by:"
msgstr ""

#: pod/enrichment/templates/enrichment/video_enrichment.html
Expand Down Expand Up @@ -2259,7 +2262,7 @@ msgid "Tags"
msgstr ""

#: pod/import_video/templates/import_video/filter_aside.html
#: pod/main/templates/navbar.html pod/main/templates/navbar_collapse.html
#: pod/main/templates/navbar_collapse.html
#: pod/meeting/templates/meeting/filter_aside_recording.html
#: pod/video/templates/videos/filter_aside.html
#: pod/video/templates/videos/filter_aside_category.html
Expand Down Expand Up @@ -2959,7 +2962,7 @@ msgid "Home"
msgstr ""

#: pod/live/templates/live/direct.html
#: pod/live/templates/live/event-script.html
#: pod/live/templates/live/event-script.html pod/main/templates/footer.html
#: pod/video/templates/videos/video-script.html
msgid "New window"
msgstr ""
Expand Down Expand Up @@ -3050,12 +3053,6 @@ msgstr ""
msgid "Location:"
msgstr ""

#: pod/live/templates/live/event-info.html
#: pod/video/templates/videos/video-info.html
#: pod/video/templates/videos/video_page_content.html
msgid "Added by:"
msgstr ""

#: pod/live/templates/live/event-info.html
#: pod/video/templates/videos/video-info.html
msgid "Type:"
Expand Down Expand Up @@ -4276,7 +4273,7 @@ msgid "Back to the previous page"
msgstr ""

#: pod/main/templates/footer.html
msgid "Go to top"
msgid "Return to top of page"
msgstr ""

#: pod/main/templates/footer.html
Expand All @@ -4290,7 +4287,11 @@ msgid "Esup Portal"
msgstr ""

#: pod/main/templates/footer.html
msgid "Pod Project"
msgid "Show Esup-Pod project"
msgstr ""

#: pod/main/templates/footer.html
msgid "Esup-Pod Project"
msgstr ""

#: pod/main/templates/footer.html pod/video/feeds.py
Expand Down Expand Up @@ -4369,14 +4370,38 @@ msgstr ""
msgid "Channels"
msgstr ""

#: pod/main/templates/navbar.html
msgid "Search for a media on"
msgstr ""

#: pod/main/templates/navbar.html
msgid "Search a media"
msgstr ""

#: pod/main/templates/navbar.html
msgid "Start media search on"
msgstr ""

#: pod/main/templates/navbar.html
msgid "Some features are unavailable"
msgstr ""

#: pod/main/templates/navbar.html
msgid "Add a new video on"
msgstr ""

#: pod/main/templates/navbar.html
msgid "Add a video"
msgstr ""

#: pod/main/templates/navbar.html
msgid "Show all my videos on"
msgstr ""

#: pod/main/templates/navbar.html
msgid "Show all my meetings on"
msgstr ""

#: pod/main/templates/navbar.html
#: pod/meeting/templates/meeting/add_or_edit.html
#: pod/meeting/templates/meeting/delete.html
Expand Down Expand Up @@ -4415,6 +4440,10 @@ msgstr ""
msgid "Dyslexia mode"
msgstr ""

#: pod/main/templates/navbar.html
msgid "Toggle user menu"
msgstr ""

#: pod/main/templates/navbar.html
msgid "Add your picture"
msgstr ""
Expand Down Expand Up @@ -4468,6 +4497,10 @@ msgstr ""
msgid "Number of playlists:"
msgstr ""

#: pod/main/templates/navbar.html
msgid "Open login page"
msgstr ""

#: pod/main/templates/navbar_collapse.html
msgid "Types of videos"
msgstr ""
Expand Down
2 changes: 1 addition & 1 deletion pod/locale/nl/LC_MESSAGES/djangojs.po
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Esup-Pod\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-08-31 12:25+0000\n"
"POT-Creation-Date: 2023-09-01 09:54+0000\n"
"PO-Revision-Date: 2023-02-08 15:22+0100\n"
"Last-Translator: obado <[email protected]>\n"
"Language-Team: \n"
Expand Down
4 changes: 3 additions & 1 deletion pod/main/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,9 @@
<nav aria-label="{% trans 'Breadcrumb' %}" class="breadcrumb d-flex justify-content-between pb-2" id="mainbreadcrumb">
<ol class="breadcrumb p-0 mb-0">
{% block breadcrumbs %}
<li class="breadcrumb-item"><a href="/">{% trans 'Home' %}</a></li>
<li class="breadcrumb-item {% if request.path == '/' %}active" aria-current="page{% endif %}">
{% trans 'Home' %}
</li>
{% endblock breadcrumbs %}
</ol>
</nav>
Expand Down
Loading

0 comments on commit ef4e456

Please sign in to comment.