Version 5.1 - All the GraphQL #32
@ -24,12 +24,14 @@
|
||||
<div class="media_type"><?= $item['show_type'] ?></div>
|
||||
<div class="age_rating"><?= $item['age_rating'] ?></div>
|
||||
</div>
|
||||
<?php if ($auth->is_authenticated()): ?>
|
||||
<div class="row">
|
||||
<span class="edit">[<a href="<?= $urlGenerator->url("collection/edit/{$item['hummingbird_id']}", "anime") ?>">Edit</a>]</span>
|
||||
<span class="delete">[<a href="<?= $urlGenerator->url("collection/delete/{$item['hummingbird_id']}", "anime") ?>">Delete</a>]</span>
|
||||
</div>
|
||||
<?php endif ?>
|
||||
</div>
|
||||
</article>
|
||||
|
||||
<?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>
|
||||
|
@ -16,6 +16,7 @@ tbody > tr:nth-child(odd) {
|
||||
}
|
||||
|
||||
.grow-1 {
|
||||
-webkit-box-flex: 1;
|
||||
-webkit-flex-grow: 1;
|
||||
-ms-flex-positive: 1;
|
||||
flex-grow: 1;
|
||||
@ -34,6 +35,7 @@ tbody > tr:nth-child(odd) {
|
||||
}
|
||||
|
||||
.flex-align-end {
|
||||
-webkit-box-align: end;
|
||||
-webkit-align-items: flex-end;
|
||||
-ms-flex-align: end;
|
||||
align-items: flex-end;
|
||||
@ -58,6 +60,7 @@ tbody > tr:nth-child(odd) {
|
||||
}
|
||||
|
||||
.flex {
|
||||
display: -webkit-box;
|
||||
display: -webkit-flex;
|
||||
display: -ms-flexbox;
|
||||
display: flex;
|
||||
@ -223,7 +226,9 @@ button {
|
||||
.anime .airing_status,
|
||||
.anime .user_rating,
|
||||
.anime .completion,
|
||||
.anime .age_rating {
|
||||
.anime .age_rating,
|
||||
.anime .edit,
|
||||
.anime .delete {
|
||||
background: none;
|
||||
text-align: center;
|
||||
}
|
||||
@ -240,6 +245,7 @@ button {
|
||||
.manga .row {
|
||||
width: 100%;
|
||||
background: rgba(0, 0, 0, 0.45);
|
||||
display: -webkit-box;
|
||||
display: -webkit-flex;
|
||||
display: -ms-flexbox;
|
||||
display: flex;
|
||||
|
@ -178,7 +178,9 @@ button {
|
||||
.anime .airing_status,
|
||||
.anime .user_rating,
|
||||
.anime .completion,
|
||||
.anime .age_rating {
|
||||
.anime .age_rating,
|
||||
.anime .edit,
|
||||
.anime .delete {
|
||||
background: none;
|
||||
text-align:center;
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
sonar.projectKey=animeclient
|
||||
sonar.projectName=Anime Client
|
||||
sonar.projectVersion=1.0
|
||||
sonar.projectVersion=2.0.0
|
||||
sonar.sources=src
|
||||
sonar.php.coverage.reportPath=build/logs/clover.xml
|
||||
sonar.php.tests.reportPath=build/logs/junit.xml
|
@ -27,10 +27,16 @@ class Collection extends BaseController {
|
||||
|
||||
/**
|
||||
* The anime collection model
|
||||
* @var object $anime_collection_model
|
||||
* @var AnimeCollectionModel $anime_collection_model
|
||||
*/
|
||||
private $anime_collection_model;
|
||||
|
||||
/**
|
||||
* The anime API model
|
||||
* @var AnimeModel $anime_model
|
||||
*/
|
||||
private $anime_model;
|
||||
|
||||
/**
|
||||
* Data to ve sent to all routes in this controller
|
||||
* @var array $base_data
|
||||
@ -151,5 +157,23 @@ class Collection extends BaseController {
|
||||
|
||||
$this->redirect("collection/view", 303);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a collection item
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function delete()
|
||||
{
|
||||
$data = $this->request->post->get();
|
||||
if ( ! array_key_exists('id', $data))
|
||||
{
|
||||
$this->redirect("collection/view", 303);
|
||||
}
|
||||
|
||||
$this->anime_collection_model->delete($data);
|
||||
|
||||
$this->redirect("collection/view", 303);
|
||||
}
|
||||
}
|
||||
// End of CollectionController.php
|
@ -261,6 +261,23 @@ class AnimeCollection extends DB {
|
||||
->update('anime_set');
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a colleciton item
|
||||
* @param array $data
|
||||
* @return void
|
||||
*/
|
||||
public function delete($data)
|
||||
{
|
||||
// If there's no id to update, don't delete
|
||||
if ( ! array_key_exists('hummingbird_id', $data))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
$this->db->where('hummingbird_id', $data['hummingbird_id'])
|
||||
->delete('anime_set');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the details of a collection item
|
||||
*
|
||||
|
@ -39,7 +39,7 @@ class DB extends BaseModel {
|
||||
public function __construct(ContainerInterface $container)
|
||||
{
|
||||
parent::__construct($container);
|
||||
$this->db_config = $this->config->get('database');
|
||||
$this->db_config = (array) $this->config->get('database');
|
||||
}
|
||||
}
|
||||
// End of BaseDBModel.php
|
Loading…
Reference in New Issue
Block a user