Bulk actions support (#1418)

This commit is contained in:
Markos Gogoulos
2025-11-11 11:32:54 +02:00
committed by GitHub
parent 2a0cb977f2
commit e80590a3aa
160 changed files with 14100 additions and 1797 deletions

View File

@@ -5,10 +5,9 @@
{% block headtitle %}Edit video chapters - {{PORTAL_NAME}}{% endblock headtitle %}
{% block topimports %}
<link href="{% static "chapters_editor/chapters-editor.css?v={{ VERSION }}" %}" rel="preload" as="style">
<link href="{% static "chapters_editor/chapters-editor.css?v={{ VERSION }}" %}" rel="stylesheet">
<script src="{% static 'chapters_editor/chapters-editor.js?v={{ VERSION }}' %}"></script>
<link href="{% static 'chapters_editor/chapters-editor.css' %}?v={{ VERSION }}" rel="preload" as="style">
<link href="{% static 'chapters_editor/chapters-editor.css' %}?v={{ VERSION }}" rel="stylesheet">
<script src="{% static 'chapters_editor/chapters-editor.js' %}?v={{ VERSION }}"></script>
<script>
window.MEDIA_DATA = {

View File

@@ -5,10 +5,9 @@
{% block headtitle %}Edit video - {{PORTAL_NAME}}{% endblock headtitle %}
{% block topimports %}
<link href="{% static "video_editor/video-editor.css?v={{ VERSION }}" %}" rel="preload" as="style">
<link href="{% static "video_editor/video-editor.css?v={{ VERSION }}" %}" rel="stylesheet">
<script src="{% static 'video_editor/video-editor.js?v={{ VERSION }}' %}"></script>
<link href="{% static 'video_editor/video-editor.css' %}?v={{ VERSION }}" rel="preload" as="style">
<link href="{% static 'video_editor/video-editor.css' %}?v={{ VERSION }}" rel="stylesheet">
<script src="{% static 'video_editor/video-editor.js' %}?v={{ VERSION }}"></script>
<script>
window.MEDIA_DATA = {

View File

@@ -14,8 +14,8 @@
{% endblock headermeta %}
{% block topimports %}
<link href="{% static "css/profile-media.css" %}" rel="preload" as="style">
<link href="{% static "css/profile-media.css" %}" rel="stylesheet">
<link href="{% static "css/profile-media.css" %}?v={{ VERSION }}" rel="preload" as="style">
<link href="{% static "css/profile-media.css" %}?v={{ VERSION }}" rel="stylesheet">
{%endblock topimports %}
{% block innercontent %}

View File

@@ -12,6 +12,146 @@
{{ form.as_p }}
<button class="primaryAction" type="submit">Update Profile</button>
</form>
{% if is_author %}
<div class="danger-zone">
<h2>Danger Zone</h2>
<div class="danger-zone-content">
<div class="danger-zone-info">
<h3>Delete Account</h3>
<p>This will permanently remove all data, including media and playlists.</p>
</div>
<button class="btn-danger" id="delete-account-btn" type="button">Delete Account</button>
</div>
</div>
{% endif %}
</div>
</div>
<style>
.danger-zone {
margin-top: 60px;
padding-top: 40px;
border-top: 2px solid #e0e0e0;
}
.danger-zone h2 {
color: #d32f2f;
font-size: 20px;
margin-bottom: 20px;
font-weight: 600;
}
.danger-zone-content {
display: flex;
align-items: center;
justify-content: space-between;
padding: 20px;
border: 2px solid #ffcdd2;
border-radius: 8px;
background-color: #ffebee;
gap: 20px;
}
.dark_theme .danger-zone-content {
background-color: #3a1f1f;
border-color: #5a2d2d;
}
.danger-zone-info h3 {
font-size: 16px;
font-weight: 600;
margin: 0 0 8px 0;
color: #d32f2f;
}
.danger-zone-info p {
font-size: 14px;
margin: 0;
color: #666;
line-height: 1.5;
}
.dark_theme .danger-zone-info p {
color: #ccc;
}
.btn-danger {
padding: 10px 24px;
background-color: #d32f2f;
color: white;
border: none;
border-radius: 4px;
font-size: 14px;
font-weight: 600;
cursor: pointer;
white-space: nowrap;
transition: all 0.2s ease;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
.btn-danger:hover {
background-color: #b71c1c;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
transform: translateY(-1px);
}
.btn-danger:active {
transform: translateY(0);
}
@media (max-width: 768px) {
.danger-zone-content {
flex-direction: column;
align-items: flex-start;
}
.btn-danger {
width: 100%;
}
}
</style>
<script>
document.getElementById('delete-account-btn').addEventListener('click', function() {
const username = '{{ user.username }}';
const confirmText = 'Are you sure you want to delete your account?\n\n' +
'This action CANNOT be undone. This will permanently delete:\n' +
'• Your profile and all personal information\n' +
'• All your uploaded media\n' +
'• All your playlists\n' +
'• All your comments and interactions\n\n' +
'Type "DELETE" to confirm:';
const userInput = prompt(confirmText);
if (userInput === 'DELETE') {
const csrfToken = document.querySelector('[name=csrfmiddlewaretoken]').value;
fetch('/api/v1/users/' + username, {
method: 'DELETE',
headers: {
'X-CSRFToken': csrfToken,
},
})
.then(function(response) {
if (response.ok) {
alert('Your account has been deleted successfully. You will be redirected to the home page.');
window.location.href = '/';
} else {
return response.json().then(function(data) {
throw new Error(data.detail || 'Failed to delete account.');
});
}
})
.catch(function(error) {
alert('Error deleting account: ' + error.message);
console.error('Error deleting account:', error);
});
} else if (userInput !== null) {
alert('Account deletion cancelled. You must type "DELETE" exactly to confirm.');
}
});
</script>
{% endblock innercontent %}

View File

@@ -14,7 +14,6 @@
{% endblock headermeta %}
{% block topimports %}
{% load static %}
<link href="{% static "css/profile-media.css" %}?v={{ VERSION }}" rel="preload" as="style">
<link href="{% static "css/profile-media.css" %}?v={{ VERSION }}" rel="stylesheet">
{%endblock topimports %}
@@ -26,12 +25,9 @@ No such user
{% endblock %}
{% block content %}
{% if user %}
<div id="page-profile-media"></div>
{% endif %}
{% if user %}<div id="page-profile-shared-by-me"></div>{% endif %}
{% endblock %}
{% block bottomimports %}
<script src="{% static "js/profile-media.js" %}?v={{ VERSION }}"></script>
<script src="{% static "js/profile-shared-by-me.js" %}?v={{ VERSION }}"></script>
{% endblock bottomimports %}

View File

@@ -14,7 +14,6 @@
{% endblock headermeta %}
{% block topimports %}
{% load static %}
<link href="{% static "css/profile-media.css" %}?v={{ VERSION }}" rel="preload" as="style">
<link href="{% static "css/profile-media.css" %}?v={{ VERSION }}" rel="stylesheet">
{%endblock topimports %}
@@ -26,9 +25,9 @@ No such user
{% endblock %}
{% block content %}
{% if user %}<div id="page-profile-media"></div>{% endif %}
{% if user %}<div id="page-profile-shared-with-me"></div>{% endif %}
{% endblock %}
{% block bottomimports %}
<script src="{% static "js/profile-media.js" %}?v={{ VERSION }}"></script>
<script src="{% static "js/profile-shared-with-me.js" %}?v={{ VERSION }}"></script>
{% endblock bottomimports %}