Skip to content

Commit

Permalink
Implement a PWA installation menu entry
Browse files Browse the repository at this point in the history
  • Loading branch information
azmeuk committed Sep 26, 2023
1 parent e0e46e0 commit cc485c5
Show file tree
Hide file tree
Showing 8 changed files with 111 additions and 40 deletions.
Binary file modified pod/locale/fr/LC_MESSAGES/django.mo
Binary file not shown.
81 changes: 52 additions & 29 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-09-22 16:41+0200\n"
"POT-Creation-Date: 2023-09-26 13:54+0000\n"
"PO-Revision-Date: \n"
"Last-Translator: obado <bado@unice.fr>\n"
"Language-Team: Pod Team pod@esup-portail.org\n"
Expand Down Expand Up @@ -828,6 +828,7 @@ msgstr "Le fichier doit être au format VTT."

#: pod/chapter/models.py pod/completion/models.py pod/enrichment/models.py
#: pod/playlist/templates/playlist/playlist_card.html pod/video/models.py
#: pod/video_encode_transcript/utils.py
msgid "video"
msgstr "vidéo"

Expand Down Expand Up @@ -2126,8 +2127,8 @@ msgid ""
msgstr ""
"Les champs \"Début\" et \"Fin\" doivent contenir des valeurs en secondes. "
"Lancez la lecture de la vidéo, mettez sur pause et cliquez sur \"Récupérer "
"le temps depuis le lecteur\" pour renseigner automatiquement le champ \"Début"
"\". Vous pouvez le faire également pour remplir le champ \"Fin\"."
"le temps depuis le lecteur\" pour renseigner automatiquement le champ "
"\"Début\". Vous pouvez le faire également pour remplir le champ \"Fin\"."

#: pod/enrichment/templates/enrichment/edit_enrichment.html
msgid "You cannot overlap enrichments."
Expand Down Expand Up @@ -2632,8 +2633,8 @@ msgid ""
"This video was uploaded to Pod; its origin is %(type)s: <a href=\"%(url)s\" "
"target=\"_blank\">%(url)s</a>"
msgstr ""
"Cette vidéo a été téléversée sur Pod ; son origine est %(type)s : <a href="
"\"%(url)s\" target=\"_blank\">%(url)s</a>"
"Cette vidéo a été téléversée sur Pod ; son origine est %(type)s : <a "
"href=\"%(url)s\" target=\"_blank\">%(url)s</a>"

#: pod/import_video/views.py pod/meeting/views.py
msgid "Try changing the record type or address for this recording."
Expand All @@ -2644,8 +2645,8 @@ msgstr ""
#: pod/import_video/views.py
#, python-format
msgid ""
"This video '%(name)s' was uploaded to Pod; its origin is Youtube: <a href="
"\"%(url)s\" target=\"_blank\">%(url)s</a>"
"This video '%(name)s' was uploaded to Pod; its origin is Youtube: <a "
"href=\"%(url)s\" target=\"_blank\">%(url)s</a>"
msgstr ""
"Cette vidéo « %(name)s » a été téléversée sur Pod ; son origine est "
"Youtube : <a href=\"%(url)s\" target=\"_blank\">%(url)s</a>"
Expand Down Expand Up @@ -4743,6 +4744,10 @@ msgstr "Revendiquer un enregistrement"
msgid "Notifications settings"
msgstr "Paramètres de notifications"

#: pod/main/templates/navbar.html
msgid "Install"
msgstr "Installer"

