chore: Prepare django for edit_chapters

This commit is contained in:
Yiannis Christodoulou 2025-07-27 23:23:42 +03:00
parent da656b46e5
commit 0d44f040d6
4 changed files with 1795 additions and 34 deletions

View File

@ -13,6 +13,12 @@ cd frontend-tools/video-editor
yarn build:django yarn build:django
cd ../../ cd ../../
# Build chapter editor package
echo "Building chapters editor package..."
cd frontend-tools/chapters-editor
yarn build:django
cd ../../
# Build video js package # Build video js package
echo "Building video js package..." echo "Building video js package..."
cd frontend-tools/video-js cd frontend-tools/video-js

1744
files/views.py Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,44 +1,47 @@
{% extends "base.html" %} {% extends "base.html" %}
{% load crispy_forms_tags %} {% load crispy_forms_tags %}
{% load static %} {% load static %}
{% block headtitle %}Edit video chapters - {{PORTAL_NAME}}{% endblock headtitle %} {% block headtitle %}Edit video chapters - {{PORTAL_NAME}}{% endblock headtitle %}
{% block topimports %} {% block topimports %}
<link href="{% static "video_editor/video-editor.css" %}" rel="preload" as="style"> <link href="{% static "chapters_editor/chapters-editor.css" %}" rel="preload" as="style">
<link href="{% static "video_editor/video-editor.css" %}" rel="stylesheet"> <link href="{% static "chapters_editor/chapters-editor.css" %}" rel="stylesheet">
<script src="{% static 'chapters_editor/chapters-editor.js' %}"></script>
<script> <script>
window.MEDIA_DATA = { window.MEDIA_DATA = {
videoUrl: "", videoUrl: "{{ media_file_path }}",
mediaId: "{{ media_id }}", mediaId: "{{ media_object.friendly_token }}",
chapters: [ redirectURL: "{{ media_object.get_absolute_url }}",
{ redirectUserMediaURL: "{{ media_object.user.get_absolute_url }}",
id: "1", chapters: [
title: "Chapter AAA", {
timestamp: 0 id: '1',
}, title: 'Chapter AAA',
{ timestamp: 0,
id: "2", },
title: "Chapter BBB", {
timestamp: 10 id: '2',
}, title: 'Chapter BBB',
{ timestamp: 10,
id: "3", },
title: "Chapter CCC", {
timestamp: 20 id: '3',
} title: 'Chapter CCC',
] timestamp: 20,
}; },
],
};
</script> </script>
<script src="{% static 'video_editor/video-editor.js' %}"></script>
{%endblock topimports %} {%endblock topimports %}
{% block innercontent %} {% block innercontent %}
<div class="user-action-form-wrap">
<div class="user-action-form-wrap"> {% include "cms/media_nav.html" with active_tab="chapters" %}
{% include "cms/media_nav.html" with active_tab="chapters" %} <div class="user-action-form-inner" style="max-width: 1280px; margin: 0 auto; padding: 20px; border-radius: 8px; box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.1);">
<div class="user-action-form-inner" style="max-width: 1280px; margin: 0 auto; padding: 20px; border-radius: 8px; box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.1);"> <div id="chapters-editor-root"></div>
<div id="video-editor-chapters-root"></div>
</div>
</div> </div>
</div>
{% endblock innercontent %} {% endblock innercontent %}

View File

@ -25,6 +25,14 @@
{{ "Captions" | custom_translate:LANGUAGE_CODE}} {{ "Captions" | custom_translate:LANGUAGE_CODE}}
</a> </a>
</li> </li>
<li style="display: inline-block">
<a
href="{% url 'edit_chapters' %}?m={{media_object.friendly_token}}"
style="text-decoration: none; {% if active_tab == 'chapters' %}font-weight: bold; color: #333; padding-bottom: 3px; border-bottom: 2px solid #333;{% else %}color: #666;{% endif %}"
>
Chapters
</a>
</li>
{% comment %} {% comment %}
<li style="display: inline-block;"> <li style="display: inline-block;">
<a href="{% url 'edit_chapters' %}?m={{media_object.friendly_token}}" <a href="{% url 'edit_chapters' %}?m={{media_object.friendly_token}}"