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">
......@@ -41,7 +45,7 @@
<div class="row">
<div class="col mt-3">
<div class="row">
<div class="col">
<div class="col">
<h5 class="float-right">
<button type="button" class="btn btn-sm btn-secondary dropdown-toggle" data-toggle="dropdown" id="dropdownMenuButton" aria-haspopup="true" aria-expanded="false">
<i class="fa fa-plus" aria-hidden="true"></i> {{ 'add_round' | trans }}
......@@ -51,36 +55,36 @@
<a data-message="Ajout d'une partie conquer" class="dropdown-item please-wait" href="{{ path('massive_add_conquer', {"id": massive.id}) }}">{{ 'conquer' | trans }}</a>
</div>
</h5>
</div>
</div>
</div>
<ul class="list-group">
{% for i, round in massive.rounds %}
<ul class="list-group">
{% for i, round in massive.rounds %}
<li class="list-group-item round">
{% set order = i + 1 %}
{{order}} - {{ round.discr | trans }} - {{ round.language.value | trans }}
- {{ round.title ? round.title : "(pas de titre)" }}
{% if round.description %}<span class="text-muted">({{ round.description }})</span>{% endif %}
<span class="float-right btns">
<div class="btn-group">
<a onclick="builder.reorder()" class="btn btn-outline-secondary btn-sm {% if order == 1 %}disabled{% endif %}" href="{{ path('round_move_up', {"massiveId": massive.id, "roundId": round.id }) }}">
<i class="fa fa-arrow-up" aria-hidden="true"></i>
</a>
<a onclick="builder.reorder()" class="btn btn-outline-secondary btn-sm {% if order == massive.rounds|length %}disabled{% endif %}" href="{{ path('round_move_down', {"massiveId": massive.id, "roundId": round.id }) }}">
<i class="fa fa-arrow-down" aria-hidden="true"></i>
</a>
</div>
<a class="btn btn-secondary btn-sm" href="{{ path('round_edit', {"id": round.id }) }}">
<i class="fas fa-edit" aria-hidden="true"></i>
<span class="d-none d-md-inline">{{ 'edit_round' | trans }}</span>
</a>
<a class="btn btn-sm btn-danger" href="{{ path('massive_remove_round', {"massiveId": massive.id, "roundId": round.id }) }}">
<i class="fa fa-times" aria-hidden="true"></i>
</a>
</span>
{% set order = i + 1 %}
{{order}} - {{ round.discr | trans }} - {{ round.language.value | trans }}
- {{ round.title ? round.title : "(pas de titre)" }}
{% if round.description %}<span class="text-muted">({{ round.description }})</span>{% endif %}
<span class="float-right btns">
<div class="btn-group">
<a onclick="builder.reorder()" class="btn btn-outline-secondary btn-sm {% if order == 1 %}disabled{% endif %}" href="{{ path('round_move_up', {"massiveId": massive.id, "roundId": round.id }) }}">
<i class="fa fa-arrow-up" aria-hidden="true"></i>
</a>
<a onclick="builder.reorder()" class="btn btn-outline-secondary btn-sm {% if order == massive.rounds|length %}disabled{% endif %}" href="{{ path('round_move_down', {"massiveId": massive.id, "roundId": round.id }) }}">
<i class="fa fa-arrow-down" aria-hidden="true"></i>
</a>
</div>
<a class="btn btn-secondary btn-sm" href="{{ path('round_edit', {"id": round.id }) }}">
<i class="fas fa-edit" aria-hidden="true"></i>
<span class="d-none d-md-inline">{{ 'edit_round' | trans }}</span>
</a>
<a class="btn btn-sm btn-danger" href="{{ path('massive_remove_round', {"massiveId": massive.id, "roundId": round.id }) }}">
<i class="fa fa-times" aria-hidden="true"></i>
</a>
</span>
</li>
{% endfor %}
</ul>
{% endfor %}
</ul>
</div>
</div>
</div>
......@@ -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