Fix collection functionality
This commit is contained in:
parent
52397bbd61
commit
f386766841
@ -1,8 +1,8 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Bootstrap / Dependency Injection
|
||||
*/
|
||||
|
||||
namespace Aviat\AnimeClient;
|
||||
|
||||
use Aura\Html\HelperLocatorFactory;
|
||||
|
@ -30,7 +30,7 @@ $config = [
|
||||
'show_anime_collection' => TRUE,
|
||||
|
||||
// do you wish to show the manga collection?
|
||||
'show_manga_collection' => TRUE,
|
||||
'show_manga_collection' => FALSE,
|
||||
|
||||
// path to public directory on the server
|
||||
'asset_dir' => realpath(__DIR__ . '/../../public'),
|
||||
|
@ -20,7 +20,6 @@ return [
|
||||
'on_hold' => '/on_hold',
|
||||
'dropped' => '/dropped',
|
||||
'completed' => '/completed',
|
||||
//'collection' => '/collection/view',
|
||||
'all' => '/all'
|
||||
]
|
||||
],
|
||||
@ -34,12 +33,5 @@ return [
|
||||
'completed' => '/completed',
|
||||
'all' => '/all'
|
||||
]
|
||||
],
|
||||
'collection' => [
|
||||
'route_prefix' => '/collection',
|
||||
'items' => [
|
||||
'anime' => '/anime',
|
||||
'manga' => '/manga',
|
||||
]
|
||||
]
|
||||
];
|
@ -36,11 +36,17 @@ return [
|
||||
'anime_edit.js',
|
||||
'manga_edit.js'
|
||||
],
|
||||
'collection' => [
|
||||
'anime_collection' => [
|
||||
'lib/jquery.min.js',
|
||||
'lib/jquery.throttle-debounce.js',
|
||||
'lib/jsrender.js',
|
||||
'collection.js'
|
||||
'anime_collection.js'
|
||||
],
|
||||
'manga_collection' => [
|
||||
'lib/jquery.min.js',
|
||||
'lib/jquery.throttle-debounce.js',
|
||||
'lib/jsrender.js',
|
||||
'manga_collection.js'
|
||||
]
|
||||
];
|
||||
|
||||
|
@ -29,8 +29,12 @@ return [
|
||||
]
|
||||
],
|
||||
],
|
||||
// Routes on collection controller
|
||||
// Routes on anime collection controller
|
||||
'collection' => [
|
||||
'collection_search' => [
|
||||
'path' => '/collection/search',
|
||||
'action' => 'search'
|
||||
],
|
||||
'collection_add_form' => [
|
||||
'path' => '/collection/add',
|
||||
'action' => 'form',
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?php if (is_logged_in()): ?>
|
||||
<?php if ($auth->is_authenticated()): ?>
|
||||
<main>
|
||||
<form action="<?= $action_url ?>" method="post">
|
||||
<dl>
|
||||
@ -34,5 +34,5 @@
|
||||
<img src="{{:cover_image}}" alt="{{:title}}" />
|
||||
</article>
|
||||
</template>
|
||||
<script src="<?= $config->asset_url('js.php?g=collection&debug=1') ?>"></script>
|
||||
<script src="<?= $urlGenerator->asset_url('js.php?g=anime_collection') ?>"></script>
|
||||
<?php endif ?>
|
@ -1,7 +1,7 @@
|
||||
<main>
|
||||
<?php /*if (is_logged_in()): ?>
|
||||
[<a href="<?= $config->full_url('collection/add', 'anime') ?>">Add Item</a>]
|
||||
<?php endif*/ ?>
|
||||
<?php if ($auth->is_authenticated()): ?>
|
||||
[<a href="<?= $urlGenerator->url('collection/add', 'anime') ?>">Add Item</a>]
|
||||
<?php endif ?>
|
||||
<?php if (empty($sections)): ?>
|
||||
<h3>There's nothing here!</h3>
|
||||
<?php else: ?>
|
||||
@ -27,9 +27,9 @@
|
||||
</div>
|
||||
</article>
|
||||
|
||||
<?php /*if (is_logged_in()): ?>
|
||||
<span>[<a href="<?= $urlGenerator->full_url("collection/edit/{$item['hummingbird_id']}", "anime") ?>">Edit</a>]</span>
|
||||
<?php endif*/ ?>
|
||||
<?php if ($auth->is_authenticated()): ?>
|
||||
<span>[<a href="<?= $urlGenerator->url("collection/edit/{$item['hummingbird_id']}", "anime") ?>">Edit</a>]</span>
|
||||
<?php endif ?>
|
||||
<?php endforeach ?>
|
||||
</section>
|
||||
</section>
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?php if (is_logged_in()): ?>
|
||||
<?php if ($auth->is_authenticated()): ?>
|
||||
<main>
|
||||
<form action="<?= $action_url ?>" method="post">
|
||||
<dl>
|
||||
@ -33,5 +33,5 @@
|
||||
<img src="{{:cover_image}}" alt="{{:title}}" />
|
||||
</article>
|
||||
</template>
|
||||
<script src="<?= $config->asset_url('js.php?g=collection&debug=1') ?>"></script>
|
||||
<script src="<?= $urlGenerator->asset_url('js.php?g=anime_collection') ?>"></script>
|
||||
<?php endif ?>
|
@ -13,9 +13,21 @@
|
||||
<body class="<?= $escape->attr($url_type) ?> list">
|
||||
<h1 class="flex flex-align-end flex-wrap">
|
||||
<span class="flex-no-wrap grow-1">
|
||||
<a href="<?= $escape->attr($urlGenerator->default_url($url_type)) ?>">
|
||||
<?= $config->get('whose_list') ?>'s <?= ucfirst($url_type) ?> <?= (strpos($route_path, 'collection') !== FALSE) ? 'Collection' : 'List' ?>
|
||||
</a> [<a href="<?= $urlGenerator->default_url($other_type) ?>"><?= ucfirst($other_type) ?> List</a>]
|
||||
<?php if(strpos($route_path, 'collection') === FALSE): ?>
|
||||
<a href="<?= $escape->attr($urlGenerator->default_url($url_type)) ?>">
|
||||
<?= $config->get('whose_list') ?>'s <?= ucfirst($url_type) ?> List
|
||||
</a>
|
||||
<?php if($config->get("show_{$url_type}_collection")): ?>
|
||||
[<a href="<?= $urlGenerator->url('collection/view') ?>"><?= ucfirst($url_type) ?> Collection</a>]
|
||||
<?php endif ?>
|
||||
[<a href="<?= $urlGenerator->default_url($other_type) ?>"><?= ucfirst($other_type) ?> List</a>]
|
||||
<?php else: ?>
|
||||
<a href="<?= $urlGenerator->url('collection/view') ?>">
|
||||
<?= $config->get('whose_list') ?>'s <?= ucfirst($url_type) ?> Collection
|
||||
</a>
|
||||
[<a href="<?= $urlGenerator->default_url('anime') ?>">Anime List</a>]
|
||||
[<a href="<?= $urlGenerator->default_url('manga') ?>">Manga List</a>]
|
||||
<?php endif ?>
|
||||
</span>
|
||||
<span class="flex-no-wrap small-font">
|
||||
<?php if ($auth->is_authenticated()): ?>
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
$animeclient_file_patterns = [
|
||||
'app/config/*.php',
|
||||
'app/booststrap.php',
|
||||
'src/functions.php',
|
||||
'src/Aviat/AnimeClient/*.php'
|
||||
];
|
||||
|
@ -2,10 +2,10 @@
|
||||
|
||||
function search(query, callback)
|
||||
{
|
||||
$.get(BASE_URL + 'search', {'query':query}, callback);
|
||||
$.get(BASE_URL + 'collection/search', {'query':query}, callback);
|
||||
}
|
||||
|
||||
$("#search").on('keypress', $.throttle(250, function(e) {
|
||||
$("#search").on('keypress', $.throttle(750, function(e) {
|
||||
var query = encodeURIComponent($(this).val());
|
||||
search(query, function(res) {
|
||||
var template = $.templates("#show_list");
|
@ -53,6 +53,7 @@ class Collection extends BaseController {
|
||||
parent::__construct($container);
|
||||
|
||||
$this->urlGenerator = $container->get('url-generator');
|
||||
$this->anime_model = new AnimeModel($container);
|
||||
$this->anime_collection_model = new AnimeCollectionModel($container);
|
||||
$this->base_data = array_merge($this->base_data, [
|
||||
'menu_name' => 'collection',
|
||||
@ -71,7 +72,7 @@ class Collection extends BaseController {
|
||||
public function search()
|
||||
{
|
||||
$query = $this->request->query->get('query');
|
||||
$this->outputJSON($this->model->search($query));
|
||||
$this->outputJSON($this->anime_model->search($query));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -109,7 +110,7 @@ class Collection extends BaseController {
|
||||
$this->outputHTML('collection/' . strtolower($action), [
|
||||
'action' => $action,
|
||||
'action_url' => $this->urlGenerator->full_url("collection/" . strtolower($action)),
|
||||
'title' => $this->config->whose_list . " Anime Collection · {$action}",
|
||||
'title' => $this->config->get('whose_list') . " Anime Collection · {$action}",
|
||||
'media_items' => $this->anime_collection_model->get_media_type_list(),
|
||||
'item' => ($action === "Edit") ? $this->anime_collection_model->get($id) : []
|
||||
]);
|
||||
|
Loading…
Reference in New Issue
Block a user