Commit aba0c5cf authored by Arnaud Bey's avatar Arnaud Bey
Browse files

unpublished games can be deleted.

parent bb56fc6c
......@@ -82,4 +82,16 @@ class GameController extends Controller
return $response;
}
/**
* @Route("/game/delete/{id}", name="game_delete")
* @Method("GET")
*/
public function deleteAction(Game $game)
{
$this->get('mw_manager.game')->delete($game);
return $this->redirectToRoute('my_massives_under_construction');
}
}
......@@ -56,4 +56,14 @@ class GameManager
return;
}
public function delete(Game $game)
{
if ($this->currentUser == $game->getAuthor()) {
$this->em->remove($game);
$this->em->flush();
}
return;
}
}
......@@ -24,6 +24,10 @@
<i class="fas fa-clipboard-check"></i>
Publier
</a>
<a class="btn btn-outline-secondary btn-sm" href="#" data-toggle="modal" data-target="#deleteModal">
<i class="far fa-trash-alt"></i>
Supprimer
</a>
</span>
</div>
<div class="card-body">
......@@ -95,6 +99,27 @@
</div>
</div>
<div id="deleteModal" class="modal" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Suppression partie</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<p>Êtes vous sûr de vouloir supprimer cette partie ?</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">{{'close'|trans}}</button>
<a class="btn btn-danger" href="{{ path('game_delete', {"id": massive.id }) }}">Oui, supprimer</a>
</div>
</div>
</div>
</div>
{% include "MagicWordBundle:Game/Massive/partials:export-modal.html.twig" %}
{% endblock %}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment