Version 5.1 - All the GraphQL #32

Closed
timw4mail wants to merge 1160 commits from develop into master
3 changed files with 16 additions and 8 deletions
Showing only changes of commit db69b13d87 - Show all commits

View File

@ -3,6 +3,11 @@
<h2>Add Anime to your Collection</h2> <h2>Add Anime to your Collection</h2>
<form action="<?= $action_url ?>" method="post"> <form action="<?= $action_url ?>" method="post">
<section> <section>
<div class="cssload-loader" hidden="hidden">
<div class="cssload-inner cssload-one"></div>
<div class="cssload-inner cssload-two"></div>
<div class="cssload-inner cssload-three"></div>
</div>
<label for="search">Search for anime by name:&nbsp;&nbsp;&nbsp;&nbsp;<input type="search" id="search" name="search" /></label> <label for="search">Search for anime by name:&nbsp;&nbsp;&nbsp;&nbsp;<input type="search" id="search" name="search" /></label>
<section id="series_list" class="media-wrap"> <section id="series_list" class="media-wrap">
</section> </section>
@ -34,11 +39,5 @@
</table> </table>
</form> </form>
</main> </main>
<template id="show_list">
<article class="media">
<div class="name"><label><input type="radio" name="id" value="{{:id}}" />&nbsp;<span>{{:title}}<br />{{:alternate_title}}</span></label></div>
<img src="{{:cover_image}}" alt="{{:title}}" />
</article>
</template>
<script src="<?= $urlGenerator->asset_url('js.php/g/anime_collection') ?>"></script> <script src="<?= $urlGenerator->asset_url('js.php/g/anime_collection') ?>"></script>
<?php endif ?> <?php endif ?>

View File

@ -12,6 +12,7 @@
*/ */
namespace Aviat\AnimeClient\Controller; namespace Aviat\AnimeClient\Controller;
use Aviat\Ion\Json;
use Aviat\Ion\Di\ContainerInterface; use Aviat\Ion\Di\ContainerInterface;
use Aviat\AnimeClient\Controller; use Aviat\AnimeClient\Controller;
use Aviat\AnimeClient\Config; use Aviat\AnimeClient\Config;
@ -194,9 +195,9 @@ class Manga extends Controller {
$post_data = $transformer->untransform($post_data); $post_data = $transformer->untransform($post_data);
$full_result = $this->model->update($post_data); $full_result = $this->model->update($post_data);
$result = $full_result['body']; $result = Json::decode((string)$full_result['body']);
if (array_key_exists('manga', $result)) if ($full_result['statusCode'] == 200)
{ {
$m =& $result['manga'][0]; $m =& $result['manga'][0];
$title = ( ! empty($m['english_title'])) $title = ( ! empty($m['english_title']))

View File

@ -50,6 +50,14 @@ class Manga extends API {
*/ */
protected $base_url = "https://hummingbird.me/"; protected $base_url = "https://hummingbird.me/";
/**
* Make an authenticated manga API call
*
* @param string $type - the HTTP verb
* @param string $url
* @param string|null $json
* @return array
*/
protected function _manga_api_call($type, $url, $json = NULL) protected function _manga_api_call($type, $url, $json = NULL)
{ {
$token = $this->container->get('auth') $token = $this->container->get('auth')