Use Anime transformer class

This commit is contained in:
Timothy Warren 2015-09-28 14:41:45 -04:00
parent 23c16fc9c3
commit b8f753a424
9 changed files with 28 additions and 35 deletions

View File

@ -35,7 +35,7 @@ $di = function() {
$jsonHandler->onlyForAjaxRequests(true); $jsonHandler->onlyForAjaxRequests(true);
$whoops->pushHandler($jsonHandler); $whoops->pushHandler($jsonHandler);
//$whoops->register(); $whoops->register();
$container->set('error-handler', $defaultHandler); $container->set('error-handler', $defaultHandler);

View File

@ -7,11 +7,11 @@
<h2><?= $escape->html($name) ?></h2> <h2><?= $escape->html($name) ?></h2>
<section class="media-wrap"> <section class="media-wrap">
<?php foreach($items as $item): ?> <?php foreach($items as $item): ?>
<article class="media" id="a-<?= $item['anime']['id'] ?>"> <article class="media" id="a-<?= $item['id'] ?>">
<?php if (is_logged_in()): ?> <?php /*if (is_logged_in()): ?>
<button class="plus_one" hidden>+1 Episode</button> <button class="plus_one" hidden>+1 Episode</button>
<?php endif ?> <?php endif*/ ?>
<?= $helper->img($item['anime']['cover_image']); ?> <?= $helper->img($item['anime']['image']); ?>
<div class="name"> <div class="name">
<a href="<?= $escape->attr($item['anime']['url']) ?>"> <a href="<?= $escape->attr($item['anime']['url']) ?>">
<?= $escape->html($item['anime']['title']) ?> <?= $escape->html($item['anime']['title']) ?>
@ -20,15 +20,15 @@
</div> </div>
<div class="table"> <div class="table">
<div class="row"> <div class="row">
<div class="user_rating">Rating: <?= ($item['rating']['value'] > 0) ? (int)($item['rating']['value'] * 2) : " - " ?> / 10</div> <div class="user_rating">Rating: <?= $item['user_rating'] ?> / 10</div>
<div class="completion">Episodes: <div class="completion">Episodes:
<span class="completed_number"><?= $item['episodes_watched'] ?></span> / <span class="completed_number"><?= $item['episodes']['watched'] ?></span> /
<span class="total_number"><?= ($item['anime']['episode_count'] != 0) ? $item['anime']['episode_count'] : "-" ?></span> <span class="total_number"><?= $item['episodes']['total'] ?></span>
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="media_type"><?= $escape->html($item['anime']['show_type']) ?></div> <div class="media_type"><?= $escape->html($item['anime']['type']) ?></div>
<div class="airing_status"><?= $escape->html($item['anime']['status']) ?></div> <div class="airing_status"><?= $escape->html($item['airing']['status']) ?></div>
<div class="age_rating"><?= $escape->html($item['anime']['age_rating']) ?></div> <div class="age_rating"><?= $escape->html($item['anime']['age_rating']) ?></div>
</div> </div>
</div> </div>
@ -39,6 +39,6 @@
<?php endforeach ?> <?php endforeach ?>
<?php endif ?> <?php endif ?>
</main> </main>
<?php if (is_logged_in()): ?> <?php /*if (is_logged_in()): ?>
<script src="<?= $config->asset_url('js.php?g=edit') ?>"></script> <script src="<?= $config->asset_url('js.php?g=edit') ?>"></script>
<?php endif ?> <?php endif*/ ?>

View File

@ -1,7 +1,7 @@
<main> <main>
<?php if (is_logged_in()): ?> <?php /*if (is_logged_in()): ?>
[<a href="<?= $config->full_url('collection/add', 'anime') ?>">Add Item</a>] [<a href="<?= $config->full_url('collection/add', 'anime') ?>">Add Item</a>]
<?php endif ?> <?php endif*/ ?>
<?php if (empty($sections)): ?> <?php if (empty($sections)): ?>
<h3>There's nothing here!</h3> <h3>There's nothing here!</h3>
<?php else: ?> <?php else: ?>
@ -27,9 +27,9 @@
</div> </div>
</article> </article>
<?php if (is_logged_in()): ?> <?php /*if (is_logged_in()): ?>
<span>[<a href="<?= $urlGenerator->full_url("collection/edit/{$item['hummingbird_id']}", "anime") ?>">Edit</a>]</span> <span>[<a href="<?= $urlGenerator->full_url("collection/edit/{$item['hummingbird_id']}", "anime") ?>">Edit</a>]</span>
<?php endif ?> <?php endif*/ ?>
<?php endforeach ?> <?php endforeach ?>
</section> </section>
</section> </section>

View File

@ -17,11 +17,11 @@
</a> [<a href="<?= $urlGenerator->default_url($other_type) ?>"><?= ucfirst($other_type) ?> List</a>] </a> [<a href="<?= $urlGenerator->default_url($other_type) ?>"><?= ucfirst($other_type) ?> List</a>]
</span> </span>
<span class="flex-no-wrap small-font"> <span class="flex-no-wrap small-font">
<?php if (is_logged_in()): ?> <?php /*if (is_logged_in()): ?>
[<a href="<?= $urlGenerator->url("/{$url_type}/logout", $url_type) ?>">Logout</a>] [<a href="<?= $urlGenerator->url("/{$url_type}/logout", $url_type) ?>">Logout</a>]
<?php else: ?> <?php else: ?>
[<a href="<?= $urlGenerator->url("/{$url_type}/login", $url_type) ?>"><?= $config->whose_list ?>'s Login</a>] [<a href="<?= $urlGenerator->url("/{$url_type}/login", $url_type) ?>"><?= $config->whose_list ?>'s Login</a>]
<?php endif ?> <?php endif */ ?>
</span> </span>
</h1> </h1>
<?php if ( ! empty($nav_routes)): ?> <?php if ( ! empty($nav_routes)): ?>

View File

@ -8,12 +8,12 @@
<section class="media-wrap"> <section class="media-wrap">
<?php foreach($items as $item): ?> <?php foreach($items as $item): ?>
<article class="media" id="manga-<?= $item['id'] ?>"> <article class="media" id="manga-<?= $item['id'] ?>">
<?php if (is_logged_in()): ?> <?php /*if (is_logged_in()): ?>
<div class="edit_buttons" hidden> <div class="edit_buttons" hidden>
<button class="plus_one_chapter">+1 Chapter</button> <button class="plus_one_chapter">+1 Chapter</button>
<button class="plus_one_volume">+1 Volume</button> <button class="plus_one_volume">+1 Volume</button>
</div> </div>
<?php endif ?> <?php endif*/ ?>
<img src="<?= $escape->attr($item['manga']['poster_image']) ?>" /> <img src="<?= $escape->attr($item['manga']['poster_image']) ?>" />
<div class="name"> <div class="name">
<a href="https://hummingbird.me/manga/<?= $item['manga']['id'] ?>"> <a href="https://hummingbird.me/manga/<?= $item['manga']['id'] ?>">
@ -45,6 +45,6 @@
<?php endforeach ?> <?php endforeach ?>
<?php endif ?> <?php endif ?>
</main> </main>
<?php if (is_logged_in()): ?> <?php /*if (is_logged_in()): ?>
<script src="<?= $urlGenerator->asset_url('js.php?g=edit') ?>"></script> <script src="<?= $urlGenerator->asset_url('js.php?g=edit') ?>"></script>
<?php endif ?> <?php endif*/ ?>

View File

@ -13,7 +13,6 @@
"aviat4ion/query": "2.5.*", "aviat4ion/query": "2.5.*",
"robmorgan/phinx": "0.4.*", "robmorgan/phinx": "0.4.*",
"abeautifulsite/simpleimage": "2.5.*", "abeautifulsite/simpleimage": "2.5.*",
"szymach/c-pchart": "1.*", "szymach/c-pchart": "1.*"
"league/fractal": "0.12.0"
} }
} }

View File

@ -1,7 +0,0 @@
<?php
class AnimeCollectionModelTest extends AnimeClient_TestCase {
}

View File

@ -44,6 +44,7 @@ class AnimeListTransformerTest extends AnimeClient_TestCase {
$json = json_decode(file_get_contents($this->start_file), TRUE); $json = json_decode(file_get_contents($this->start_file), TRUE);
$expected = json_decode(file_get_contents($this->res_file), TRUE); $expected = json_decode(file_get_contents($this->res_file), TRUE);
$actual = $this->transformer->transform_collection($json); $actual = $this->transformer->transform_collection($json);
//file_put_contents($this->res_file, json_encode($actual));
$this->assertEquals($expected, $actual); $this->assertEquals($expected, $actual);
} }
} }

File diff suppressed because one or more lines are too long