Add staff to character pages

This commit is contained in:
Timothy Warren 2017-04-05 13:02:48 -04:00
parent b861db5d1f
commit fb3805b789
5 changed files with 146 additions and 20 deletions

View File

@ -79,7 +79,7 @@
<?php if (count($characters) > 0): ?>
<h2>Characters</h2>
<section class="media-wrap">
<section class="align_left media-wrap">
<?php foreach($characters as $char): ?>
<?php if ( ! empty($char['image']['original'])): ?>
<article class="character">

View File

@ -1,12 +1,126 @@
<main class="details fixed">
<?php use Aviat\AnimeClient\API\Kitsu; ?>
<main class="details">
<section class="flex flex-no-wrap">
<div>
<img class="cover" width="284" src="<?= $data['image']['original'] ?>" alt="" />
<img class="cover" width="284" src="<?= $data[0]['attributes']['image']['original'] ?>" alt="" />
</div>
<div>
<h2><?= $data['name'] ?></h2>
<h2><?= $data[0]['attributes']['name'] ?></h2>
<p><?= $data['description'] ?></p>
<p class="description"><?= $data[0]['attributes']['description'] ?></p>
</div>
</section>
<?php if (array_key_exists('anime', $data['included']) || array_key_exists('manga', $data['included'])): ?>
<h3>Media</h3>
<section class="flex flex-no-wrap">
<?php if (array_key_exists('anime', $data['included'])): ?>
<div>
<h4>Anime</h4>
<section class="align_left media-wrap">
<?php foreach($data['included']['anime'] as $anime): ?>
<article class="media">
<?php
$link = $url->generate('anime.details', ['id' => $anime['attributes']['slug']]);
$titles = Kitsu::filterTitles($anime['attributes']);
?>
<a href="<?= $link ?>">
<img src="<?= $anime['attributes']['posterImage']['small'] ?>" width="220" alt="" />
</a>
<div class="name">
<a href="<?= $link ?>">
<?= array_shift($titles) ?>
<?php foreach ($titles as $title): ?>
<br /><small><?= $title ?></small>
<?php endforeach ?>
</a>
</div>
</article>
<?php endforeach ?>
</section>
</div>
<?php endif ?>
<?php if (array_key_exists('manga', $data['included'])): ?>
<div>
<h4>Manga</h4>
<section class="align_left media-wrap">
<?php foreach($data['included']['manga'] as $manga): ?>
<article class="media">
<?php
$link = $url->generate('manga.details', ['id' => $manga['attributes']['slug']]);
$titles = Kitsu::filterTitles($manga['attributes']);
?>
<a href="<?= $link ?>">
<img src="<?= $manga['attributes']['posterImage']['small'] ?>" width="220" alt="" />
</a>
<div class="name">
<a href="<?= $link ?>">
<?= array_shift($titles) ?>
<?php foreach ($titles as $title): ?>
<br /><small><?= $title ?></small>
<?php endforeach ?>
</a>
</div>
</article>
<?php endforeach ?>
</section>
</div>
<?php endif ?>
</section>
<?php endif ?>
<section>
<?php if (array_key_exists('castings', $data['included'])): ?>
<h3>Castings</h3>
<?php foreach($castings as $role => $entries): ?>
<h4><?= $role ?></h4>
<?php foreach($entries as $language => $casting): ?>
<h5><?= $language ?></h5>
<table class="min-table">
<tr>
<th>Cast Member</th>
<th>Series</th>
</tr>
<?php foreach($casting as $c):?>
<tr>
<td style="width:229px">
<article class="character">
<img src="<?= $c['person']['image'] ?>" alt="" />
<div class="name">
<?= $c['person']['name'] ?>
</div>
</article>
</td>
<td>
<section class="align_left media-wrap">
<?php foreach($c['series'] as $series): ?>
<article class="media">
<?php
$link = $url->generate('anime.details', ['id' => $series['attributes']['slug']]);
$titles = Kitsu::filterTitles($series['attributes']);
?>
<a href="<?= $link ?>">
<img src="<?= $series['attributes']['posterImage']['small'] ?>" width="220" alt="" />
</a>
<div class="name">
<a href="<?= $link ?>">
<?= array_shift($titles) ?>
<?php foreach ($titles as $title): ?>
<br /><small><?= $title ?></small>
<?php endforeach ?>
</a>
</div>
</article>
<?php endforeach ?>
</section>
</td>
</tr>
<?php endforeach; ?>
</table>
<?php endforeach ?>
<?php endforeach ?>
<?php endif ?>
</section>
</main>

View File

@ -753,11 +753,11 @@ a:hover, a:active {
.justify {text-align:justify}
.align_center {text-align:center}
.align_center {text-align:center !important}
.align_left {text-align:left}
.align_left {text-align:left !important}
.align_right {text-align:right}
.align_right {text-align:right !important}
.valign_top {vertical-align:top}
@ -1263,7 +1263,12 @@ a:hover, a:active {
font-size:inherit;
}
.details.fixed {
.description {
max-width:800px;
max-width:80rem;
}
.fixed {
max-width:930px;
max-width:93rem;
}
@ -1339,6 +1344,11 @@ a:hover, a:active {
width: 100%;
}
.min-table {
min-width: 0;
margin-left: 0;
}
/* ----------------------------------------------------------------------------
User page styles
-----------------------------------------------------------------------------*/

View File

@ -79,9 +79,9 @@ a:hover, a:active {
}
.justify {text-align:justify}
.align_center {text-align:center}
.align_left {text-align:left}
.align_right {text-align:right}
.align_center {text-align:center !important}
.align_left {text-align:left !important}
.align_right {text-align:right !important}
.valign_top {vertical-align:top}
@ -521,7 +521,11 @@ a:hover, a:active {
font-size:inherit;
}
.details.fixed {
.description {
max-width:80rem;
}
.fixed {
max-width:93rem;
}
@ -590,6 +594,11 @@ a:hover, a:active {
width: 100%;
}
.min-table {
min-width: 0;
margin-left: 0;
}
/* ----------------------------------------------------------------------------
User page styles
-----------------------------------------------------------------------------*/

View File

@ -127,13 +127,6 @@ class JsonAPI {
$typeKey = $props['data'][$j]['type'];
$relationship =& $item['relationships'][$relType];
unset($relationship['data'][$j]);
if (empty($relationship['data']))
{
unset($relationship['data']);
}
if ($relType === $typeKey)
{
$relationship[$idKey] = $included[$typeKey][$idKey];