Version 5.1 - All the GraphQL #32

Closed
timw4mail wants to merge 1160 commits from develop into master
8 changed files with 78 additions and 4 deletions
Showing only changes of commit 3710f42505 - Show all commits

View File

@ -87,6 +87,13 @@ return [
'action' => 'delete', 'action' => 'delete',
'verb' => 'post', 'verb' => 'post',
], ],
'manga.details' => [
'path' => '/manga/details/{id}',
'action' => 'details',
'tokens' => [
'id' => '[a-z0-9\-]+',
],
],
// --------------------------------------------------------------------- // ---------------------------------------------------------------------
// Anime Collection Routes // Anime Collection Routes
// --------------------------------------------------------------------- // ---------------------------------------------------------------------

View File

@ -19,7 +19,7 @@
<?php endif ?> <?php endif ?>
<img src="<?= $escape->attr($item['manga']['image']) ?>" /> <img src="<?= $escape->attr($item['manga']['image']) ?>" />
<div class="name"> <div class="name">
<a href="<?= $item['manga']['url'] ?>"> <a href="<?= $url->generate('manga.details', ['id' => $item['manga']['slug']]) ?>">
<?= $escape->html($item['manga']['title']) ?> <?= $escape->html($item['manga']['title']) ?>
<?= (isset($item['manga']['alternate_title'])) ? "<br />({$item['manga']['alternate_title']})" : ""; ?> <?= (isset($item['manga']['alternate_title'])) ? "<br />({$item['manga']['alternate_title']})" : ""; ?>
</a> </a>

View 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>

View File

@ -29,7 +29,7 @@
</td> </td>
<?php endif ?> <?php endif ?>
<td class="align_left"> <td class="align_left">
<a href="<?= $item['manga']['url'] ?>"> <a href="<?= $url->generate('manga.details', ['id' => $item['manga']['slug']]) ?>">
<?= $item['manga']['title'] ?> <?= $item['manga']['title'] ?>
</a> </a>
<?= ( ! is_null($item['manga']['alternate_title'])) ? " &middot; " . $item['manga']['alternate_title'] : "" ?> <?= ( ! is_null($item['manga']['alternate_title'])) ? " &middot; " . $item['manga']['alternate_title'] : "" ?>

View File

@ -38,7 +38,8 @@ class AnimeClient {
'update', 'update',
'update_form', 'update_form',
'login', 'login',
'logout' 'logout',
'details'
]; ];
/** /**

View File

@ -287,7 +287,7 @@ class Anime extends BaseController {
$data = $this->model->get_anime($anime_id); $data = $this->model->get_anime($anime_id);
$this->outputHTML('anime/details', [ $this->outputHTML('anime/details', [
'title' => $data['title'], 'title' => 'Anime &middot ' . $data['title'],
'data' => $data, 'data' => $data,
]); ]);
} }

View File

@ -253,5 +253,21 @@ class Manga extends Controller {
$this->session_redirect(); $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 &middot; ' . $data['manga']['romaji_title'],
'data' => $data['manga'],
]);
}
} }
// End of MangaController.php // End of MangaController.php

View File

@ -224,6 +224,18 @@ class Manga extends API {
return $transformed_data; 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 * Map transformed anime data to be organized by reading status
* *