From b7e9a4e0dfc749d649c171c19fcc306166ea2aa1 Mon Sep 17 00:00:00 2001 From: Collin Heist Date: Tue, 29 Oct 2024 22:42:04 -0600 Subject: [PATCH] [123] Load card via Card ID, not Episode ID, within UI --- app/templates/js/series.js | 25 +++++++++++-------------- modules/ref/version_webui | 2 +- 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/app/templates/js/series.js b/app/templates/js/series.js index 4c0a19c4..ee44c225 100755 --- a/app/templates/js/series.js +++ b/app/templates/js/series.js @@ -1132,9 +1132,9 @@ function getCardData( } // Add item IDs - preview.querySelector('.image').id = `card-episode${card.episode_id}`; - preview.querySelector('.popup').id = `card-popup-episode${card.episode_id}`; - preview.querySelector('.popup').dataset.episodeId = card.episode_id; + preview.querySelector('.image').id = `card${card.id}`; + preview.querySelector('.popup').id = `card${card.id}-popup`; + preview.querySelector('.popup').dataset.id = card.id; // Populate popup // Populate header text @@ -2130,23 +2130,20 @@ function loadCards(interfaceId, libraryName, reload=false) { } /** - * Submit an API request to reload the Title Cards for the Episode of the given - * ID. - * @param {number} episodeId ID of the Episode to load the Title Cards of. + * Submit an API request to reload the Title Card with the given ID. + * @param {number} cardId ID of the Card to load. */ -function loadEpisodeCards(episodeId) { +function loadCard(cardId) { $.ajax({ type: 'PUT', - url: `/api/cards/episode/${episodeId}/load`, - /** - * Card reloaded. Change the loaded icon and update the tooltip text. - */ + url: `/api/cards/card/${cardId}/load`, + /** Card reloaded. Change the loaded icon and update the tooltip text. */ success: () => { showInfoToast('Loaded Title Card'); - $(`#card-popup-episode${episodeId} .header i`) + $(`#card${cardId}-popup .header i`) .toggleClass('red times circle', false) .toggleClass('green check square outline', true); - document.querySelector(`#card-popup-episode${episodeId} .header [data-value="unloaded"]`).dataset.tooltip = 'Card is loaded'; + document.querySelector(`#card${cardId}-popup .header [data-value="unloaded"]`).dataset.tooltip = 'Card is loaded'; }, error: response => showErrorToast({title: 'Error Loading Title Card', response}), }); @@ -2159,7 +2156,7 @@ function loadEpisodeCards(episodeId) { function deleteSeries() { $.ajax({ type: 'DELETE', - url: '/api/series/series/{{series.id}}', + url: '/api/series/series/{{ series.id }}', success: () => window.location.href = '/', error: response => showErrorToast({title: 'Error Deleting Series', response}), }); diff --git a/modules/ref/version_webui b/modules/ref/version_webui index 82fa8604..b4ef398b 100755 --- a/modules/ref/version_webui +++ b/modules/ref/version_webui @@ -1 +1 @@ -v2.0-alpha.12.1-webui122 \ No newline at end of file +v2.0-alpha.12.1-webui123 \ No newline at end of file