Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
vsabatie committed Dec 4, 2023
1 parent 754b6d4 commit 9487421
Show file tree
Hide file tree
Showing 14 changed files with 57 additions and 38 deletions.
2 changes: 1 addition & 1 deletion pod/dressing/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ class DressingDeleteForm(forms.Form):
"""Form to delete a dressing."""
agree = forms.BooleanField(
label=_("I agree"),
help_text=_("Delete dressing cannot be undo"),
help_text=_("Delete video dressing cannot be undone"),
widget=forms.CheckboxInput(),
)

Expand Down
2 changes: 1 addition & 1 deletion pod/dressing/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class Dressing(models.Model):

opacity = models.PositiveIntegerField(
default=100,
validators=[MinValueValidator(0), MaxValueValidator(100)],
validators=[MinValueValidator(1), MaxValueValidator(100)],
blank=True,
null=True,
verbose_name=_("opacity"),
Expand Down
1 change: 1 addition & 0 deletions pod/dressing/static/js/video_dressing.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/**
* @file Esup-Pod functions for the dressing form.
* @since 3.5.0
*/

/**
Expand Down
4 changes: 2 additions & 2 deletions pod/dressing/templates/dressing_edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

{% block breadcrumbs %}{{ block.super }}
<li class="breadcrumb-item">
<a href="{% url 'dressing:my_dressings' %}" title="{% trans 'My dressings' %}">
<a href="{% url 'dressing:my_dressings' %}" title="{% trans 'My dressings' %}" data-bs-toggle="tooltip" data-bs-placement="top">
{% trans 'My dressings' %}
</a>
</li>
Expand Down Expand Up @@ -64,7 +64,7 @@
{% endfor %}
</div>
<div class="text-center">
<button type="submit" class="btn btn-primary">{% trans "Save" %}</button>
<button type="submit" class="btn btn-primary" title="{% trans 'Save' %}" data-bs-toggle="tooltip" data-bs-placement="top">{% trans "Save" %}</button>
</div>
</form>
{% endblock page_content %}
Expand Down
6 changes: 3 additions & 3 deletions pod/dressing/templates/my_dressings.html
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@
</td>
<td>
<div class="d-flex justify-content-between">
<a href="{% url 'dressing:dressing_edit' dressing_id=dressing.pk %}" class="btn btn-primary" title="{% trans 'Edit'%}"><i class="bi bi-pencil-square" aria-hidden="true"></i></a>
<a href="{% url 'dressing:dressing_delete' dressing_id=dressing.pk %}" class="btn btn-danger" title="{% trans 'Delete'%}"><i class="bi bi-trash" aria-hidden="true"></i></a>
<a href="{% url 'dressing:dressing_edit' dressing_id=dressing.pk %}" class="btn btn-primary" title="{% trans 'Edit'%}" data-bs-toggle="tooltip" data-bs-placement="top"><i class="bi bi-pencil-square" aria-hidden="true"></i></a>
<a href="{% url 'dressing:dressing_delete' dressing_id=dressing.pk %}" class="btn btn-danger" title="{% trans 'Delete'%}" data-bs-toggle="tooltip" data-bs-placement="top"><i class="bi bi-trash" aria-hidden="true"></i></a>
</div>
</td>
</tr>
Expand All @@ -124,7 +124,7 @@
{% endfor %}
</tbody>
</table>
<a href="{% url 'dressing:dressing_create' %}" class="btn btn-primary">{% trans 'Add new object' %}</a>
<a href="{% url 'dressing:dressing_create' %}" class="btn btn-primary" title="{% trans 'Add new object' %}" data-bs-toggle="tooltip" data-bs-placement="top">{% trans 'Add new object' %}</a>
{% endblock page_content %}

{% block collapse_page_aside %}
Expand Down
19 changes: 10 additions & 9 deletions pod/dressing/templates/video_dressing.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@

{% block breadcrumbs %}
{{block.super}}
<li class="breadcrumb-item"><a href="{% url 'video:my_videos'%}">{% trans 'My videos' %}</a></li>
<li class="breadcrumb-item"><a href="{% url 'video:my_videos'%}" title="{% trans 'My videos' %}" data-bs-toggle="tooltip" data-bs-placement="bottom">{% trans 'My videos' %}</a></li>
<li class="breadcrumb-item">
<a href="{% url 'video:video' slug=video.slug %}" title="{{video.title}}">
<a href="{% url 'video:video' slug=video.slug %}" title="{{video.title}}" data-bs-toggle="tooltip" data-bs-placement="bottom">
{{video.title|title|truncatechars:45}}
</a>
</li>
Expand Down Expand Up @@ -66,7 +66,7 @@
<td>{{ dressing.title }}</td>
<td>
{% if dressing.watermark %}
<img id="watermark" src="{{ dressing.watermark.file.url }}" alt="Watermark">
<img id="watermark" src="{{ dressing.watermark.file.url }}" alt="{% trans 'Watermark' %}">
{% else %}
{% trans 'None' %}
{% endif %}
Expand All @@ -76,7 +76,7 @@
{{ dressing.get_position_display }}
{% else %}
<div class="text-center">
<i class="bi bi-x-lg"></i>
<i class="bi bi-x-lg" aria-hidden="true"></i>
</div>
{% endif %}
</td>
Expand All @@ -85,7 +85,7 @@
{{ dressing.opacity }}
{% else %}
<div class="text-center">
<i class="bi bi-x-lg"></i>
<i class="bi bi-x-lg" aria-hidden="true"></i>
</div>
{% endif %}
</td>
Expand All @@ -111,12 +111,13 @@
{% endfor %}
</tbody>
</table>
<button type="button" onclick="resetRadioButtons()" class="btn btn btn-secondary btn-sm" title="{% trans 'Reset' %}">{% trans "Reset" %}</button>
<button type="button" onclick="resetRadioButtons()" class="btn btn btn-secondary btn-sm" title="{% trans 'Reset' %}" data-bs-toggle="tooltip" data-bs-placement="top">{% trans "Reset" %}</button>
</form>

<span class="float-end">
<button type="submit" form="apply_dressing" class="btn btn-primary btn-sm m-2" title="{% trans 'Apply' %}">{% trans "Apply" %}</button>
<a href="{% url 'video:video' slug=video.slug %}" title="{% trans 'View the video'%}" class="btn btn btn-secondary btn-sm">
<button type="submit" form="apply_dressing" class="btn btn-primary btn-sm m-2" title="{% trans 'Apply' %}" data-bs-toggle="tooltip" data-bs-placement="top">{% trans "Apply" %}</button>
<a class="btn btn btn-secondary btn-sm" href="{% url 'dressing:my_dressings' %}" title="{% trans 'My dressings'%}" data-bs-toggle="tooltip" data-bs-placement="top"><i class="bi bi-palette" aria-hidden="true"></i>&nbsp;{% trans 'My dressings' %}</a>
<a href="{% url 'video:video' slug=video.slug %}" title="{% trans 'View the video'%}" class="btn btn btn-secondary btn-sm" data-bs-toggle="tooltip" data-bs-placement="top">
<i class="bi bi-film" aria-hidden="true"></i>&nbsp;{% trans 'Back to the video' %}
</a>
</span>
Expand All @@ -127,7 +128,7 @@
{% if access_not_allowed == True %}
{% else %}
<div class="card" id="card-managevideo">
<h2 class="card-header card-title pod-card__title h4"><i class="bi bi-gear"></i>&nbsp;{% trans "Manage video" %}</h2>
<h2 class="card-header card-title pod-card__title h4"><i class="bi bi-gear" aria-hidden="true"></i>&nbsp;{% trans "Manage video" %}</h2>
<div class="card-body card-text text-center">
{% include "videos/link_video.html" %}
</div>
Expand Down
22 changes: 20 additions & 2 deletions pod/dressing/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,16 @@


def get_position_value(position, height):
"""Obtain dimensions proportional to the video format."""
"""
Obtain dimensions proportional to the video format.
Args:
position (str): proprerty "position" of the dressing object.
height (str): height of the source video.
Returns:
str: params for the ffmpeg command.
"""
height = str(float(height) * 0.05)
if position == 'top_right':
return 'overlay=main_w-overlay_w-' + height + ':' + height
Expand All @@ -18,7 +27,16 @@ def get_position_value(position, height):


def get_dressing_input(dressing, FFMPEG_DRESSING_INPUT):
"""Function to obtain the files necessary for encoding a dressed video"""
"""
Function to obtain the files necessary for encoding a dressed video.
Args:
dressing (:class:`pod.dressing.models.Dressing`): The dressing object.
FFMPEG_DRESSING_INPUT (str): Source file for encoding.
Returns:
command (str): params for the ffmpeg command.
"""
command = ''
if dressing.watermark:
command += FFMPEG_DRESSING_INPUT % {
Expand Down
4 changes: 3 additions & 1 deletion pod/dressing/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ def video_dressing(request, slug):
else:
start_encode(video.id)

return redirect(reverse("video:video", args=(video.slug,)))

try:
current = Dressing.objects.get(videos=video)
except Dressing.DoesNotExist:
Expand Down Expand Up @@ -78,7 +80,7 @@ def dressing_edit(request, dressing_id):
_("The changes have been saved."))
form_dressing.save()
return redirect(reverse("dressing:my_dressings"))
page_title = _("Edit the dressing") + f' "{dressing_edit.title}"'
page_title = f'{_("Edit the dressing")} {dressing_edit.title}'
return render(
request,
'dressing_edit.html',
Expand Down
14 changes: 7 additions & 7 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-11-30 16:26+0100\n"
"POT-Creation-Date: 2023-12-04 11:53+0100\n"
"PO-Revision-Date: \n"
"Last-Translator: obado <[email protected]>\n"
"Language-Team: Pod Team [email protected]\n"
Expand Down Expand Up @@ -1958,7 +1958,7 @@ msgid "I agree"
msgstr "J’accepte"

#: pod/dressing/forms.py
msgid "Delete dressing cannot be undo"
msgid "Delete video dressing cannot be undone"
msgstr "La suppression de l'habillage est définitive"

#: pod/dressing/models.py
Expand Down Expand Up @@ -2031,7 +2031,8 @@ msgstr "Habillage de vidéos"

#: pod/dressing/templates/dressing_delete.html
#: pod/dressing/templates/dressing_edit.html
#: pod/dressing/templates/my_dressings.html pod/main/templates/navbar.html
#: pod/dressing/templates/my_dressings.html
#: pod/dressing/templates/video_dressing.html pod/main/templates/navbar.html
msgid "My dressings"
msgstr "Mes habillages"

Expand Down Expand Up @@ -2138,10 +2139,6 @@ msgstr "Appliquer"
msgid "The changes have been saved."
msgstr "Les modifications ont été sauvegardées."

#: pod/dressing/views.py
msgid "Edit the dressing"
msgstr "Éditer l'habillage"

#: pod/dressing/views.py
msgid "The dressing has been deleted."
msgstr "L’habillage a été supprimé."
Expand Down Expand Up @@ -8864,6 +8861,9 @@ msgstr "Résultats de la recherche"
msgid "Esup-Pod xAPI"
msgstr "xAPI Esup-Pod"

#~ msgid "Edit the dressing"
#~ msgstr "Éditer l'habillage"

#~ msgid "Dressing"
#~ msgstr "Habillage"

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-11-30 16:26+0100\n"
"POT-Creation-Date: 2023-12-04 11:53+0100\n"
"PO-Revision-Date: \n"
"Last-Translator: obado <[email protected]>\n"
"Language-Team: \n"
Expand Down
11 changes: 4 additions & 7 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-11-30 16:26+0100\n"
"POT-Creation-Date: 2023-12-04 11:53+0100\n"
"PO-Revision-Date: 2023-06-08 14:37+0200\n"
"Last-Translator: obado <[email protected]>\n"
"Language-Team: \n"
Expand Down Expand Up @@ -1860,7 +1860,7 @@ msgid "I agree"
msgstr ""

#: pod/dressing/forms.py
msgid "Delete dressing cannot be undo"
msgid "Delete video dressing cannot be undone"
msgstr ""

#: pod/dressing/models.py
Expand Down Expand Up @@ -1928,7 +1928,8 @@ msgstr ""

#: pod/dressing/templates/dressing_delete.html
#: pod/dressing/templates/dressing_edit.html
#: pod/dressing/templates/my_dressings.html pod/main/templates/navbar.html
#: pod/dressing/templates/my_dressings.html
#: pod/dressing/templates/video_dressing.html pod/main/templates/navbar.html
msgid "My dressings"
msgstr ""

Expand Down Expand Up @@ -2035,10 +2036,6 @@ msgstr ""
msgid "The changes have been saved."
msgstr ""

#: pod/dressing/views.py
msgid "Edit the dressing"
msgstr ""

#: pod/dressing/views.py
msgid "The dressing has been deleted."
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-11-30 16:26+0100\n"
"POT-Creation-Date: 2023-12-04 11:53+0100\n"
"PO-Revision-Date: 2023-02-08 15:22+0100\n"
"Last-Translator: obado <[email protected]>\n"
"Language-Team: \n"
Expand Down
2 changes: 1 addition & 1 deletion pod/main/templates/navbar.html
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ <h5 id="pod-navbar__menuuserLabel">{% if user.get_full_name != '' %}{{ user.get_
<a class="nav-item nav-link" href="{% url 'channels:my_channels' %}"><i class="bi bi-play-btn pod-nav-link-icon mx-1" aria-hidden="true"></i>{% trans 'My channels' %}</a>
{% endif %}
{% if request.user.is_staff or request.user.is_superuser %}
<a class="nav-item nav-link" href="{% url 'dressing:my_dressings' %}"><i class="bi bi-palette-fill pod-nav-link-icon mx-1" aria-hidden="true"></i>{% trans 'My dressings' %}</a>
<a class="nav-item nav-link" href="{% url 'dressing:my_dressings' %}"><i class="bi bi-palette pod-nav-link-icon mx-1" aria-hidden="true"></i>{% trans 'My dressings' %}</a>
{% endif %}
{% if request.user.is_staff and USE_PODFILE %}
<a class="nav-item nav-link" href="{% url 'podfile:home' %}"><i class="bi bi-folder pod-nav-link-icon mx-1" aria-hidden="true"></i>{% trans 'My files' %}</a>
Expand Down
4 changes: 2 additions & 2 deletions pod/video/templates/videos/link_video.html
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@
{% endif %}
{% if video.encoded and video.encoding_in_progress is False %}
{% if video.owner == request.user or request.user.is_superuser %}
<a href="{% url 'video:dressing:video_dressing' slug=video.slug %}" title="{% trans 'Dress the video'%}" class="btn btn-lg pod-btn-social p-1 m-0 ms-1">
<i class="bi bi-palette-fill" aria-hidden="true"></i></a>
<a href="{% url 'video:dressing:video_dressing' slug=video.slug %}" title="{% trans 'Dress the video'%}" class="btn btn-lg pod-btn-social p-1 m-0 ms-1" data-bs-toggle="tooltip" data-bs-placement="top">
<i class="bi bi-palette" aria-hidden="true"></i></a>
{% endif %}
{% endif %}
{% if video.encoded and video.encoding_in_progress is False %}
Expand Down

0 comments on commit 9487421

Please sign in to comment.