#: pod/main/templates/navbar.html
msgid "Log out"
msgstr "Déconnexion"
Expand Down Expand Up @@ -5538,16 +5543,16 @@ msgid ""
msgstr ""
"\n"
" <p>Bonjour,\n"
" <p>%(owner)s vous invite à une réunion récurrente <b>"
"%(meeting_title)s</b>.</p>\n"
" <p>%(owner)s vous invite à une réunion récurrente "
"<b>%(meeting_title)s</b>.</p>\n"
" <p>Date de début : %(start_date_time)s </p>\n"
" <p>Récurrent jusqu’à la date : %(end_date)s </p>\n"
" <p>La réunion se tiendra tou(te)s les %(frequency)s %(recurrence)s </"
"p>\n"
" <p>Voici le lien pour rejoindre la réunion :\n"
" <a href=\"%(join_link)s\">%(join_link)s</a></p>\n"
" <p>Vous avez besoin de ce mot de passe pour entrer : <b>"
"%(password)s</b> </p>\n"
" <p>Vous avez besoin de ce mot de passe pour entrer : "
"<b>%(password)s</b> </p>\n"
" <p>Cordialement</p>\n"
" "

Expand All @@ -5573,8 +5578,8 @@ msgstr ""
" <p>Date de fin : %(end_date)s </p>\n"
" <p>Voici le lien pour rejoindre la réunion :\n"
" <a href=\"%(join_link)s\">%(join_link)s</a></p>\n"
" <p>Vous avez besoin de ce mot de passe pour entrer : <b>"
"%(password)s</b> </p>\n"
" <p>Vous avez besoin de ce mot de passe pour entrer : "
"<b>%(password)s</b> </p>\n"
" <p>Cordialement</p>\n"
" "

Expand Down Expand Up @@ -6570,8 +6575,8 @@ msgstr "Prévisualisation d’enregistrement"
#: pod/video/templates/videos/video-element.html
msgid ""
"To view this video please enable JavaScript, and consider upgrading to a web "
"browser that <a href=\"https://videojs.com/html5-video-support/\" target="
"\"_blank\">supports HTML5 video</a>"
"browser that <a href=\"https://videojs.com/html5-video-support/\" "
"target=\"_blank\">supports HTML5 video</a>"
msgstr ""
"Pour visionner cette vidéo, veuillez activer JavaScript et envisager de "
"passer à un navigateur Web qui <a href=\"https://videojs.com/html5-video-"
Expand Down Expand Up @@ -6650,9 +6655,10 @@ msgid ""
msgstr ""
"Bonjour, <p>un nouvel enregistrement a été ajouté sur la plateforme "
"%(title_site)s à partir de l’enregistreur \"%(recorder)s\".<br>Pour "
"l’ajouter, cliquez sur le lien ci dessous.</p><a href=\"%(link_url)s\">"
"%(link_url)s</a><br><i>Si le lien n’est pas actif, il faut le copier-coller "
"dans la barre d’adresse de votre navigateur.</i><p><p>Cordialement</p>"
"l’ajouter, cliquez sur le lien ci dessous.</p><a "
"href=\"%(link_url)s\">%(link_url)s</a><br><i>Si le lien n’est pas actif, il "
"faut le copier-coller dans la barre d’adresse de votre navigateur.</"
"i><p><p>Cordialement</p>"

#: pod/recorder/views.py
msgid "New recording added."
Expand All @@ -6673,9 +6679,9 @@ msgid ""
"(tutorials, distance training, student reports, etc.), institutional life "
"(video of events), offering several days of content."
msgstr ""
"Podeduc a pour but de faciliter la mise à disposition de vidéo et de ce fait, "
"d’encourager l’utilisation de celles-ci dans le cadre de l’enseignement et "
"la recherche."
"Podeduc a pour but de faciliter la mise à disposition de vidéo et de ce "
"fait, d’encourager l’utilisation de celles-ci dans le cadre de "
"l’enseignement et la recherche."

#: pod/urls.py
msgid "Pod Administration"
Expand Down Expand Up @@ -7011,8 +7017,8 @@ msgid ""
"%(url)s</a></p>\n"
msgstr ""
"vous pouvez changer la date de suppression en éditant votre vidéo :</p>\n"
"<p><a href=\"%(scheme)s:%(url)s\" rel=\"noopener\" target=\"_blank\">"
"%(scheme)s:%(url)s</a></p>\n"
"<p><a href=\"%(scheme)s:%(url)s\" rel=\"noopener\" "
"target=\"_blank\">%(scheme)s:%(url)s</a></p>\n"
"\n"

