Version 5.1 - All the GraphQL #32

Closed
timw4mail wants to merge 1160 commits from develop into master
11 changed files with 820 additions and 592 deletions
Showing only changes of commit 01d25f2817 - Show all commits

View File

@ -46,24 +46,24 @@ return [
'anime.add.get' => [
'path' => '/anime/add',
'action' => 'add_form',
'verb' => 'get'
'verb' => 'get',
],
'anime.add.post' => [
'path' => '/anime/add',
'action' => 'add',
'verb' => 'post'
'verb' => 'post',
],
'anime.details' => [
'path' => '/anime/details/{id}',
'action' => 'details',
'tokens' => [
'id' => '[a-z0-9\-]+'
]
'id' => '[a-z0-9\-]+',
],
],
'anime.delete' => [
'path' => '/anime/delete',
'action' => 'delete',
'verb' => 'post'
'verb' => 'post',
],
// ---------------------------------------------------------------------
// Manga Routes
@ -75,19 +75,24 @@ return [
'manga.add.get' => [
'path' => '/manga/add',
'action' => 'add_form',
'verb' => 'get'
'verb' => 'get',
],
'manga.add.post' => [
'path' => '/manga/add',
'action' => 'add',
'verb' => 'post'
'verb' => 'post',
],
'manga.delete' => [
'path' => '/manga/delete',
'action' => 'delete',
'verb' => 'post',
],
// ---------------------------------------------------------------------
// Anime Collection Routes
// ---------------------------------------------------------------------
'collection.search' => [
'path' => '/collection/search',
'action' => 'search'
'action' => 'search',
],
'collection.add.get' => [
'path' => '/collection/add',
@ -98,27 +103,35 @@ return [
'path' => '/collection/edit/{id}',
'action' => 'form',
'tokens' => [
'id' => '[0-9]+'
]
'id' => '[0-9]+',
],
],
'collection.add.post' => [
'path' => '/collection/add',
'action' => 'add',
'verb' => 'post'
'verb' => 'post',
],
'collection.edit.post' => [
'path' => '/collection/edit',
'action' => 'edit',
'verb' => 'post'
'verb' => 'post',
],
'collection.view' => [
'path' => '/collection/view{/view}',
'action' => 'index',
'params' => [],
'tokens' => [
'view' => '[a-z_]+'
]
'view' => '[a-z_]+',
],
],
'collection.delete' => [
'path' => '/collection/delete',
'action' => 'delete',
'verb' => 'post',
],
// ---------------------------------------------------------------------
// Manga Collection Routes
// ---------------------------------------------------------------------
// ---------------------------------------------------------------------
// Default / Shared routes
// ---------------------------------------------------------------------
@ -126,13 +139,13 @@ return [
'path' => '/login',
'action' => 'login',
'controller' => AnimeClient::DEFAULT_CONTROLLER_NAMESPACE,
'verb' => 'get'
'verb' => 'get',
],
'login.post' => [
'path' => '/login',
'action' => 'login_action',
'controller' => AnimeClient::DEFAULT_CONTROLLER_NAMESPACE,
'verb' => 'post'
'verb' => 'post',
],
'logout' => [
'path' => '/logout',
@ -144,37 +157,37 @@ return [
'action' => 'update',
'verb' => 'post',
'tokens' => [
'controller' => '[a-z_]+'
]
'controller' => '[a-z_]+',
],
],
'update.post' => [
'path' => '/{controller}/update_form',
'action' => 'form_update',
'verb' => 'post',
'tokens' => [
'controller' => '[a-z_]+'
]
'controller' => '[a-z_]+',
],
],
'edit' => [
'path' => '/{controller}/edit/{id}/{status}',
'action' => 'edit',
'tokens' => [
'id' => '[0-9a-z_]+',
'status' => '([a-zA-Z\- ]|%20)+',
]
'status' => '([a-zA-Z\-_]|%20)+',
],
],
'list' => [
'path' => '/{controller}/{type}{/view}',
'action' => AnimeClient::DEFAULT_CONTROLLER_METHOD,
'tokens' => [
'type' => '[a-z_]+',
'view' => '[a-z_]+'
]
'view' => '[a-z_]+',
],
],
'index_redirect' => [
'path' => '/',
'controller' => AnimeClient::DEFAULT_CONTROLLER_NAMESPACE,
'action' => 'redirect_to_default'
'action' => 'redirect_to_default',
],
],
]
];

