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>
|
||||
</div>
|
||||
</div>
|
||||
{% if videos %}
|
||||
<div class="info-box-item">
|
||||
<div>
|
||||
{% if channel_info.channel_views >= 1000000 %}
|
||||
<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>
|
||||
{% endif %}
|
||||
<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>
|
||||
{% if max_hits %}
|
||||
<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>
|
||||
<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>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% if channel_info.channel_description %}
|
||||
<div class="info-box-item description-box">
|
||||
|
@ -47,7 +47,7 @@
|
||||
<p>Video ID: {{ video.youtube_id }}</p>
|
||||
<button onclick="deleteConfirm()" id="delete-item">Delete Video</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>
|
||||
|
@ -178,18 +178,15 @@ function fsRescan() {
|
||||
|
||||
// delete from file system
|
||||
function deleteConfirm() {
|
||||
console.log("confirm delete");
|
||||
to_show = document.getElementById("delete-button");
|
||||
document.getElementById("delete-item").style.display = 'none';
|
||||
to_show.style.display = "block";
|
||||
}
|
||||
|
||||
function deleteItem(button) {
|
||||
function deleteVideo(button) {
|
||||
var to_delete = button.getAttribute("data-id");
|
||||
var to_redirect = button.getAttribute("data-redirect");
|
||||
var payload = JSON.stringify({"delete-video": to_delete});
|
||||
console.log(payload);
|
||||
console.log(to_redirect);
|
||||
sendPost(payload);
|
||||
setTimeout(function(){
|
||||
var redirect = "/channel/" + to_redirect;
|
||||
@ -198,8 +195,17 @@ function deleteItem(button) {
|
||||
}, 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() {
|
||||
console.log("cancel delete");
|
||||
document.getElementById("delete-button").style.display = 'none';
|
||||
document.getElementById("delete-item").style.display = 'block';
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user