mirror of
https://gitlab.science.ru.nl/technicie/MarietjeDjango.git
synced 2025-12-09 19:52:20 +01:00
Add mute button.
This commit is contained in:
@ -18,4 +18,5 @@ urlpatterns = [
|
||||
url(r'^upload', views.upload),
|
||||
url(r'^volumedown', views.volume_down),
|
||||
url(r'^volumeup', views.volume_up),
|
||||
url(r'^mute', views.mute),
|
||||
]
|
||||
|
||||
@ -267,3 +267,13 @@ def volume_up(request):
|
||||
command = QueueCommand(queue=request.user.queue, command='volume_up')
|
||||
command.save()
|
||||
return JsonResponse({})
|
||||
|
||||
|
||||
@require_http_methods(["POST"])
|
||||
@api_auth_required
|
||||
def mute(request):
|
||||
if not request.user.has_perm('queues.can_control_volume'):
|
||||
return HttpResponseForbidden()
|
||||
command = QueueCommand(queue=request.user.queue, command='mute')
|
||||
command.save()
|
||||
return JsonResponse({})
|
||||
|
||||
@ -97,6 +97,11 @@ $(function () {
|
||||
$.post('/api/volumeup', {csrfmiddlewaretoken: csrf_token});
|
||||
});
|
||||
|
||||
$('#mute').click(function(e){
|
||||
e.preventDefault();
|
||||
$.post('/api/mute', {csrfmiddlewaretoken: csrf_token});
|
||||
});
|
||||
|
||||
$(document).on('touchstart', '.artist, .title', function(){
|
||||
noRemove = true;
|
||||
setTimeout(function(){ noRemove = false; }, 500);
|
||||
|
||||
@ -45,7 +45,10 @@
|
||||
</div>
|
||||
|
||||
<div id="queue-container">
|
||||
<h1 class="h1">Now Playing</h1>
|
||||
<h1 class="h1">
|
||||
Now Playing{% if perms.queues.can_control_volume %}
|
||||
<a id="mute" class="glyphicon glyphicon-volume-off" href="#"></a>{% endif %}
|
||||
</h1>
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
|
||||
Reference in New Issue
Block a user