Version 5.1 - All the GraphQL #32
@ -87,6 +87,13 @@ return [
|
||||
'action' => 'delete',
|
||||
'verb' => 'post',
|
||||
],
|
||||
'manga.details' => [
|
||||
'path' => '/manga/details/{id}',
|
||||
'action' => 'details',
|
||||
'tokens' => [
|
||||
'id' => '[a-z0-9\-]+',
|
||||
],
|
||||
],
|
||||
// ---------------------------------------------------------------------
|
||||
// Anime Collection Routes
|
||||
// ---------------------------------------------------------------------
|
||||
|
@ -19,7 +19,7 @@
|
||||
<?php endif ?>
|
||||
<img src="<?= $escape->attr($item['manga']['image']) ?>" />
|
||||
<div class="name">
|
||||
<a href="<?= $item['manga']['url'] ?>">
|
||||
<a href="<?= $url->generate('manga.details', ['id' => $item['manga']['slug']]) ?>">
|
||||
<?= $escape->html($item['manga']['title']) ?>
|
||||
<?= (isset($item['manga']['alternate_title'])) ? "<br />({$item['manga']['alternate_title']})" : ""; ?>
|
||||
</a>
|
||||
|
38
app/views/manga/details.php
Normal file
38
app/views/manga/details.php
Normal file
@ -0,0 +1,38 @@
|
||||
<main class="details">
|
||||
<section class="flex flex-no-wrap">
|
||||
<div>
|
||||
<img class="cover" src="<?= $data['poster_image'] ?>" alt="<?= $data['title'] ?> cover image" />
|
||||
<br />
|
||||
<br />
|
||||
<table>
|
||||
<tr>
|
||||
<td>Manga Type</td>
|
||||
<td><?= $data['manga_type'] ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Volume Count</td>
|
||||
<td><?= $data['volume_count'] ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Chapter Count</td>
|
||||
<td><?= $data['chapter_count'] ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Genres</td>
|
||||
<td>
|
||||
<?= implode(', ', $data['genres']); ?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div>
|
||||
<h2><a rel="external" href="https://hummingbird.me/manga/<?= $data['id'] ?>"><?= $data['romaji_title'] ?></a></h2>
|
||||
<?php if( ! empty($data['english_title'])): ?>
|
||||
<h3><?= $data['english_title'] ?></h3>
|
||||
<?php endif ?>
|
||||
|
||||
<br />
|
||||
<p><?= nl2br($data['synopsis']) ?></p>
|
||||
</div>
|
||||
</section>
|
||||
</main>
|
@ -29,7 +29,7 @@
|
||||
</td>
|
||||
<?php endif ?>
|
||||
<td class="align_left">
|
||||
<a href="<?= $item['manga']['url'] ?>">
|
||||
<a href="<?= $url->generate('manga.details', ['id' => $item['manga']['slug']]) ?>">
|
||||
<?= $item['manga']['title'] ?>
|
||||
</a>
|
||||
<?= ( ! is_null($item['manga']['alternate_title'])) ? " · " . $item['manga']['alternate_title'] : "" ?>
|
||||
|
@ -38,7 +38,8 @@ class AnimeClient {
|
||||
'update',
|
||||
'update_form',
|
||||
'login',
|
||||
'logout'
|
||||
'logout',
|
||||
'details'
|
||||
];
|
||||
|
||||
/**
|
||||
|
@ -287,7 +287,7 @@ class Anime extends BaseController {
|
||||
$data = $this->model->get_anime($anime_id);
|
||||
|
||||
$this->outputHTML('anime/details', [
|
||||
'title' => $data['title'],
|
||||
'title' => 'Anime · ' . $data['title'],
|
||||
'data' => $data,
|
||||
]);
|
||||
}
|
||||
|
@ -253,5 +253,21 @@ class Manga extends Controller {
|
||||
|
||||
$this->session_redirect();
|
||||
}
|
||||
|
||||
/**
|
||||
* View details of an manga
|
||||
*
|
||||
* @param string $manga_id
|
||||
* @return void
|
||||
*/
|
||||
public function details($manga_id)
|
||||
{
|
||||
$data = $this->model->get_manga($manga_id);
|
||||
|
||||
$this->outputHTML('manga/details', [
|
||||
'title' => 'Manga · ' . $data['manga']['romaji_title'],
|
||||
'data' => $data['manga'],
|
||||
]);
|
||||
}
|
||||
}
|
||||
// End of MangaController.php
|
@ -224,6 +224,18 @@ class Manga extends API {
|
||||
return $transformed_data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the details of a manga
|
||||
*
|
||||
* @param string $manga_id
|
||||
* @return array
|
||||
*/
|
||||
public function get_manga($manga_id)
|
||||
{
|
||||
$raw = $this->_manga_api_call('get', "manga/{$manga_id}.json");
|
||||
return Json::decode($raw['body'], TRUE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Map transformed anime data to be organized by reading status
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user