feat: uses web components to simplify javascript logic

This commit is contained in:
2025-07-24 17:05:19 -05:00
parent 65acd5d21b
commit 566886ef0e
6 changed files with 6 additions and 64 deletions

View File

@@ -18,7 +18,7 @@ export default class extends Controller {
active: Boolean,
};
static targets = ['list', 'count', 'episodeSelector', 'toggleButton', 'listContainer']
static targets = ['list', 'count', 'episodeSelector',]
static outlets = ['loading-icon']
options = []
@@ -37,17 +37,4 @@ export default class extends Controller {
this.episodeSelectorTarget.disabled = true;
}
}
download() {
this.element.options.forEach(option => {
const optionSelector = option.querySelector('input[type="checkbox"]');
if (true === optionSelector.checked) {
const downloadBtn = option.querySelector('button.download-btn');
const downloadBtnController = this.application.getControllerForElementAndIdentifier(downloadBtn, 'download-button');
downloadBtnController.download();
optionSelector.checked = false;
this.episodeSelectorTarget.checked = false;
}
})
}
}