#: pod/video/management/commands/check_obsolete_videos.py
Expand Down Expand Up @@ -7236,10 +7242,6 @@ msgstr ""
msgid "Date of event"
msgstr "Date de l’évènement"

#: pod/video/models.py
msgid "The password is / will be encrypted."
msgstr "Le mot de passe est / sera encrypté."

#: pod/video/models.py
msgid "Overview"
msgstr "Vue d’ensemble"
Expand Down Expand Up @@ -7774,8 +7776,8 @@ msgid ""
"This video is chaptered. Click the chapter button <span class=\"vjs-icon-"
"chapters\"></span> on the video player to view them."
msgstr ""
"Cette vidéo est chapitrée. Cliquez sur le bouton de chapitre <span class="
"\"vjs-icon-chapters\"></span> sur le lecteur vidéo pour les voir."
"Cette vidéo est chapitrée. Cliquez sur le bouton de chapitre <span "
"class=\"vjs-icon-chapters\"></span> sur le lecteur vidéo pour les voir."

#: pod/video/templates/videos/video-all-info.html
msgid "Other versions"
Expand Down Expand Up @@ -8580,6 +8582,24 @@ msgstr "encodé aux formats Web"
msgid "the:"
msgstr "le :"

#: pod/video_encode_transcript/utils.py
#, fuzzy
#| msgid "Content"
msgid "content"
msgstr "Contenu"

#: pod/video_encode_transcript/utils.py
#, fuzzy
#| msgid "Transcript"
msgid "Transcripting"
msgstr "Transcrire"

#: pod/video_encode_transcript/utils.py
#, fuzzy
#| msgid "automatically transcripted"
msgid "automatically transcript"
msgstr "automatiquement transcrit"

#: pod/video_search/apps.py
msgid "Video search"
msgstr "Recherche de vidéo"
Expand Down Expand Up @@ -8607,3 +8627,6 @@ msgstr "Résultats de la recherche"
#: pod/xapi/apps.py
msgid "Esup-Pod xAPI"
msgstr "xAPI Esup-Pod"

#~ msgid "The password is / will be encrypted."
#~ msgstr "Le mot de passe est / sera encrypté."
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-09-22 16:41+0200\n"
"POT-Creation-Date: 2023-09-26 13:54+0000\n"
"PO-Revision-Date: \n"
"Last-Translator: obado <bado@unice.fr>\n"
"Language-Team: \n"
Expand Down
31 changes: 22 additions & 9 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-09-22 16:41+0200\n"
"POT-Creation-Date: 2023-09-26 13:54+0000\n"
"PO-Revision-Date: 2023-06-08 14:37+0200\n"
"Last-Translator: obado <bado@unice.fr>\n"
"Language-Team: \n"
Expand Down Expand Up @@ -778,6 +778,7 @@ msgstr ""

#: pod/chapter/models.py pod/completion/models.py pod/enrichment/models.py
#: pod/playlist/templates/playlist/playlist_card.html pod/video/models.py
#: pod/video_encode_transcript/utils.py
msgid "video"
msgstr ""

Expand Down Expand Up @@ -2480,8 +2481,8 @@ msgstr ""
#: pod/import_video/views.py
#, python-format
msgid ""
"This video '%(name)s' was uploaded to Pod; its origin is Youtube: <a href="
"\"%(url)s\" target=\"_blank\">%(url)s</a>"
"This video '%(name)s' was uploaded to Pod; its origin is Youtube: <a "
"href=\"%(url)s\" target=\"_blank\">%(url)s</a>"
msgstr ""

#: pod/import_video/views.py
Expand Down Expand Up @@ -4500,6 +4501,10 @@ msgstr ""
msgid "Notifications settings"
msgstr ""

