fix: select all button
This commit is contained in:
@@ -15,7 +15,7 @@ export default class extends Controller {
|
||||
active: Boolean,
|
||||
};
|
||||
|
||||
static targets = ['list', 'count']
|
||||
static targets = ['list', 'count', 'episodeSelector']
|
||||
static outlets = ['loading-icon']
|
||||
|
||||
options = []
|
||||
@@ -35,6 +35,8 @@ export default class extends Controller {
|
||||
if (this.options.length > 0) {
|
||||
this.options.forEach((option) => option.querySelector('.download-btn').dataset['title'] = this.titleValue);
|
||||
this.options[0].querySelector('input[type="checkbox"]').checked = true;
|
||||
} else {
|
||||
this.episodeSelectorTarget.disabled = true;
|
||||
}
|
||||
this.optionsLoaded = true;
|
||||
this.loadingIconOutlet.increaseCount();
|
||||
@@ -52,6 +54,7 @@ export default class extends Controller {
|
||||
|
||||
setInActive() {
|
||||
this.activeValue = false;
|
||||
this.episodeSelectorTarget.checked = false;
|
||||
this.element.classList.add('hidden');
|
||||
}
|
||||
|
||||
@@ -59,6 +62,12 @@ export default class extends Controller {
|
||||
return this.activeValue;
|
||||
}
|
||||
|
||||
selectEpisodeForDownload() {
|
||||
if (true === this.isActive() && this.episodeSelectorTarget.disabled === false) {
|
||||
this.episodeSelectorTarget.checked = !this.episodeSelectorTarget.checked;
|
||||
}
|
||||
}
|
||||
|
||||
toggleList() {
|
||||
this.listTarget.classList.toggle('hidden');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user