diff --git a/src/Ombi/ClientApp/app/interfaces/ISearchTvResult.ts b/src/Ombi/ClientApp/app/interfaces/ISearchTvResult.ts index bbfef5415..477cc6dcd 100644 --- a/src/Ombi/ClientApp/app/interfaces/ISearchTvResult.ts +++ b/src/Ombi/ClientApp/app/interfaces/ISearchTvResult.ts @@ -37,6 +37,7 @@ export interface ISearchTvResult { fullyAvailable: boolean; partlyAvailable: boolean; background: any; + open: boolean; // THIS IS FOR THE UI } export interface ITvRequestViewModel { diff --git a/src/Ombi/ClientApp/app/search/tvsearch.component.html b/src/Ombi/ClientApp/app/search/tvsearch.component.html index 564b5ffde..48e83578d 100644 --- a/src/Ombi/ClientApp/app/search/tvsearch.component.html +++ b/src/Ombi/ClientApp/app/search/tvsearch.component.html @@ -42,8 +42,8 @@
{{ 'Search.NoResults' | translate }}
-
-
+
+
-
+


- - +
diff --git a/src/Ombi/ClientApp/app/search/tvsearch.component.ts b/src/Ombi/ClientApp/app/search/tvsearch.component.ts index 8af569d37..754d11e24 100644 --- a/src/Ombi/ClientApp/app/search/tvsearch.component.ts +++ b/src/Ombi/ClientApp/app/search/tvsearch.component.ts @@ -58,30 +58,9 @@ export class TvSearchComponent implements OnInit { this.defaultPoster = "../../.." + base + "/images/default_tv_poster.png"; } } - public openClosestTab(el: any) { + public openClosestTab(node: ISearchTvResult,el: any) { el.preventDefault(); - const rowclass = "undefined ng-star-inserted"; - el = el.toElement || el.relatedTarget || el.target; - while (el.className !== rowclass) { - // Increment the loop to the parent node until we find the row we need - el = el.parentNode; - } - // At this point, the while loop has stopped and `el` represents the element that has - // the class you specified - - // Then we loop through the children to find the caret which we want to click - const caretright = "fa-caret-right"; - const caretdown = "fa-caret-down"; - for (const value of el.children) { - // the caret from the ui has 2 class selectors depending on if expanded or not - // we search for both since we want to still toggle the clicking - if (value.className.includes(caretright) || value.className.includes(caretdown)) { - // Then we tell JS to click the element even though we hid it from the UI - value.click(); - //Break from loop since we no longer need to continue looking - break; - } - } + node.open = !node.open; } public ngOnInit() { @@ -146,7 +125,7 @@ export class TvSearchComponent implements OnInit { }); this.searchService.getShowInformation(val.id) .subscribe(x => { - if (x.data) { + if (x) { this.setDefaults(x); this.updateItem(val, x); } else { @@ -236,15 +215,15 @@ export class TvSearchComponent implements OnInit { } } - private setDefaults(x: any) { - if (x.data.banner === null) { - x.data.banner = this.defaultPoster; - } - - if (x.data.imdbId === null) { - x.data.imdbId = "https://www.tvmaze.com/shows/" + x.data.seriesId; + private setDefaults(x: ISearchTvResult) { + if (x.banner === null) { + x.banner = this.defaultPoster; + } + + if (x.imdbId === null) { + x.imdbId = "https://www.tvmaze.com/shows/" + x.seriesId; } else { - x.data.imdbId = "http://www.imdb.com/title/" + x.data.imdbId + "/"; + x.imdbId = "http://www.imdb.com/title/" + x.imdbId + "/"; } }