fix: select all button
This commit is contained in:
@@ -21,7 +21,7 @@ export default class extends Controller {
|
||||
}
|
||||
|
||||
static outlets = ['movie-results', 'tv-results']
|
||||
static targets = ['resolution', 'codec', 'language', 'provider', 'season']
|
||||
static targets = ['resolution', 'codec', 'language', 'provider', 'season', 'selectAll']
|
||||
static values = {
|
||||
'media-type': String,
|
||||
'episodes': Array,
|
||||
@@ -29,7 +29,8 @@ export default class extends Controller {
|
||||
|
||||
connect() {
|
||||
if (this.mediaTypeValue === "tvshows") {
|
||||
this.activeFilter['season'] = 1;}
|
||||
this.activeFilter['season'] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
async movieResultsOutletConnected(outlet) {
|
||||
@@ -163,4 +164,13 @@ export default class extends Controller {
|
||||
|
||||
await results.forEach((list) => filterOperation(list, currentSeason));
|
||||
}
|
||||
|
||||
uncheckSelectAllBtn() {
|
||||
console.log('hurr');
|
||||
this.selectAllTarget.checked = false;
|
||||
}
|
||||
|
||||
selectAllEpisodes() {
|
||||
this.tvResultsOutlets.forEach((episode) => episode.selectEpisodeForDownload());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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