diff --git a/Kyoo/ClientApp/src/app/collection/collection.component.html b/Kyoo/ClientApp/src/app/collection/collection.component.html index a68b9f0b..273e73eb 100644 --- a/Kyoo/ClientApp/src/app/collection/collection.component.html +++ b/Kyoo/ClientApp/src/app/collection/collection.component.html @@ -1,7 +1,7 @@
- +

{{collection.name}}

diff --git a/Kyoo/ClientApp/src/app/collection/collection.component.scss b/Kyoo/ClientApp/src/app/collection/collection.component.scss index 4dbb9c42..cb8d3085 100644 --- a/Kyoo/ClientApp/src/app/collection/collection.component.scss +++ b/Kyoo/ClientApp/src/app/collection/collection.component.scss @@ -2,7 +2,7 @@ { width: 60%; - > img + > div { width: 100%; height: 0; diff --git a/Kyoo/ClientApp/src/app/collection/collection.component.ts b/Kyoo/ClientApp/src/app/collection/collection.component.ts index 89a6c823..4956c985 100644 --- a/Kyoo/ClientApp/src/app/collection/collection.component.ts +++ b/Kyoo/ClientApp/src/app/collection/collection.component.ts @@ -1,6 +1,7 @@ import { Component, OnInit } from '@angular/core'; import { Collection } from "../../models/collection"; import { ActivatedRoute } from "@angular/router"; +import { DomSanitizer } from "@angular/platform-browser"; @Component({ selector: 'app-collection', @@ -11,11 +12,15 @@ export class CollectionComponent implements OnInit { collection: Collection; - constructor(private route: ActivatedRoute) { } + constructor(private route: ActivatedRoute, private sanitizer: DomSanitizer) { } ngOnInit() { this.collection = this.route.snapshot.data.collection; } + getThumb() + { + return this.sanitizer.bypassSecurityTrustStyle("url(" + this.collection.poster + ")"); + } } diff --git a/Kyoo/ClientApp/src/models/collection.ts b/Kyoo/ClientApp/src/models/collection.ts index 7c5362fa..ddf65d43 100644 --- a/Kyoo/ClientApp/src/models/collection.ts +++ b/Kyoo/ClientApp/src/models/collection.ts @@ -4,6 +4,7 @@ export interface Collection { slug: string; name: string; + poster: string; overview: string; startYear: number, endYear: number, diff --git a/Kyoo/Controllers/PeopleController.cs b/Kyoo/Controllers/PeopleController.cs index 3ef6c53c..9c08379f 100644 --- a/Kyoo/Controllers/PeopleController.cs +++ b/Kyoo/Controllers/PeopleController.cs @@ -16,19 +16,17 @@ namespace Kyoo.Controllers this.libraryManager = libraryManager; } - [HttpGet("{people-slug}")] - public ActionResult GetPeople(string slug) + [HttpGet("{peopleSlug}")] + public ActionResult GetPeople(string peopleSlug) { - People people = libraryManager.GetPeopleBySlug(slug); + People people = libraryManager.GetPeopleBySlug(peopleSlug); - //This always return not found if (people == null) return NotFound(); - - Debug.WriteLine("&People: " + people.Name); Collection collection = new Collection(0, people.slug, people.Name, null, null) { - Shows = libraryManager.GetShowsByPeople(people.id) + Shows = libraryManager.GetShowsByPeople(people.id), + Poster = "peopleimg/" + people.slug }; return collection; } diff --git a/Kyoo/InternalAPI/LibraryManager/LibraryManager.cs b/Kyoo/InternalAPI/LibraryManager/LibraryManager.cs index 2e326db3..9e5b0aae 100644 --- a/Kyoo/InternalAPI/LibraryManager/LibraryManager.cs +++ b/Kyoo/InternalAPI/LibraryManager/LibraryManager.cs @@ -601,7 +601,7 @@ namespace Kyoo.InternalAPI public IEnumerable GetShowsInCollection(long collectionID) { - string query = "SELECT * FROM shows JOIN collectionsLinks l ON l.showID = shows.id WHERE l.collectionID = $id;"; + string query = "SELECT * FROM shows JOIN collectionsLinks l ON l.showID = shows.id WHERE l.collectionID = $id ORDER BY title;"; using (SQLiteCommand cmd = new SQLiteCommand(query, sqlConnection)) { @@ -633,7 +633,7 @@ namespace Kyoo.InternalAPI public IEnumerable GetShowsByPeople(long peopleID) { - string query = "SELECT * FROM shows JOIN peopleLinks l ON l.showID = shows.id WHERE l.peopleID = $id;"; + string query = "SELECT * FROM shows JOIN peopleLinks l ON l.showID = shows.id WHERE l.peopleID = $id ORDER BY title;"; using (SQLiteCommand cmd = new SQLiteCommand(query, sqlConnection)) { diff --git a/Kyoo/Models/Collection.cs b/Kyoo/Models/Collection.cs index 8ae27c71..0ac1ad3b 100644 --- a/Kyoo/Models/Collection.cs +++ b/Kyoo/Models/Collection.cs @@ -9,6 +9,7 @@ namespace Kyoo.Models [JsonIgnore] public long id; public string Slug; public string Name; + public string Poster; public string Overview; [JsonIgnore] public string ImgPrimary; public IEnumerable Shows; @@ -26,11 +27,13 @@ namespace Kyoo.Models public static Collection FromReader(System.Data.SQLite.SQLiteDataReader reader) { - return new Collection((long)reader["id"], + Collection col = new Collection((long)reader["id"], reader["slug"] as string, reader["name"] as string, reader["overview"] as string, reader["imgPrimary"] as string); + col.Poster = "poster/" + col.Slug; + return col; } public Show AsShow()