View File

@ -86,7 +86,7 @@
</form>
<fieldset>
<legend>Danger Zone</legend>
<form class="js-danger" action="<?= $url->generate('anime.delete') ?>" method="post">
<form class="js-delete" action="<?= $url->generate('anime.delete') ?>" method="post">
<table class="form invisible">
<tbody>
<tr>

View File

@ -84,5 +84,21 @@
</tbody>
</table>
</form>
<fieldset>
<legend>Danger Zone</legend>
<form class="js-delete" action="<?= $url->generate('manga.delete') ?>" method="post">
<table class="form invisible">
<tbody>
<tr>
<td>&nbsp;</td>
<td>
<input type="hidden" value="<?= $item['id'] ?>" name="id" />
<button type="submit" class="danger">Delete Entry</button>
</td>
</tr>
</tbody>
</table>
</form>
</fieldset>
</main>
<?php endif ?>

View File

@ -323,7 +323,7 @@ h1 a {
.form tr > td:nth-child(even) {
text-align: left;
min-width: 70%;
width: 70%;
}
.invisible tbody > tr:nth-child(odd) {

View File

@ -201,7 +201,7 @@ a:hover, a:active {
}
.form tr > td:nth-child(even) {
text-align:left;
min-width:70%;
width:70%;
}
.invisible tbody > tr:nth-child(odd) {

View File

@ -1,4 +1,6 @@
:root {
-ms-text-size-adjust: 100%;
-webkit-text-size-adjust: 100%;
box-sizing: border-box;
cursor: default;
font-family: 'Open Sans', 'Nimbus Sans L', 'Helvetica Neue', Helvetica, 'Lucida Grande', sans-serif;
@ -17,17 +19,20 @@ details {
display: block;
}
input[type="search"] {
input[type=search] {
-webkit-appearance: textfield;
}
input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-decoration {
input[type=search]::-webkit-search-cancel-button,
input[type=search]::-webkit-search-decoration {
-webkit-appearance: none;
}
main {
display: block;
margin: 0 auto;
padding: 0 1.6em 1.6em;
padding: 0 1.6rem 1.6rem;
}
summary {
@ -35,7 +40,19 @@ summary {
}
pre {
background: #efefef;
color: #444;
display: block;
font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;
font-size: 1.4em;
font-size: 1.4rem;
margin: 1.6em 0;
margin: 1.6rem 0;
overflow: auto;
padding: 1.6em;
padding: 1.6rem;
word-break: break-all;
word-wrap: break-word;
}
progress {
@ -43,6 +60,7 @@ progress {
}
small {
color: #777;
font-size: 75%;
}
@ -55,8 +73,14 @@ template {
}
textarea {
border: .1rem solid #ccc;
border-radius: 0;
display: block;
margin-bottom: .8rem;
overflow: auto;
padding: .8rem;
resize: vertical;
vertical-align: middle;
}
[hidden] {
@ -64,9 +88,9 @@ textarea {
}
[unselectable] {
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
-webkit-user-select: none;
user-select: none;
}
@ -92,7 +116,11 @@ textarea {
}
a {
-webkit-transition: .25s ease;
color: #1271db;
text-decoration: none;
-webkit-transition: .25s ease;
transition: .25s ease;
}
audio,
@ -126,6 +154,7 @@ samp {
table {
border-collapse: collapse;
border-spacing: 0;
margin-bottom: 1.6rem;
}
::-moz-selection {
@ -142,23 +171,13 @@ button::-moz-focus-inner {
border: 0;
}
@media screen {
[hidden~="screen"] {
display: inherit;
}
[hidden~="screen"]:not(:active):not(:focus):not(:target) {
clip: rect(0 0 0 0) !important;
position: absolute !important;
}
}
body {
color: #444;
font-family: 'Open Sans', 'Nimbus Sans L', 'Helvetica Neue', Helvetica, 'Lucida Grande', sans-serif;
font-size: 1.6rem;
font-style: normal;
font-weight: 400;
padding: 0;
}
p {
@ -171,66 +190,57 @@ h3,
h4,
h5,
h6 {
font-family: 'Lato', 'Open Sans', 'Nimbus Sans L', 'Helvetica Neue', Helvetica, 'Lucida Grande', sans-serif;
font-family: Lato, 'Open Sans', 'Nimbus Sans L', 'Helvetica Neue', Helvetica, 'Lucida Grande', sans-serif;
margin: 2em 0 1.6em;
margin: 2rem 0 1.6rem;
}
h1 {
border-bottom: .1rem solid rgba(0, 0, 0, 0.2);
border-bottom: .1rem solid rgba(0,0,0,0.2);
font-size: 3.6em;
font-size: 3.6rem;
font-style: normal;
font-weight: 500;
}
h2 {
font-size: 3em;
font-size: 3rem;
font-style: normal;
font-weight: 500;
}
h3 {
font-size: 2.4em;
font-size: 2.4rem;
font-style: normal;
font-weight: 500;
margin: 1.6rem 0 0.4rem;
margin: 1.6rem 0 .4rem;
}
h4 {
font-size: 1.8em;
font-size: 1.8rem;
font-style: normal;
font-weight: 600;
margin: 1.6rem 0 0.4rem;
margin: 1.6rem 0 .4rem;
}
h5 {
font-size: 1.6em;
font-size: 1.6rem;
font-style: normal;
font-weight: 600;
margin: 1.6rem 0 0.4rem;
margin: 1.6rem 0 .4rem;
}
h6 {
color: #777;
font-size: 1.4em;
font-size: 1.4rem;
font-style: normal;
font-weight: 600;
margin: 1.6rem 0 0.4rem;
}
small {
color: #777;
}
pre {
background: #efefef;
color: #444;
display: block;
font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;
font-size: 1.4rem;
margin: 1.6rem 0;
padding: 1.6rem;
word-break: break-all;
word-wrap: break-word;
margin: 1.6rem 0 .4rem;
}
code {
@ -242,12 +252,6 @@ code {
word-wrap: break-word;
}
a {
color: #1271db;
-webkit-transition: .25s ease;
transition: .25s ease;
}
a:hover,
a:focus {
text-decoration: none;
@ -263,7 +267,7 @@ dd {
ul,
ol {
margin-bottom: 0.8rem;
margin-bottom: .8rem;
padding-left: 2rem;
}
@ -283,10 +287,6 @@ html {
font-size: 62.5%;
}
body {
padding: 0;
}
main,
header,
footer,
@ -301,14 +301,8 @@ summary {
width: 100%;
}
main {
display: block;
margin: 0 auto;
padding: 0 1.6rem 1.6rem;
}
footer {
border-top: .1rem solid rgba(0, 0, 0, 0.2);
border-top: .1rem solid rgba(0,0,0,0.2);
clear: both;
display: inline-block;
float: left;
@ -318,7 +312,7 @@ footer {
}
hr {
border-top: .1rem solid rgba(0, 0, 0, 0.2);
border-top: .1rem solid rgba(0,0,0,0.2);
display: block;
margin-bottom: 1.6rem;
width: 100%;
@ -330,39 +324,25 @@ img {
vertical-align: baseline;
}
@media screen and (max-width: 40rem) {
article,
section,
aside {
clear: both;
display: block;
max-width: 100%;
}
img {
margin-right: 1.6rem;
}
}
input[type="text"],
input[type="password"],
input[type="email"],
input[type="url"],
input[type="date"],
input[type="month"],
input[type="time"],
input[type="datetime"],
input[type="datetime-local"],
input[type="week"],
input[type="number"],
input[type="search"],
input[type="tel"],
input[type="color"],
input[type=text],
input[type=password],
input[type=email],
input[type=url],
input[type=date],
input[type=month],
input[type=time],
input[type=datetime],
input[type=datetime-local],
input[type=week],
input[type=number],
input[type=search],
input[type=tel],
input[type=color],
select {
border: .1rem solid #ccc;
border-radius: 0;
display: inline-block;
padding: 0.8rem;
padding: .8rem;
vertical-align: middle;
}
@ -374,28 +354,28 @@ input:not([type]) {
border-radius: 0;
color: #444;
display: inline-block;
padding: 0.8rem;
padding: .8rem;
text-align: left;
}
input[type="color"] {
padding: 0.8rem 1.6rem;
input[type=color] {
padding: .8rem 1.6rem;
}
input[type="text"]:focus,
input[type="password"]:focus,
input[type="email"]:focus,
input[type="url"]:focus,
input[type="date"]:focus,
input[type="month"]:focus,
input[type="time"]:focus,
input[type="datetime"]:focus,
input[type="datetime-local"]:focus,
input[type="week"]:focus,
input[type="number"]:focus,
input[type="search"]:focus,
input[type="tel"]:focus,
input[type="color"]:focus,
input[type=text]:focus,
input[type=password]:focus,
input[type=email]:focus,
input[type=url]:focus,
input[type=date]:focus,
input[type=month]:focus,
input[type=time]:focus,
input[type=datetime]:focus,
input[type=datetime-local]:focus,
input[type=week]:focus,
input[type=number]:focus,
input[type=search]:focus,
input[type=tel]:focus,
input[type=color]:focus,
select:focus,
textarea:focus {
border-color: #b3d4fc;
@ -405,31 +385,31 @@ input:not([type]):focus {
border-color: #b3d4fc;
}
input[type="radio"],
input[type="checkbox"] {
input[type=radio],
input[type=checkbox] {
vertical-align: middle;
}
input[type="file"]:focus,
input[type="radio"]:focus,
input[type="checkbox"]:focus {
input[type=file]:focus,
input[type=radio]:focus,
input[type=checkbox]:focus {
outline: .1rem solid thin #444;
}
input[type="text"][disabled],
input[type="password"][disabled],
input[type="email"][disabled],
input[type="url"][disabled],
input[type="date"][disabled],
input[type="month"][disabled],
input[type="time"][disabled],
input[type="datetime"][disabled],
input[type="datetime-local"][disabled],
input[type="week"][disabled],
input[type="number"][disabled],
input[type="search"][disabled],
input[type="tel"][disabled],
input[type="color"][disabled],
input[type=text][disabled],
input[type=password][disabled],
input[type=email][disabled],
input[type=url][disabled],
input[type=date][disabled],
input[type=month][disabled],
input[type=time][disabled],
input[type=datetime][disabled],
input[type=datetime-local][disabled],
input[type=week][disabled],
input[type=number][disabled],
input[type=search][disabled],
input[type=tel][disabled],
input[type=color][disabled],
select[disabled],
textarea[disabled] {
background-color: #efefef;
@ -458,9 +438,9 @@ select:focus:invalid {
color: #b94a48;
}
input[type="file"]:focus:invalid:focus,
input[type="radio"]:focus:invalid:focus,
input[type="checkbox"]:focus:invalid:focus {
input[type=file]:focus:invalid:focus,
input[type=radio]:focus:invalid:focus,
input[type=checkbox]:focus:invalid:focus {
outline-color: #ff4136;
}
@ -480,44 +460,38 @@ label {
fieldset {
border: 0;
margin: 0;
padding: 0.8rem 0;
padding: .8rem 0;
}
legend {
border-bottom: .1rem solid #ccc;
color: #444;
display: block;
margin-bottom: 0.8rem;
padding: 0.8rem 0;
margin-bottom: .8rem;
padding: .8rem 0;
width: 100%;
}
textarea {
border: .1rem solid #ccc;
border-radius: 0;
display: block;
margin-bottom: 0.8rem;
padding: 0.8rem;
vertical-align: middle;
}
input[type=submit],
button {
/*background-color: transparent;*/
-moz-user-select: none;
-ms-user-select: none;
-webkit-transition: .25s ease;
-webkit-user-drag: none;
-webkit-user-select: none;
border: .2rem solid #444;
border-radius: 0;
color: #444;
cursor: pointer;
display: inline-block;
margin-bottom: 0.8rem;
margin-right: 0.4rem;
padding: 0.8rem 1.6rem;
margin-bottom: .8rem;
margin-right: .4rem;
padding: .8rem 1.6rem;
text-align: center;
text-decoration: none;
text-transform: uppercase;
-webkit-transition: .25s ease;
transition: .25s ease;
-webkit-user-drag: none;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
@ -578,9 +552,10 @@ nav ul li {
}
nav a {
-webkit-transition: .25s ease;
border-bottom: .2rem solid transparent;
color: #444;
padding: 0.8rem 1.6rem;
padding: .8rem 1.6rem;
text-decoration: none;
-webkit-transition: .25s ease;
transition: .25s ease;
@ -588,19 +563,15 @@ nav a {
nav a:hover,
nav li.selected a {
border-color: rgba(0, 0, 0, 0.2);
border-color: rgba(0,0,0,0.2);
}
nav a:active {
border-color: rgba(0, 0, 0, 0.56);
}
table {
margin-bottom: 1.6rem;
border-color: rgba(0,0,0,0.56);
}
caption {
padding: 0.8rem 0;
padding: .8rem 0;
}
thead th {
@ -610,13 +581,13 @@ thead th {
tr {
background: #fff;
margin-bottom: 0.8rem;
margin-bottom: .8rem;
}
th,
td {
border: .1rem solid #ccc;
padding: 0.8rem 1.6rem;
padding: .8rem 1.6rem;
text-align: center;
vertical-align: inherit;
}
@ -627,7 +598,32 @@ tfoot tr {
tfoot td {
color: #efefef;
font-size: 0.8rem;
font-size: .8rem;
font-style: italic;
padding: 1.6rem 0.4rem;
padding: 1.6rem .4rem;
}
@media screen {
[hidden~=screen] {
display: inherit;
}
[hidden~=screen]:not(:active):not(:focus):not(:target) {
clip: rect(0000)!important;
position: absolute!important;
}
}
@media screen and max-width 40rem {
article,
section,
aside {
clear: both;
display: block;
max-width: 100%;
}
img {
margin-right: 1.6rem;
}
}

File diff suppressed because it is too large Load Diff

View File

@ -11,7 +11,7 @@
});
// Confirm deleting of list or library items
ac.on('form.js-danger', 'submit', function (event) {
ac.on('form.js-delete', 'submit', function (event) {
let proceed = confirm("Are you ABSOLUTELY SURE you want to delete this item?");
if (proceed === false) {

View File

@ -265,7 +265,7 @@ class Anime extends BaseController {
if ($response['body'] == TRUE)
{
$this->set_flash_message("Successfully deleted anime", 'success');
$this->set_flash_message("Successfully deleted anime.", 'success');
$this->cache->purge();
}
else

View File

@ -28,7 +28,7 @@ class Manga extends Controller {
/**
* The manga model
* @var object $model
* @var MangaModel $model
*/
protected $model;
@ -233,5 +233,25 @@ class Manga extends Controller {
$this->cache->purge();
$this->outputJSON($result['body'], $result['statusCode']);
}
/**
* Remove an manga from the list
*/
public function delete()
{
$response = $this->model->delete($this->request->getParsedBody());
if ($response['body'] == TRUE)
{
$this->set_flash_message("Successfully deleted manga.", 'success');
$this->cache->purge();
}
else
{
$this->set_flash_message('Failed to delete manga.', 'error');
}
$this->session_redirect();
}
}
// End of MangaController.php

View File

@ -13,11 +13,9 @@
namespace Aviat\AnimeClient\Model;
use GuzzleHttp\Cookie\Cookiejar;
use GuzzleHttp\Cookie\SetCookie;
use Aviat\Ion\Json;
use Aviat\AnimeClient\Model\API;
use Aviat\AnimeClient\Hummingbird\Transformer;
use Aviat\AnimeClient\Hummingbird\Enum\MangaReadingStatus;
@ -94,6 +92,7 @@ class Manga extends API {
* Add a manga to the list
*
* @param array $data
* @return array
*/
public function add($data)
{
@ -142,6 +141,7 @@ class Manga extends API {
*
* @param string $name
* @return array
* @throws RuntimeException
*/
public function search($name)
{
@ -197,7 +197,8 @@ class Manga extends API {
$response = $this->get('manga_library_entries', $config);
$data = $this->transform($response);
return $this->map_by_status($data);
$final = $this->map_by_status($data);
return ($status !== 'All') ? $final[$status] : $final;
}
/**