diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 21a953ef24..739513007b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -139,7 +139,7 @@ Start reading our code and you'll get the hang of it. We optimize for readabilit * Configuration variables are uppercase and can be called in all modules keeping the same name. For example, MAVAR = getattr(settings, "MAVAR", default value) * Global variables to a module are also in uppercase but are considered private to the module and therefore must be prefixed and suffixed with a double underscore - * We indent using two spaces (soft tabs) + * All .py files must be indented using 4 spaces, and all other files (.css, .html, .js) with 2 spaces (soft tabs) * This is open source software. Consider the people who will read your code, and make it look nice for them. It's sort of like driving a car: Perhaps you love doing donuts when you're alone, but with passengers the goal is to make the ride as smooth as possible. ### JavaScript Styleguide diff --git a/pod/dressing/templates/my_dressings.html b/pod/dressing/templates/my_dressings.html index 17bea727b5..3fa2f8e010 100644 --- a/pod/dressing/templates/my_dressings.html +++ b/pod/dressing/templates/my_dressings.html @@ -14,6 +14,7 @@ {% endblock %} {% block page_content %} +
@@ -108,10 +109,10 @@
{% trans 'Available video dressings' %}
@@ -124,6 +125,7 @@ {% endfor %}
+
{% trans 'Add new dressing' %} {% endblock page_content %} diff --git a/pod/dressing/views.py b/pod/dressing/views.py index 9a56f03742..df8433de2b 100644 --- a/pod/dressing/views.py +++ b/pod/dressing/views.py @@ -64,7 +64,7 @@ def video_dressing(request, slug): "video": video, "dressings": dressings, "current": current, - "page_title": _("Dress the video “%s”" % video.title), + "page_title": _("Dress the video “%s”") % video.title, }, ) @@ -190,7 +190,7 @@ def dressing_delete(request, dressing_id): { "dressing": dressing, "form": form, - "page_title": _("Deleting the dressing “%s”" % dressing.title), + "page_title": _("Deleting the dressing “%s”") % dressing.title, }, ) diff --git a/pod/import_video/static/css/import_video.css b/pod/import_video/static/css/import_video.css index c5f25bd664..c80c036171 100644 --- a/pod/import_video/static/css/import_video.css +++ b/pod/import_video/static/css/import_video.css @@ -51,10 +51,9 @@ div.alert.alert-dismissible { padding-left: 78px; position: relative; padding-right: 60px; - border: 1px solid #e6e6e6; - background: #fff; } + div.alert .icon { text-align: center; width: 58px; diff --git a/pod/live/templates/live/event-info.html b/pod/live/templates/live/event-info.html index 40475205e1..e736c802b8 100644 --- a/pod/live/templates/live/event-info.html +++ b/pod/live/templates/live/event-info.html @@ -68,68 +68,67 @@ - diff --git a/pod/locale/fr/LC_MESSAGES/django.mo b/pod/locale/fr/LC_MESSAGES/django.mo index b706d2547c..b64aad4010 100644 Binary files a/pod/locale/fr/LC_MESSAGES/django.mo and b/pod/locale/fr/LC_MESSAGES/django.mo differ diff --git a/pod/locale/fr/LC_MESSAGES/django.po b/pod/locale/fr/LC_MESSAGES/django.po index 7d96cfa15b..158ebc0000 100644 --- a/pod/locale/fr/LC_MESSAGES/django.po +++ b/pod/locale/fr/LC_MESSAGES/django.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: Pod\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-01-29 10:06+0000\n" +"POT-Creation-Date: 2024-01-29 15:38+0000\n" "PO-Revision-Date: \n" "Last-Translator: obado \n" "Language-Team: Pod Team cotech-esup-pod@esup-portail.org\n" @@ -1001,7 +1001,6 @@ msgstr "Supprimer le chapitre « %(chapter_title)s »" #: pod/completion/templates/document/list_document.html #: pod/completion/templates/overlay/list_overlay.html #: pod/dressing/templates/dressing_delete.html -#: pod/dressing/templates/my_dressings.html #: pod/enrichment/templates/enrichment/list_enrichment.html #: pod/live/templates/live/event_delete.html #: pod/meeting/templates/meeting/delete.html @@ -2141,10 +2140,15 @@ msgstr "Pas de filigrane" msgid "View the video" msgstr "Voir la vidéo" -#: pod/dressing/templates/my_dressings.html pod/live/templates/live/direct.html -#: pod/video/templates/videos/video_edit.html -msgid "Edit" -msgstr "Éditer" +#: pod/dressing/templates/my_dressings.html +#, python-format +msgid "Edit “%(title)s”" +msgstr "Modifier « %(title)s »" + +#: pod/dressing/templates/my_dressings.html +#, python-format +msgid "Delete “%(title)s”" +msgstr "Supprimer « %(title)s »" #: pod/dressing/templates/my_dressings.html #: pod/dressing/templates/video_dressing.html @@ -3485,6 +3489,11 @@ msgstr "Prochains évènements" msgid "Manage broadcaster" msgstr "Gérer le diffuseur" +#: pod/live/templates/live/direct.html +#: pod/video/templates/videos/video_edit.html +msgid "Edit" +msgstr "Éditer" + #: pod/live/templates/live/direct.html pod/live/templates/live/directs_all.html msgid "no broadcast in progress" msgstr "aucune diffusion actuellement" @@ -5780,14 +5789,6 @@ msgstr "" msgid "Add a meeting" msgstr "Ajouter une réunion" -#: pod/meeting/templates/meeting/my_meetings.html -msgid "Unable to find information about the meeting" -msgstr "Impossible de trouver des informations sur la réunion" - -#: pod/meeting/templates/meeting/my_meetings.html -msgid "End the meeting" -msgstr "Terminer la réunion" - #: pod/meeting/templates/meeting/recurring_options_modal_form.html msgid "Repeat every" msgstr "Répéter tou(te)s les" @@ -8412,8 +8413,8 @@ msgstr "Document :" #: pod/video/templates/videos/video-info.html msgid "" "Please note that your video is in draft mode.
\n" -"The following links contain a key allowing access.\n" -"Anyone with this links can access it." +" The following links contain a key allowing access.\n" +" Anyone with this links can access it." msgstr "" "Veuillez noter que votre vidéo est en mode brouillon.
\n" "Les liens suivants contiennent une clé permettant l’accès.\n" @@ -9141,3 +9142,9 @@ msgstr "Résultats de la recherche" #: pod/xapi/apps.py msgid "Esup-Pod xAPI" msgstr "xAPI Esup-Pod" + +#~ msgid "Unable to find information about the meeting" +#~ msgstr "Impossible de trouver des informations sur la réunion" + +#~ msgid "End the meeting" +#~ msgstr "Terminer la réunion" diff --git a/pod/locale/fr/LC_MESSAGES/djangojs.mo b/pod/locale/fr/LC_MESSAGES/djangojs.mo index e97aaac2a7..411d8417a5 100644 Binary files a/pod/locale/fr/LC_MESSAGES/djangojs.mo and b/pod/locale/fr/LC_MESSAGES/djangojs.mo differ diff --git a/pod/locale/fr/LC_MESSAGES/djangojs.po b/pod/locale/fr/LC_MESSAGES/djangojs.po index 1712eb8d05..60b767041e 100644 --- a/pod/locale/fr/LC_MESSAGES/djangojs.po +++ b/pod/locale/fr/LC_MESSAGES/djangojs.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: Esup-Pod\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-01-26 16:38+0000\n" +"POT-Creation-Date: 2024-01-29 15:38+0000\n" "PO-Revision-Date: \n" "Last-Translator: obado \n" "Language-Team: \n" @@ -497,6 +497,22 @@ msgstr "Info" msgid "Information" msgstr "Information" +#: pod/meeting/static/js/my_meetings.js +msgid "Unable to find information about the meeting" +msgstr "Impossible de trouver des informations sur la réunion" + +#: pod/meeting/static/js/my_meetings.js +msgid "End the meeting" +msgstr "Terminer la réunion" + +#: pod/meeting/static/js/my_meetings.js +msgid "Text copied." +msgstr "Texte copié." + +#: pod/meeting/static/js/my_meetings.js +msgid "Something went wrong." +msgstr "Quelque-chose s’est mal passé." + #: pod/playlist/static/playlist/js/add-or-edit.js msgid "Public: the playlist can be accessed by anyone." msgstr "Public : la liste de lecture est accessible par tous." diff --git a/pod/locale/nl/LC_MESSAGES/django.po b/pod/locale/nl/LC_MESSAGES/django.po index 324709af9c..312f1f2406 100644 --- a/pod/locale/nl/LC_MESSAGES/django.po +++ b/pod/locale/nl/LC_MESSAGES/django.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: Pod\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-01-29 10:06+0000\n" +"POT-Creation-Date: 2024-01-29 15:38+0000\n" "PO-Revision-Date: 2023-06-08 14:37+0200\n" "Last-Translator: obado \n" "Language-Team: \n" @@ -944,7 +944,6 @@ msgstr "" #: pod/completion/templates/document/list_document.html #: pod/completion/templates/overlay/list_overlay.html #: pod/dressing/templates/dressing_delete.html -#: pod/dressing/templates/my_dressings.html #: pod/enrichment/templates/enrichment/list_enrichment.html #: pod/live/templates/live/event_delete.html #: pod/meeting/templates/meeting/delete.html @@ -2036,9 +2035,14 @@ msgstr "" msgid "View the video" msgstr "" -#: pod/dressing/templates/my_dressings.html pod/live/templates/live/direct.html -#: pod/video/templates/videos/video_edit.html -msgid "Edit" +#: pod/dressing/templates/my_dressings.html +#, python-format +msgid "Edit “%(title)s”" +msgstr "" + +#: pod/dressing/templates/my_dressings.html +#, python-format +msgid "Delete “%(title)s”" msgstr "" #: pod/dressing/templates/my_dressings.html @@ -3261,6 +3265,11 @@ msgstr "" msgid "Manage broadcaster" msgstr "" +#: pod/live/templates/live/direct.html +#: pod/video/templates/videos/video_edit.html +msgid "Edit" +msgstr "" + #: pod/live/templates/live/direct.html pod/live/templates/live/directs_all.html msgid "no broadcast in progress" msgstr "" @@ -5475,14 +5484,6 @@ msgstr "" msgid "Add a meeting" msgstr "" -#: pod/meeting/templates/meeting/my_meetings.html -msgid "Unable to find information about the meeting" -msgstr "" - -#: pod/meeting/templates/meeting/my_meetings.html -msgid "End the meeting" -msgstr "" - #: pod/meeting/templates/meeting/recurring_options_modal_form.html msgid "Repeat every" msgstr "" @@ -7896,8 +7897,8 @@ msgstr "" #: pod/video/templates/videos/video-info.html msgid "" "Please note that your video is in draft mode.
\n" -"The following links contain a key allowing access.\n" -"Anyone with this links can access it." +" The following links contain a key allowing access.\n" +" Anyone with this links can access it." msgstr "" #: pod/video/templates/videos/video-info.html diff --git a/pod/locale/nl/LC_MESSAGES/djangojs.po b/pod/locale/nl/LC_MESSAGES/djangojs.po index c3a646e1a0..6a02cef1be 100644 --- a/pod/locale/nl/LC_MESSAGES/djangojs.po +++ b/pod/locale/nl/LC_MESSAGES/djangojs.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: Esup-Pod\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-01-26 16:38+0000\n" +"POT-Creation-Date: 2024-01-29 15:38+0000\n" "PO-Revision-Date: 2023-02-08 15:22+0100\n" "Last-Translator: obado \n" "Language-Team: \n" @@ -473,6 +473,22 @@ msgstr "" msgid "Information" msgstr "" +#: pod/meeting/static/js/my_meetings.js +msgid "Unable to find information about the meeting" +msgstr "" + +#: pod/meeting/static/js/my_meetings.js +msgid "End the meeting" +msgstr "" + +#: pod/meeting/static/js/my_meetings.js +msgid "Text copied." +msgstr "" + +#: pod/meeting/static/js/my_meetings.js +msgid "Something went wrong." +msgstr "" + #: pod/playlist/static/playlist/js/add-or-edit.js msgid "Public: the playlist can be accessed by anyone." msgstr "" diff --git a/pod/meeting/static/css/meeting.css b/pod/meeting/static/css/meeting.css index 3abef463c2..ab49b2e9dd 100644 --- a/pod/meeting/static/css/meeting.css +++ b/pod/meeting/static/css/meeting.css @@ -72,10 +72,9 @@ div.alert.alert-dismissible { padding-left: 78px; position: relative; padding-right: 60px; - border: 1px solid #e6e6e6; - background: #fff; } + div.alert .icon { text-align: center; width: 58px; diff --git a/pod/meeting/static/js/my_meetings.js b/pod/meeting/static/js/my_meetings.js new file mode 100644 index 0000000000..579dc18583 --- /dev/null +++ b/pod/meeting/static/js/my_meetings.js @@ -0,0 +1,84 @@ +/* Esup-Pod My Meetings JS */ + +var meetingModal = document.getElementById('meetingModal') +meetingModal.addEventListener('show.bs.modal', function (event) { + // Button that triggered the modal + const button = event.relatedTarget + // Extract info from data-bs-* attributes + const meeting_id = button.getAttribute('data-bs-meeting-id') + const title = button.getAttribute('data-bs-meeting-title') + const endurl = button.getAttribute('data-bs-meeting-end-url') + const modalHref = button.getAttribute('data-bs-meeting-info-url'); + + fetch(modalHref, { + method: 'GET', + }).then((response) => { + if (!response.ok) throw Error(response.statusText); + return response.json(); + }).then(function(data){ + if(data.msg != "") { + modalBody.innerHTML = gettext('Unable to find information about the meeting') + console.log(msg) + } else { + const modalendlink = '

' + gettext('End the meeting') + '

'; + modalBody.innerHTML = generateHtml(data.info) + modalendlink + } + }).catch((error) => { + console.error(error); + }); + + // + // Update the modal's content. + const modalTitle = meetingModal.querySelector('.modal-title') + const modalBody = meetingModal.querySelector('.modal-body') + //const modalFooterEndLink = meetingModal.querySelector('.modal-footer a.endlink') + + modalTitle.textContent = title + modalBody.textContent = meeting_id + //modalFooterEndLink.setAttribute("href", endurl) + +}) + +/* TODO: check if level parameter can be removed. */ +/** + * Recursively generate an HTML unordered list version of data + * @param {Array} data Data to be displayed + * @param {Number} level level of recursion (useless?) + * @return {string} Generated HTML + */ +function generateHtml(data, level=0) { + html = "
    " + for (let k in data) { + if (typeof data[k] === "object") { + html += "
  • " + k + ": " + generateHtml(data[k], level++) + "
  • "; + } else { + html += "
  • " + k + ": " + data[k] + "
  • "; + } + } + html += "
" + return html +} + +var copyButtons = document.querySelectorAll('.pod-btn-copy') +copyButtons.forEach(function (elt) { + elt.addEventListener('click', function (event) { + const input_id = this.dataset.copyvalue; + copyValue(input_id) + }); +}); + +/** + * Copy a value in client clipboard, then display a feedback. + * @param {String} value The value to be copied + * @return {void} + */ +function copyValue(value) { + navigator.clipboard + .writeText(value) + .then(() => { + showalert(gettext("Text copied."), "alert-success"); + }) + .catch(() => { + showalert(gettext("Something went wrong."), "alert-danger"); + }); +} diff --git a/pod/meeting/templates/meeting/link_meeting.html b/pod/meeting/templates/meeting/link_meeting.html index fea68ff73f..09a1aa08af 100644 --- a/pod/meeting/templates/meeting/link_meeting.html +++ b/pod/meeting/templates/meeting/link_meeting.html @@ -7,8 +7,8 @@ + data-copyvalue="{% if request.is_secure %}https://{% else %}http://{% endif %}{{request.get_host}}{% url 'meeting:join' meeting.meeting_id meeting.get_hashkey %}" + data-bs-toggle="tooltip" data-bs-placement="top" title="{% trans 'Copy the direct join link' %}"> diff --git a/pod/meeting/templates/meeting/meeting_card.html b/pod/meeting/templates/meeting/meeting_card.html index 54b264c573..dd77fa49ab 100644 --- a/pod/meeting/templates/meeting/meeting_card.html +++ b/pod/meeting/templates/meeting/meeting_card.html @@ -42,15 +42,15 @@ - + - {% trans "Join the meeting" %} + {% trans "Join the meeting" %} {% else %} - {% trans "Start the meeting" %} + {% trans "Start the meeting" %} {% endif %} diff --git a/pod/meeting/templates/meeting/my_meetings.html b/pod/meeting/templates/meeting/my_meetings.html index fb76211655..767b35ae3c 100644 --- a/pod/meeting/templates/meeting/my_meetings.html +++ b/pod/meeting/templates/meeting/my_meetings.html @@ -69,89 +69,5 @@ {% endblock page_aside %} {% block more_script %} - - + {% endblock more_script %} diff --git a/pod/video/static/js/video_category.js b/pod/video/static/js/video_category.js index dc135a2e9c..4f4b66eea8 100644 --- a/pod/video/static/js/video_category.js +++ b/pod/video/static/js/video_category.js @@ -1,3 +1,12 @@ +/** + * Esup-Pod video category scripts. + */ + +/* Read-only globals defined in filter_aside_video_list_refresh.js and my_videos.html */ +/* +global refreshVideosSearch, CATEGORIES_DATA, BASE_URL, VIDEO_URL, EDIT_URL, + COMPLETION_URL, CHAPTER_URL, DELETE_URL +*/ (function (CATEGORIES_DATA) { const SERVER_DATA = CATEGORIES_DATA.filter((c) => !Number.isInteger(c)); // Category to delete @@ -180,7 +189,7 @@ }); } }; - searchCatInput.addEventListener("input", (e) => { + searchCatInput.addEventListener("input", () => { searchCatHandler(searchCatInput.value.trim()); }); diff --git a/pod/video/templates/videos/video-info.html b/pod/video/templates/videos/video-info.html index b92fa4b828..63f6ee94d6 100644 --- a/pod/video/templates/videos/video-info.html +++ b/pod/video/templates/videos/video-info.html @@ -352,18 +352,17 @@