#: pod/main/templates/navbar.html
msgid "Install"
msgstr ""

#: pod/main/templates/navbar.html
msgid "Log out"
msgstr "Uitloggen"
Expand Down Expand Up @@ -6202,8 +6207,8 @@ msgstr ""
#: pod/video/templates/videos/video-element.html
msgid ""
"To view this video please enable JavaScript, and consider upgrading to a web "
"browser that <a href=\"https://videojs.com/html5-video-support/\" target="
"\"_blank\">supports HTML5 video</a>"
"browser that <a href=\"https://videojs.com/html5-video-support/\" "
"target=\"_blank\">supports HTML5 video</a>"
msgstr ""

#: pod/recorder/templates/recorder/link_record.html
Expand Down Expand Up @@ -6774,10 +6779,6 @@ msgstr ""
msgid "Date of event"
msgstr ""

#: pod/video/models.py
msgid "The password is / will be encrypted."
msgstr ""

#: pod/video/models.py
msgid "Overview"
msgstr ""
Expand Down Expand Up @@ -8060,6 +8061,18 @@ msgstr ""
msgid "the:"
msgstr ""

#: pod/video_encode_transcript/utils.py
msgid "content"
msgstr ""

#: pod/video_encode_transcript/utils.py
msgid "Transcripting"
msgstr ""

#: pod/video_encode_transcript/utils.py
msgid "automatically transcript"
msgstr ""

#: pod/video_search/apps.py
msgid "Video search"
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-09-22 16:41+0200\n"
"POT-Creation-Date: 2023-09-26 13:54+0000\n"
"PO-Revision-Date: 2023-02-08 15:22+0100\n"
"Last-Translator: obado <bado@unice.fr>\n"
"Language-Team: \n"
Expand Down
1 change: 1 addition & 0 deletions pod/main/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,7 @@ <h1 class="page_title">{{page_title|capfirst}}</h1>
{% endif %}
{% if POST_FOOTER_TEMPLATE %}{% include POST_FOOTER_TEMPLATE %}{% endif %}
{% if TRACKING_TEMPLATE %}{% include TRACKING_TEMPLATE %}{% endif %}
<script src="{% static 'js/pwa-installation.js' %}?ver={{VERSION}}"></script>
</body>

</html>
Expand Down
5 changes: 5 additions & 0 deletions pod/main/templates/navbar.html
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,11 @@ <h5 id="pod-navbar__menuuserLabel">{% if user.get_full_name != '' %}{{ user.get_
<i class="bi bi-bell pod-nav-link-icon mx-1" aria-hidden="true"></i>{% trans 'Notifications settings' %}
</button>
</div>
<div class="nav-item d-none" id="pwa-install-container">
<button class="nav-link" onclick="">
<i class="bi bi-save pod-nav-link-icon mx-1" aria-hidden="true"></i>{% trans 'Install' %}
</button>
</div>
{% comment %}
<a class="nav-item nav-link" href="#">Gestion de mon compte</a> {% endcomment %}
<hr class="dropdown-divider">
Expand Down
29 changes: 29 additions & 0 deletions pod/progressive_web_app/static/js/pwa-installation.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
let installPrompt = null;
let installButton = null;
let isInstalled = window.matchMedia("(display-mode:standalone)").matches;

document.addEventListener("DOMContentLoaded", function() {
installButton = document.querySelector("#pwa-install-container");

if (!installButton) {
return;
}

window.addEventListener("beforeinstallprompt", (event) => {
event.preventDefault();
installPrompt = event;
if(!isInstalled) {
installButton.classList.remove("d-none");
}
});

installButton.addEventListener("click", async () => {
if (!installPrompt) {
return;
}
const result = await installPrompt.prompt();
if (result.outcome == "accepted") {
installButton.classList.add("d-none");
}
});
})

0 comments on commit cc485c5

Please sign in to comment.