mirror of
https://github.com/tubearchivist/tubearchivist-frontend.git
synced 2024-11-22 11:50:14 +00:00
add delete channel to frontend
This commit is contained in:
parent
b53a1763c8
commit
ef75f6dd16
@ -38,20 +38,24 @@
|
|||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% if videos %}
|
|
||||||
<div class="info-box-item">
|
<div class="info-box-item">
|
||||||
<div>
|
<div>
|
||||||
{% if channel_info.channel_views >= 1000000 %}
|
{% if channel_info.channel_views >= 1000000 %}
|
||||||
<p>Channel views: {{ channel_info.channel_views|intword }}</p>
|
<p>Channel views: {{ channel_info.channel_views|intword }}</p>
|
||||||
{% else %}
|
{% elif channel_info.channel_views > 0 %}
|
||||||
<p>Channel views: {{ channel_info.channel_views|intcomma }}</p>
|
<p>Channel views: {{ channel_info.channel_views|intcomma }}</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<p>Total Videos archived: {{ max_hits }}</p>
|
{% if max_hits %}
|
||||||
<p>Watched: <button title="Mark all videos from {{ channel_info.channel_name }} as watched" type="button" id="{{ channel_info.channel_id }}" onclick="isWatched(this.id)">Mark as watched</button></p>
|
<p>Total Videos archived: {{ max_hits }}</p>
|
||||||
|
<p>Watched: <button title="Mark all videos from {{ channel_info.channel_name }} as watched" type="button" id="{{ channel_info.channel_id }}" onclick="isWatched(this.id)">Mark as watched</button></p>
|
||||||
|
{% endif %}
|
||||||
<p>Channel id: {{ channel_info.channel_id }}</p>
|
<p>Channel id: {{ channel_info.channel_id }}</p>
|
||||||
|
<button onclick="deleteConfirm()" id="delete-item">Delete Channel</button>
|
||||||
|
<div class="delete-confirm" id="delete-button">
|
||||||
|
<span>Delete {{ channel_info.channel_name }} including all videos? </span><button class="danger-button" onclick="deleteChannel(this)" data-id="{{ channel_info.channel_id }}">Delete</button> <button onclick="cancelDelete()">Cancel</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
|
||||||
</div>
|
</div>
|
||||||
{% if channel_info.channel_description %}
|
{% if channel_info.channel_description %}
|
||||||
<div class="info-box-item description-box">
|
<div class="info-box-item description-box">
|
||||||
|
@ -47,7 +47,7 @@
|
|||||||
<p>Video ID: {{ video.youtube_id }}</p>
|
<p>Video ID: {{ video.youtube_id }}</p>
|
||||||
<button onclick="deleteConfirm()" id="delete-item">Delete Video</button>
|
<button onclick="deleteConfirm()" id="delete-item">Delete Video</button>
|
||||||
<div class="delete-confirm" id="delete-button">
|
<div class="delete-confirm" id="delete-button">
|
||||||
<span>Are you sure? </span><button class="danger-button" onclick="deleteItem(this)" data-id="{{ video.youtube_id }}" data-redirect = "{{ video.channel.channel_id }}">Delete</button> <button onclick="cancelDelete()">Cancel</button>
|
<span>Are you sure? </span><button class="danger-button" onclick="deleteVideo(this)" data-id="{{ video.youtube_id }}" data-redirect = "{{ video.channel.channel_id }}">Delete</button> <button onclick="cancelDelete()">Cancel</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -178,18 +178,15 @@ function fsRescan() {
|
|||||||
|
|
||||||
// delete from file system
|
// delete from file system
|
||||||
function deleteConfirm() {
|
function deleteConfirm() {
|
||||||
console.log("confirm delete");
|
|
||||||
to_show = document.getElementById("delete-button");
|
to_show = document.getElementById("delete-button");
|
||||||
document.getElementById("delete-item").style.display = 'none';
|
document.getElementById("delete-item").style.display = 'none';
|
||||||
to_show.style.display = "block";
|
to_show.style.display = "block";
|
||||||
}
|
}
|
||||||
|
|
||||||
function deleteItem(button) {
|
function deleteVideo(button) {
|
||||||
var to_delete = button.getAttribute("data-id");
|
var to_delete = button.getAttribute("data-id");
|
||||||
var to_redirect = button.getAttribute("data-redirect");
|
var to_redirect = button.getAttribute("data-redirect");
|
||||||
var payload = JSON.stringify({"delete-video": to_delete});
|
var payload = JSON.stringify({"delete-video": to_delete});
|
||||||
console.log(payload);
|
|
||||||
console.log(to_redirect);
|
|
||||||
sendPost(payload);
|
sendPost(payload);
|
||||||
setTimeout(function(){
|
setTimeout(function(){
|
||||||
var redirect = "/channel/" + to_redirect;
|
var redirect = "/channel/" + to_redirect;
|
||||||
@ -198,8 +195,17 @@ function deleteItem(button) {
|
|||||||
}, 1000);
|
}, 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function deleteChannel(button) {
|
||||||
|
var to_delete = button.getAttribute("data-id");
|
||||||
|
var payload = JSON.stringify({"delete-channel": to_delete});
|
||||||
|
sendPost(payload);
|
||||||
|
setTimeout(function(){
|
||||||
|
window.location.replace("/channel/");
|
||||||
|
return false;
|
||||||
|
}, 1000);
|
||||||
|
}
|
||||||
|
|
||||||
function cancelDelete() {
|
function cancelDelete() {
|
||||||
console.log("cancel delete");
|
|
||||||
document.getElementById("delete-button").style.display = 'none';
|
document.getElementById("delete-button").style.display = 'none';
|
||||||
document.getElementById("delete-item").style.display = 'block';
|
document.getElementById("delete-item").style.display = 'block';
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user