Commit 54dbd003 authored by SpinShare's avatar SpinShare

added tournament switch for mods

parent 1d2185cf
...@@ -320,4 +320,21 @@ class ModactionsController extends AbstractController ...@@ -320,4 +320,21 @@ class ModactionsController extends AbstractController
return $this->redirectToRoute('user.detail', array('userId' => $userId)); return $this->redirectToRoute('user.detail', array('userId' => $userId));
} }
/**
* @Route("/moderation/song/toggleTournament/{songId}", name="moderation.song.toggleTournament")
*/
public function userToggleTournament(Request $request, int $songId)
{
$em = $this->getDoctrine()->getManager();
$data = [];
$songToToggle = $em->getRepository(Song::class)->findOneBy(array('id' => $songId));
$songToToggle->setIsTournament(!$songToToggle->getIsTournament());
$em->persist($songToToggle);
$em->flush();
return $this->redirectToRoute('song.detail', array('songId' => $songId));
}
} }
...@@ -68,6 +68,17 @@ ...@@ -68,6 +68,17 @@
</a> </a>
{% endif %} {% endif %}
{% endif %} {% endif %}
{% if is_granted('ROLE_MODERATOR') %}
<a href="{{ path('moderation.song.toggleTournament', {songId: song.id}) }}" class="action">
<div class="icon">
{% if song.isTournament %}
<i class="mdi mdi-heart-remove"></i>
{% else %}
<i class="mdi mdi-heart-plus"></i>
{% endif %}
</div>
</a>
{% endif %}
</div> </div>
<div class="song-statistics"> <div class="song-statistics">
<div class="stat"> <div class="stat">
......
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