People page finished.

This commit is contained in:
Zoe Roux 2019-10-22 16:44:07 +02:00
parent f3d207cb4e
commit 729a58ad2f
7 changed files with 20 additions and 13 deletions

View File

@ -1,7 +1,7 @@
<div class="container-fluid">
<div class="row justify-content-center">
<div class="col-md-4 col-lg-3 col-xl-2 collection-info">
<img src="poster/{{collection.slug}}" />
<div [style.background-image]="getThumb()"></div>
</div>
<div class="col-md-8 col-lg-9 col-xl-10">
<h3 class="text-center text-md-left p-2 p-md-3">{{collection.name}}</h3>

View File

@ -2,7 +2,7 @@
{
width: 60%;
> img
> div
{
width: 100%;
height: 0;

View File

@ -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 + ")");
}
}

View File

@ -4,6 +4,7 @@ export interface Collection
{
slug: string;
name: string;
poster: string;
overview: string;
startYear: number,
endYear: number,

View File

@ -16,19 +16,17 @@ namespace Kyoo.Controllers
this.libraryManager = libraryManager;
}
[HttpGet("{people-slug}")]
public ActionResult<Collection> GetPeople(string slug)
[HttpGet("{peopleSlug}")]
public ActionResult<Collection> 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;
}

View File

@ -601,7 +601,7 @@ namespace Kyoo.InternalAPI
public IEnumerable<Show> 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<Show> 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))
{

View File

@ -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<Show> 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()