Skip to content

Commit

Permalink
[DONE] 3.5.0 fixes and a11y (#1031)
Browse files Browse the repository at this point in the history
* * Add some global JS vars in .eslintrc
* Upgrade BS icons to 1.11 to have the "X" version of twitter icon
* Improve some english typography (' -> ’ and ".." -> “...”)
* Add some code comments
* Remove useless `" + "` in python strings
* Use the `page_title`attribute in video dressing
* Test presence of `watermarkField` before observing its changes in video dressing
* No more add help text aria attribute for hidden inputs
* Overwrite some default css for CKeditor and select2
* Remove "title" and "video file" from allowed bulk modifications in Dashboard
* Reorder some headings (h4 or H5 modal titles -> h2)

* * Remove uselss aside menu on "edit" and "delete" dressing pages
* Add missing form labels
* correct select2 corlor contrast

* Update i18n .po files

* * Correct dressing permissions test
* Better Alt for watermark
* Add missing fieldset in video_dressing

* Update i18n files

* Last i18n fixes
+ better responsive layout for video stats view

* * Add `count_events=NEXT_EVENTS.count` on live/direct.html
* Add "django-extensions" to start Pod in https auto-signed

* correct direct.html indentation

* correct indentation
+ css fix on bulk updates
  • Loading branch information
Badatos authored Jan 29, 2024
1 parent e374e46 commit 3414af4
Show file tree
Hide file tree
Showing 76 changed files with 1,238 additions and 965 deletions.
3 changes: 3 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ module.exports = {
"interpolate": "readonly",
"bootstrap": "readonly",
"videojs": "readonly",
"CKEDITOR": "readonly",
"send_form_data": "writable",
"showalert": "writable",
"showLoader": "writable",
"manageDisableBtn": "writable"
}
};
4 changes: 2 additions & 2 deletions CONFIGURATION_FR.md
Original file line number Diff line number Diff line change
Expand Up @@ -2512,7 +2512,7 @@ Mettre `USE_PLAYLIST` à True pour activer cette application.<br>
>> "{0}".format(_("Restricted access")),
>> [
>> _(
>> "If you don't select “Draft mode”, you can restrict "
>> "If you dont select “Draft mode”, you can restrict "
>> "the content access to only people who can log in"
>> )
>> ],
Expand All @@ -2521,7 +2521,7 @@ Mettre `USE_PLAYLIST` à True pour activer cette application.<br>
>> "{0}".format(_("Password")),
>> [
>> _(
>> "If you don't select “Draft mode”, you can add a password "
>> "If you dont select “Draft mode”, you can add a password "
>> "which will be asked to anybody willing to watch "
>> "your content."
>> ),
Expand Down
9 changes: 9 additions & 0 deletions pod/authentication/backends.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
"""Esup-Pod Authentication backends."""
from shibboleth.backends import ShibbolethRemoteUserBackend
from mozilla_django_oidc.auth import OIDCAuthenticationBackend
from django.contrib.sites.shortcuts import get_current_site
Expand All @@ -14,10 +15,13 @@


def is_staff_affiliation(affiliation):
"""Check if user affiliation correspond to AFFILIATION_STAFF."""
return affiliation in AFFILIATION_STAFF


class ShibbBackend(ShibbolethRemoteUserBackend):
"""Shibboleth backend authentication."""

def authenticate(self, request, remote_user, shib_meta):
"""
Username passed as `remote_user` is considered trusted.
Expand All @@ -44,6 +48,7 @@ def authenticate(self, request, remote_user, shib_meta):

@staticmethod
def update_owner_params(user, params):
"""Update owner params from Shibboleth."""
user.owner.auth_type = "Shibboleth"
if get_current_site(None) not in user.owner.sites.all():
user.owner.sites.add(get_current_site(None))
Expand Down Expand Up @@ -73,7 +78,10 @@ def update_owner_params(user, params):


class OIDCBackend(OIDCAuthenticationBackend):
"""OIDC backend authentication."""

def create_user(self, claims):
"""Create user connectd by OIDC."""
user = super(OIDCBackend, self).create_user(claims)

user.first_name = claims.get(OIDC_CLAIM_GIVEN_NAME, "")
Expand All @@ -93,6 +101,7 @@ def create_user(self, claims):
return user

def update_user(self, user, claims):
"""Update OIDC user."""
user.first_name = claims.get(OIDC_CLAIM_GIVEN_NAME, "")
user.last_name = claims.get(OIDC_CLAIM_FAMILY_NAME, "")
user.save()
Expand Down
6 changes: 6 additions & 0 deletions pod/authentication/populatedCASbackend.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
"""Esup-Pod CAS & LDAP authentication backend."""
from django.conf import settings
from django.contrib.auth.models import User
from django.contrib.sites.models import Site
Expand Down Expand Up @@ -72,6 +73,7 @@


def populateUser(tree):
"""Populate user form CAS or LDAP attributes."""
username_element = tree.find(
".//{http://www.yale.edu/tp/cas}%s" % AUTH_CAS_USER_SEARCH
)
Expand Down Expand Up @@ -130,6 +132,7 @@ def get_server():


def get_ldap_conn():
"""Open and get LDAP connexion."""
try:
server = get_server()
conn = Connection(
Expand All @@ -145,6 +148,7 @@ def get_ldap_conn():


def get_entry(conn, username, list_value):
"""Get LDAP entries."""
try:
conn.search(
AUTH_LDAP_USER_SEARCH[0],
Expand Down Expand Up @@ -256,6 +260,7 @@ def populate_user_from_entry(user, owner, entry):


def populate_user_from_tree(user, owner, tree):
"""Populate user from CAS attributes."""
if DEBUG:
print_xml_tree(tree)
# Mail
Expand Down Expand Up @@ -307,6 +312,7 @@ def populate_user_from_tree(user, owner, tree):


def print_xml_tree(tree):
"""Print XML tree for debug purpose."""
import xml.etree.ElementTree as ET
import xml.dom.minidom
import os
Expand Down
4 changes: 2 additions & 2 deletions pod/bbb/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,8 @@ class Livestream(models.Model):
verbose_name=_("Enable chat"),
help_text=_(
"Do you want a chat on the live page "
"for students? Messages sent in this live page's chat will "
"end up in BigBlueButton's public chat."
"for students? Messages sent in this live pages chat will "
"end up in BigBlueButtons public chat."
),
default=False,
)
Expand Down
4 changes: 2 additions & 2 deletions pod/bbb/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def publish_meeting(request, id=None):
messages.add_message(
request,
messages.ERROR,
_("You aren't the moderator of this BigBlueButton session."),
_("You arent the moderator of this BigBlueButton session."),
)
raise PermissionDenied

Expand Down Expand Up @@ -229,7 +229,7 @@ def live_publish_meeting(request, id=None):
messages.add_message(
request,
messages.ERROR,
_("You aren't the moderator of this BigBlueButton session."),
_("You arent the moderator of this BigBlueButton session."),
)
raise PermissionDenied

Expand Down
4 changes: 4 additions & 0 deletions pod/chapter/static/js/chapters.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/**
* @file Esup-Pod functions for chapter view.
*/

var id_form = "form_chapter";
function show_form(data) {
let form_chapter = document.getElementById(id_form);
Expand Down
3 changes: 3 additions & 0 deletions pod/chapter/static/js/videojs-chapters.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/**
* @file Esup-Pod functions for videojs-chapters.
*/
(function () {
"use strict";
var videojs = null;
Expand Down
6 changes: 3 additions & 3 deletions pod/completion/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ def verify_not_same_document(self):
if len(list_doc) > 0:
for element in list_doc:
if self.document == element.document:
msg.append(_("This document is already contained " + "in the list"))
msg.append(_("This document is already contained in the list"))
if len(msg) > 0:
return msg
return list()
Expand Down Expand Up @@ -394,10 +394,10 @@ def verify_time_items(self):
)
elif self.time_end > self.video.duration:
msg.append(
_("The value of time end field is greater than the " + "video duration.")
_("The value of time end field is greater than the video duration.")
)
elif self.time_start == self.time_end:
msg.append(_("Time end field and time start field can't " + "be equal."))
msg.append(_("Time end field and time start field can’t be equal."))
if len(msg) > 0:
return msg
else:
Expand Down
6 changes: 4 additions & 2 deletions pod/completion/static/js/caption_maker.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
// Esup-Pod Caption maker Tool
/**
* @file Esup-Pod Caption maker Tool
*/

// Read-only globals defined in video_caption_maker.html
/*
Expand Down Expand Up @@ -551,7 +553,7 @@ function validateForms(forms) {
let captionInput = e.querySelector(".captionTextInput");
if (captionInput.value.length > 80) {
captionInput.setCustomValidity(
gettext("A caption cannot has more than 80 characters.") +
gettext("A caption cannot contain more than 80 characters.") +
"[" +
captionInput.value.length +
"]",
Expand Down
18 changes: 11 additions & 7 deletions pod/dressing/static/js/video_dressing.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@ let watermarkField = document.getElementById("id_watermark");
* Manage field state when modifying watermark field
*/
function handleWatermarkChange() {
if (watermarkField.value !== "") {
opacityField.disabled = false;
positionField.disabled = false;
} else {
opacityField.disabled = true;
positionField.disabled = true;
if (watermarkField) {
if (watermarkField.value !== "") {
opacityField.disabled = false;
positionField.disabled = false;
} else {
opacityField.disabled = true;
positionField.disabled = true;
}
}
}

Expand All @@ -42,7 +44,9 @@ var observer = new MutationObserver(function (mutations) {
/**
* Observe the mutations of the "value" attribute of the watermark field
*/
observer.observe(watermarkField, { attributes: true });
if(watermarkField){
observer.observe(watermarkField, { attributes: true });
}

/**
* Deselect all radio input buttons
Expand Down
103 changes: 51 additions & 52 deletions pod/dressing/templates/dressing_delete.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,61 +3,60 @@
{% load static %}

{% block breadcrumbs %}
{{ block.super }}
<li class="breadcrumb-item"><a href="{% url 'dressing:my_dressings' %}">{% trans 'My dressings' %}</a></li>
<li class="breadcrumb-item active" aria-current="page">{% trans "Deleting the dressing" %} "{{dressing.title}}"</li>
{% endblock %}

{% block page_title %}
{% blocktrans with vtitle=dressing.title %}Deleting the dressing "{{ vtitle }}"{% endblocktrans %}
{{ block.super }}
<li class="breadcrumb-item"><a href="{% url 'dressing:my_dressings' %}">{% trans 'My dressings' %}</a></li>
<li class="breadcrumb-item active" aria-current="page">{{page_title}}</li>
{% endblock %}

{% block page_content %}
<h1>{% blocktrans with vtitle=dressing.title %}Deleting the dressing "{{ vtitle }}"{% endblocktrans %}</h1>

<p>{% trans 'To delete the dressing, please check in and click send.' %}</p>
<form method="post" action="{{ request.get_full_path }}" id="dressing_delete_form" class='needs-validation' novalidate>
{% csrf_token %}
<div class="list-group">
<fieldset>
<legend>{% trans 'Agreement required' %}</legend>
{% if form.errors %}
<p class="text-danger">{% trans "One or more errors have been found in the form." %}</p>
<p>{% trans "To delete the dressing, please check in and click “Delete”." %}</p>
<form method="post" action="{{ request.get_full_path }}" id="dressing_delete_form" class='needs-validation' novalidate>
{% csrf_token %}
<div class="list-group">
<fieldset>
<legend>{% trans 'Agreement required' %}</legend>
{% if form.errors %}
<p class="text-danger">{% trans "One or more errors have been found in the form." %}</p>
{% endif %}
{% for field_hidden in form.hidden_fields %}
{{ field_hidden }}
{% endfor %}
{% for field in form.visible_fields %}
{% spaceless %}
<div class="list-group-item">
<div class="form-group {% if field.field.required %}form-group-required {% endif %}">
{{ field.errors }}
{% if "form-check-input" in field.field.widget.attrs.class %}
<div class="form-check">
{{ field }} <label for="{{ field.id_for_label }}"
class="form-check-label">{{ field.label }}</label>
</div>
{% else %}
<label for="{{ field.id_for_label }}">{{ field.label }}</label>
{% if "form-control-file" in field.field.widget.attrs.class and form.instance.dressing %}
<br>{% endif %}
{{ field }}
{% endif %}
{% for field_hidden in form.hidden_fields %}
{{ field_hidden }}
{% endfor %}
{% for field in form.visible_fields %}
{% spaceless %}
<div class="list-group-item">
<div class="form-group {% if field.field.required %}form-group-required {% endif %}">
{{ field.errors }}
{% if "form-check-input" in field.field.widget.attrs.class %}
<div class="form-check">
{{ field }} <label for="{{ field.id_for_label }}"
class="form-check-label">{{ field.label }}</label>
</div>
{% else %}
<label for="{{ field.id_for_label }}">{{ field.label }}</label>
{% if "form-control-file" in field.field.widget.attrs.class and form.instance.dressing %}
<br>{% endif %}
{{ field }}
{% endif %}
{% if field.help_text %}
<small id="{{ field.id_for_label }}Help"
class="form-text">{{ field.help_text|safe }}</small>
{% endif %}
{% if field.field.required %}
<div class="invalid-feedback">{% trans "Please provide a valid value for this field." %}</div>{% endif %}
</div>
</div>
{% endspaceless %}
{% endfor %}
<div class="text-center mt-1">
<button type="submit" class="btn btn-danger">{% trans "Delete" %}</button>
<a href="#" class="btn btn-secondary">{% trans "Back to the dressing" %}</a>
</div>
</fieldset>
{% if field.help_text %}
<small id="{{ field.id_for_label }}Help"
class="form-text">{{ field.help_text|safe }}</small>
{% endif %}
{% if field.field.required %}
<div class="invalid-feedback">{% trans "Please provide a valid value for this field." %}</div>{% endif %}
</div>
</div>
{% endspaceless %}
{% endfor %}
<div class="text-center mt-1">
<button type="submit" class="btn btn-danger">{% trans "Delete" %}</button>
<a href="{% url 'dressing:my_dressings' %}" class="btn btn-secondary">{% trans "Back" %}</a>
</div>
</form>
</fieldset>
</div>
</form>
{% endblock page_content %}

{% block collapse_page_aside %}
{% endblock collapse_page_aside %}
{% block page_aside %}
{% endblock page_aside %}
15 changes: 9 additions & 6 deletions pod/dressing/templates/dressing_edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -61,18 +61,21 @@ <h2 class="accordion-header">
</div>
<div class="text-center">
<button type="submit" class="btn btn-primary">{% trans "Save" %}</button>
<a href="{% url 'dressing:my_dressings' %}" class="btn btn-secondary">{% trans "Back" %}</a>

</div>
</form>
{% endblock page_content %}

{% block collapse_page_aside %}
{{ block.super }}
{% endblock collapse_page_aside %}
{% block page_aside %}
{% endblock page_aside %}

{% block more_script %}
<script src="/admin/jsi18n/"></script>
<script src="{% static 'admin/js/core.js' %}?ver={{VERSION}}"></script>
<script src="{% static 'js/video_dressing.js' %}?ver={{VERSION}}"></script>
<link rel="stylesheet" type="text/css" href="{% static 'admin/css/widgets.css' %}?ver={{VERSION}}" />
{{form.media}}
<script src="/admin/jsi18n/"></script>
<script src="{% static 'admin/js/core.js' %}?ver={{VERSION}}"></script>
<script src="{% static 'js/video_dressing.js' %}?ver={{VERSION}}"></script>
<link rel="stylesheet" type="text/css" href="{% static 'admin/css/widgets.css' %}?ver={{VERSION}}" />
{{form.media}}
{% endblock more_script %}
Loading

0 comments on commit 3414af4

Please sign in to comment.