Add ability to delete items from manga list. See #10

This commit is contained in:
Timothy Warren 2016-04-14 17:00:34 -04:00
parent d17549c0fb
commit 01d25f2817
11 changed files with 820 additions and 592 deletions

View File

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

View File

@ -86,7 +86,7 @@
</form> </form>
<fieldset> <fieldset>
<legend>Danger Zone</legend> <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"> <table class="form invisible">
<tbody> <tbody>
<tr> <tr>

View File

@ -84,5 +84,21 @@
</tbody> </tbody>
</table> </table>
</form> </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> </main>
<?php endif ?> <?php endif ?>

View File

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

View File

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

View File

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

View File

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

View File

@ -28,7 +28,7 @@ class Manga extends Controller {
/** /**
* The manga model * The manga model
* @var object $model * @var MangaModel $model
*/ */
protected $model; protected $model;
@ -233,5 +233,25 @@ class Manga extends Controller {
$this->cache->purge(); $this->cache->purge();
$this->outputJSON($result['body'], $result['statusCode']); $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 // End of MangaController.php

View File

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