Skip to content

Commit

Permalink
Fix conflict and merge translation
Browse files Browse the repository at this point in the history
  • Loading branch information
LoicBonavent committed Aug 29, 2023
2 parents 1c029ad + bb677ea commit 25e0c94
Show file tree
Hide file tree
Showing 74 changed files with 1,097 additions and 536 deletions.
1 change: 1 addition & 0 deletions AUTHORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,4 @@ Pictures credits
----------------------------
* default.svg: adapted from Play button Icon by [Freepik](https://www.freepik.com/free-vector) - Freepik License
* cookie.svg: [Broken oatmeal cookie created by pch.vector](https://www.freepik.com/vectors/logo) - Freepik License
* default-playlist.svg: Music, Note, Musical Note by [krzysztof-m](https://pixabay.com/fr/users/1363864/) - [Pixabay free for use & download licence](https://pixabay.com/fr/service/terms/)
2 changes: 2 additions & 0 deletions pod/completion/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ def __init__(self, *args, **kwargs):
"""Initialize fields."""
super(ContributorForm, self).__init__(*args, **kwargs)
self.fields["video"].widget = HiddenInput()
self.fields["name"].widget.attrs["autocomplete"] = "name"
self.fields["email_address"].widget.attrs["autocomplete"] = "email"
self.fields = add_placeholder_and_asterisk(self.fields)

class Meta(object):
Expand Down
5 changes: 4 additions & 1 deletion pod/completion/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,10 @@
LANG_CHOICES = getattr(
settings,
"LANG_CHOICES",
((" ", PREF_LANG_CHOICES), ("----------", ALL_LANG_CHOICES)),
(
(_("-- Frequently used languages --"), PREF_LANG_CHOICES),
(_("-- All languages --"), ALL_LANG_CHOICES),
),
)
__LANG_CHOICES_DICT__ = {
key: value for key, value in LANG_CHOICES[0][1] + LANG_CHOICES[1][1]
Expand Down
9 changes: 6 additions & 3 deletions pod/completion/static/js/completion.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@ document.addEventListener("submit", (e) => {
e.target.id != "form_new_document" &&
e.target.id != "form_new_track" &&
e.target.id != "form_new_overlay" &&
!e.target.matches(".form_change")
!e.target.matches(".form_change") &&
!e.target.matches(".form_delete")
)
return;

Expand Down Expand Up @@ -374,8 +375,10 @@ function refresh_list(data, form, list) {
document.querySelectorAll("a.title").forEach(function (element) {
element.style.display = "initial";
});
document.getElementById("enrich_player").innerHTML = data.player;
documentL.getElementById(list).innerHTML = data.list_data;
if (data.player) {
document.getElementById("enrich_player").innerHTML = data.player;
}
document.getElementById(list).innerHTML = data.list_data;
}

// Check fields
Expand Down
5 changes: 4 additions & 1 deletion pod/completion/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@
LANG_CHOICES = getattr(
settings,
"LANG_CHOICES",
((" ", PREF_LANG_CHOICES), ("----------", ALL_LANG_CHOICES)),
(
(_("-- Frequently used languages --"), PREF_LANG_CHOICES),
(_("-- All languages --"), ALL_LANG_CHOICES),
),
)
__LANG_CHOICES_DICT__ = {
key: value for key, value in LANG_CHOICES[0][1] + LANG_CHOICES[1][1]
Expand Down
5 changes: 4 additions & 1 deletion pod/live/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,10 @@
LANG_CHOICES = getattr(
settings,
"LANG_CHOICES",
((" ", __PREF_LANG_CHOICES__), ("----------", __ALL_LANG_CHOICES__)),
(
(_("-- Frequently used languages --"), __PREF_LANG_CHOICES__),
(_("-- All languages --"), __ALL_LANG_CHOICES__),
),
)
MEDIA_URL = getattr(settings, "MEDIA_URL", "/media/")
LIVE_TRANSCRIPTIONS_FOLDER = getattr(
Expand Down
6 changes: 5 additions & 1 deletion pod/live/static/css/event.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,8 @@
}
.video-js .vjs-remaining-time {
display: none;
}
}
.filter-event-img {
max-height:32px;
max-width:32px;
}
4 changes: 4 additions & 0 deletions pod/live/static/css/event_list.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.event-card-container {
min-width: 12rem;
min-height: 11rem;
}
123 changes: 123 additions & 0 deletions pod/live/static/js/filter_aside_event_list.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
let loader = document.querySelector(".lds-ring");
let checkedInputs = [];

/**
* Enable /disable all checkboxes.
*
* @param {boolean} value
*/
function disableCheckboxes(value) {
document.querySelectorAll("input[type=checkbox]").forEach((checkbox) => {
checkbox.disabled = value;
});
}

/**
* Return url with filters params.
*
* @returns {string}
*/
function getUrlForRefresh() {
let newUrl = window.location.pathname + "?";

checkedInputs.forEach((input) => {
newUrl += input.name + "=" + input.value + "&";
});

// Add page parameter
newUrl += "page=1";
return newUrl;
}

/**
* Remove loader height.
*
* @param height
* @returns {number}
*/
function getHeightMinusLoader(height) {
let loader_style = getComputedStyle(loader);
let loader_height = loader_style.height;
loader_height = loader_height.replace("px", "");
return height - loader_height;
}

/**
* Async request to refresh view with filtered events list.
*/
function refreshEvents() {
// Erase list and enable loader
const events_content = document.getElementById("events_content");
let width = events_content.offsetWidth;
let height = getHeightMinusLoader(events_content.offsetHeight);

events_content.innerHTML =
"<div style='height: " + height + "px; width:" + width + "px'></div>";
loader.classList.add("show");

let url = getUrlForRefresh();

// Async GET request wth parameters by fetch method
fetch(url, {
method: "GET",
headers: {
"X-CSRFToken": "{{ csrf_token }}",
"X-Requested-With": "XMLHttpRequest",
},
cache: "no-store",
})
.then((response) => response.text())
.then((data) => {
// parse data into html and replace videos list
let parser = new DOMParser();
let html = parser.parseFromString(data, "text/html").body;
events_content.outerHTML = html.innerHTML;

// change url with params sent
window.history.pushState({}, "", url);
})
.catch(() => {
events_content.innerHTML = gettext("An Error occurred while processing.");
})
.finally(() => {
// Re-enable inputs and dismiss loader
disableCheckboxes(false);
loader.classList.remove("show");
});
}

/**
* Check or uncheck checkbox regarding url params.
*
* @param el
*/
function setCheckboxStatus(el) {
let currentUrl = window.location.href;
el.checked = currentUrl.includes("type=" + el.value + "&");
}

/**
* Add listener to refresh events list on checkbox status change.
*
* @param el
*/
function addCheckboxListener(el) {
el.addEventListener("change", () => {
checkedInputs = [];
disableCheckboxes(true);
document
.querySelectorAll("#collapseFilterType input[type=checkbox]:checked")
.forEach((e) => {
checkedInputs.push(e);
});
refreshEvents();
});
}

// On page load
document
.querySelectorAll("#collapseFilterType input[type=checkbox]")
.forEach((el) => {
setCheckboxStatus(el);
addCheckboxListener(el);
});
16 changes: 8 additions & 8 deletions pod/live/templates/live/direct.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ <h3 id="livename" data-broadcasterid={{ broadcaster.id }}><i
<a class="btn btn-primary"
href="{% url 'live:event_edit' %}?broadcaster_id={{ broadcaster.id }}&building_id={{ broadcaster.building.id }}"
title="{% trans 'Plan an event' %}">
<i class="bi bi-plus pod-add"></i>
<i class="bi bi-plus pod-add" aria-hidden="true"></i>
<span>{% trans "Plan an event" %}</span>
</a>
</div>
Expand Down Expand Up @@ -65,7 +65,7 @@ <h3 id="livename" data-broadcasterid={{ broadcaster.id }}><i
{% if broadcaster.is_recording %}
<div class="card text-white bg-danger mb-3">
<div class="card-body">
<i class="bi bi-exclamation-octagon"></i>{% blocktrans %}Recording in progress{% endblocktrans %}
<i class="bi bi-exclamation-octagon" aria-hidden="true"></i>{% blocktrans %}Recording in progress{% endblocktrans %}
</div>
</div>
{% else %}
Expand Down Expand Up @@ -93,20 +93,20 @@ <h3>{% trans "Next events" %}</h3>
{% if request.user.is_superuser %}
<div class="card" id="card-managevideo">
<h2 class="card-header card-title pod-card__title h4">
<i class="bi bi-gear"></i>{% trans "Manage broadcaster" %}
<i class="bi bi-gear" aria-hidden="true"></i>{% trans "Manage broadcaster" %}
</h2>
<div class="card-body card-text text-center">
<a href="{% url 'admin:live_broadcaster_change' broadcaster.id %}" title="{% trans 'Edit' %}"
class="btn pod-btn-social p1 m-0 ms-1">
<i class="bi bi-pencil-square"></i>
<i class="bi bi-pencil-square" aria-hidden="true"></i>
</a>
</div>
</div>
{% endif %}

<div class="card card-body p-2 mt-1" id="card-livebuilding">
<h2 class="card-title pod-card__title h4">
<i class="bi bi-broadcast"></i>
<i class="bi bi-broadcast" aria-hidden="true"></i>
<span class="ms-1 broadcaster-name">
{{ broadcaster.building.name }}
</span>
Expand All @@ -127,12 +127,12 @@ <h2 class="card-title pod-card__title h4">
<p class="card-text broadcaster-status">
{% if otherbroadcaster.status %}
<a href="{% url 'live:direct' slug=otherbroadcaster.slug %}" class="live_on">
<i class="bi bi-cast pe-2"></i>
<i class="bi bi-cast pe-2" aria-hidden="true"></i>
{{ otherbroadcaster.name }}
</a>
{% else %}
<span class="live_off">
<i class="bi bi-cast pe-2"></i>
<i class="bi bi-cast pe-2" aria-hidden="true"></i>
{{ otherbroadcaster.name }} ({% trans "no broadcast in progress" %})
</span>
{% endif %}
Expand All @@ -146,7 +146,7 @@ <h2 class="card-title pod-card__title h4">
<p class="card-text">
<small class="text-muted">
<a href='{{ broadcaster.building.gmapurl }}' title="{% trans 'access map' %}" target="_blank">
<i class="bi bi-gear pe-2"></i>
<i class="bi bi-gear pe-2" aria-hidden="true"></i>
<span class="access-map">{% trans "access map" %}</span>
</a>
</small>
Expand Down
2 changes: 1 addition & 1 deletion pod/live/templates/live/directs.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
{% block page_title %}{{building.name}}{% endblock %}

{% block page_content %}
<h3><i class="bi bi-broadcast"></i>&nbsp;{{building.name}}</h3>
<h3><i class="bi bi-broadcast" aria-hidden="true"></i>&nbsp;{{building.name}}</h3>
{% if building.headband %}
<img class="rounded mx-auto d-block img-fluid img-responsive img-thumbnail" src="{{building.get_headband_url}}" alt="{{building.name}}" loading="lazy">
{% endif %}
Expand Down
10 changes: 5 additions & 5 deletions pod/live/templates/live/directs_all.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
{% block page_title %}{% trans "Lives" %}{% endblock %}

{% block page_content %}
<h3><i class="bi bi-broadcast"></i>&nbsp;{% trans "Lives" %}</h3>
<h3><i class="bi bi-broadcast" aria-hidden="true"></i>&nbsp;{% trans "Lives" %}</h3>
<div class="row">

{% for building in buildings %}
Expand All @@ -29,20 +29,20 @@ <h5 class="card-title pod-card__title">
<span class="building-name">
{{building.name}}
</span>
<a href="{% url 'live:directs' building_id=building.id %}"><i class="bi bi-eye"></i></a>
<a href="{% url 'live:directs' building_id=building.id %}"><i class="bi bi-eye" aria-hidden="true"></i></a>
</h5>
<div class="card-text">
{% for broadcaster in building.broadcaster_set.all %}
<p class="card-text-item">
{% if broadcaster.status %}<a href="{% url 'live:direct' slug=broadcaster.slug %}" class="live_on"><i class="bi bi-lock"></i>&nbsp;{{broadcaster.name}} </a>
{% else %}<span class="live_off"><i class="bi bi-cast"></i>&nbsp;{{broadcaster.name}} ({% trans "no broadcast in progress" %})</span>{% endif %}
{% if broadcaster.status %}<a href="{% url 'live:direct' slug=broadcaster.slug %}" class="live_on"><i class="bi bi-lock" aria-hidden="true"></i>&nbsp;{{broadcaster.name}} </a>
{% else %}<span class="live_off"><i class="bi bi-cast" aria-hidden="true"></i>&nbsp;{{broadcaster.name}} ({% trans "no broadcast in progress" %})</span>{% endif %}
</p>
{% empty %}
<p class="card-text-item">{% trans "Sorry, no lives found." %}</p>
{% endfor %}
</div>
{% if building.gmapurl %}
<p class="card-text building-gmapurl"><small class="text-muted"><a href='{{building.gmapurl}}' title="{% trans 'access map' %}" target="_blank"><i class="bi bi-geo-alt"></i> <span class="ms-1 access-map">
<p class="card-text building-gmapurl"><small class="text-muted"><a href='{{building.gmapurl}}' title="{% trans 'access map' %}" target="_blank"><i class="bi bi-geo-alt" aria-hidden="true"></i> <span class="ms-1 access-map">
{% trans "access map" %}
</span></a></small></p>
{% endif %}
Expand Down
2 changes: 1 addition & 1 deletion pod/live/templates/live/event-all-info.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
{% if event.description %}
<li class="nav-item dropdown" >
<a class="nav-link active show" id="summary-tab" data-toggle="tab" href="#summary" role="tab" aria-selected="true" title="{% trans 'Summary' %}">
<i class="bi bi-justify"></i>
<i class="bi bi-justify" aria-hidden="true"></i>
</a>
</li>
{% endif %}
Expand Down
Loading

0 comments on commit 25e0c94

Please sign in to comment.