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