Skip to content

Commit

Permalink
fix user can generate link even link already generated
Browse files Browse the repository at this point in the history
  • Loading branch information
Fauzanmhr committed Oct 28, 2024
1 parent c4ffe9e commit 94f7eb7
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions views/detail.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,15 @@
<span><%= anime.batch.title %></span>
<!-- Download Button with Icon -->
<button id="generateLinkBtn" class="btn btn-dark btn-sm" data-batch-id="<%= anime.batch.batchId %>">
<i class="bi bi-download me-1"></i>Generate Link
</button>
<% if (!anime.batch.linkGenerated) { %>
<button id="generateLinkBtn" class="btn btn-dark btn-sm" data-batch-id="<%= anime.batch.batchId %>">
<i class="bi bi-download me-1"></i>Generate Link
</button>
<% } else { %>
<button class="btn btn-dark btn-sm" disabled>
<i class="bi bi-download me-1"></i>Link Generated
</button>
<% } %>
<% } else { %>
<!-- No Batch Available Message -->
<span class="text-muted">No batch available at the moment.</span>
Expand Down Expand Up @@ -166,6 +172,10 @@
// Show the download options
document.getElementById('downloadOptions').style.display = 'block';
// Disable the button after generating the link
this.disabled = true;
this.textContent = 'Link Generated';
} else {
alert('Download options not available.');
}
Expand Down

0 comments on commit 94f7eb7

Please sign in to comment.