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);
$whoops->pushHandler($jsonHandler);
//$whoops->register();
$whoops->register();
$container->set('error-handler', $defaultHandler);
@ -79,4 +79,4 @@ $di = function() {
$di()->get('router')->dispatch();
// End of bootstrap.php
// End of bootstrap.php

View File

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

View File

@ -1,7 +1,7 @@
<main>
<?php if (is_logged_in()): ?>
<?php /*if (is_logged_in()): ?>
[<a href="<?= $config->full_url('collection/add', 'anime') ?>">Add Item</a>]
<?php endif ?>
<?php endif*/ ?>
<?php if (empty($sections)): ?>
<h3>There's nothing here!</h3>
<?php else: ?>
@ -27,12 +27,12 @@
</div>
</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>
<?php endif ?>
<?php endif*/ ?>
<?php endforeach ?>
</section>
</section>
<?php endforeach ?>
<?php endif ?>
</main>
</main>

View File

@ -17,11 +17,11 @@
</a> [<a href="<?= $urlGenerator->default_url($other_type) ?>"><?= ucfirst($other_type) ?> List</a>]
</span>
<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>]
<?php else: ?>
[<a href="<?= $urlGenerator->url("/{$url_type}/login", $url_type) ?>"><?= $config->whose_list ?>'s Login</a>]
<?php endif ?>
<?php endif */ ?>
</span>
</h1>
<?php if ( ! empty($nav_routes)): ?>
@ -40,4 +40,4 @@
<?php endif ?>
</nav>
<br />
<?php endif ?>
<?php endif ?>

View File

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

View File

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

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);
$expected = json_decode(file_get_contents($this->res_file), TRUE);
$actual = $this->transformer->transform_collection($json);
//file_put_contents($this->res_file, json_encode($actual));
$this->assertEquals($expected, $actual);
}
}

File diff suppressed because one or more lines are too long