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:
2025-11-26 20:59:23 -05:00
parent be76f0a610
commit 0fc4475040

View File

@@ -26,10 +26,10 @@
</div> </div>
</div> </div>
<div class="channel-actions"> <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 Refresh Videos
</button> </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 Delete
</button> </button>
<a href="/?channel={{ channel.id }}" class="btn btn-link">View Videos</a> <a href="/?channel={{ channel.id }}" class="btn btn-link">View Videos</a>
@@ -49,7 +49,7 @@
{% block scripts %} {% block scripts %}
<script> <script>
function refreshChannel(channelId) { function refreshChannel(channelId, event) {
const button = event.target; const button = event.target;
button.disabled = true; button.disabled = true;
button.textContent = 'Refreshing...'; button.textContent = 'Refreshing...';
@@ -75,11 +75,7 @@
}); });
} }
function deleteChannel(channelId, channelTitle) { function deleteChannel(channelId, channelTitle, event) {
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;
}
const button = event.target; const button = event.target;
const originalText = button.textContent; const originalText = button.textContent;
button.disabled = true; button.disabled = true;
@@ -91,7 +87,6 @@
.then(response => response.json()) .then(response => response.json())
.then(data => { .then(data => {
if (data.status === 'success') { if (data.status === 'success') {
alert(data.message);
location.reload(); location.reload();
} else { } else {
alert('Failed to delete: ' + data.message); alert('Failed to delete: ' + data.message);