Fix delete button functionality and remove confirmation dialog
- Fix JavaScript event parameter passing in channels page - Add event parameter to refreshChannel and deleteChannel functions - Update onclick handlers to pass event object - Remove confirmation dialog from channel deletion - Remove success alert, just reload page after deletion 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -26,10 +26,10 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="channel-actions">
|
||||
<button class="btn btn-secondary" onclick="refreshChannel({{ channel.id }})">
|
||||
<button class="btn btn-secondary" onclick="refreshChannel({{ channel.id }}, event)">
|
||||
Refresh Videos
|
||||
</button>
|
||||
<button class="btn btn-danger" onclick="deleteChannel({{ channel.id }}, '{{ channel.title|replace("'", "\\'") }}')">
|
||||
<button class="btn btn-danger" onclick="deleteChannel({{ channel.id }}, '{{ channel.title|replace("'", "\\'") }}', event)">
|
||||
Delete
|
||||
</button>
|
||||
<a href="/?channel={{ channel.id }}" class="btn btn-link">View Videos</a>
|
||||
@@ -49,7 +49,7 @@
|
||||
|
||||
{% block scripts %}
|
||||
<script>
|
||||
function refreshChannel(channelId) {
|
||||
function refreshChannel(channelId, event) {
|
||||
const button = event.target;
|
||||
button.disabled = true;
|
||||
button.textContent = 'Refreshing...';
|
||||
@@ -75,11 +75,7 @@
|
||||
});
|
||||
}
|
||||
|
||||
function deleteChannel(channelId, channelTitle) {
|
||||
if (!confirm(`Are you sure you want to delete "${channelTitle}"?\n\nThis will permanently remove:\n- The channel subscription\n- All video history\n- ALL downloaded video files for this channel\n\nThis action cannot be undone.`)) {
|
||||
return;
|
||||
}
|
||||
|
||||
function deleteChannel(channelId, channelTitle, event) {
|
||||
const button = event.target;
|
||||
const originalText = button.textContent;
|
||||
button.disabled = true;
|
||||
@@ -91,7 +87,6 @@
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
if (data.status === 'success') {
|
||||
alert(data.message);
|
||||
location.reload();
|
||||
} else {
|
||||
alert('Failed to delete: ' + data.message);
|
||||
|
||||
Reference in New Issue
Block a user