1
0
mirror of https://github.com/danbee/mpd-client synced 2025-03-04 08:39:09 +00:00

Make transport buttons work.

This commit is contained in:
Dan Barber 2013-11-29 12:41:39 +00:00
parent 64a59274e8
commit 881fdcfd96
2 changed files with 13 additions and 8 deletions

View File

@ -10,8 +10,13 @@ QueueSong.findAll({}, function(songs) {
});
$(document).ready(function() {
$('#transport').html(can.view('transportTemplate'));
$('#controls button').on('click', function(e) {
// Bind transport click events.
$('#transport').on('click', '#controls button', function(e) {
e.preventDefault();
var action = $(e.currentTarget).data('action');
can.ajax({ url: '/api/control/'+action, type: 'PUT' });
});
// Render transport
$('#transport').html(can.view('transportTemplate'));
});

View File

@ -26,11 +26,11 @@
<script type="text/mustache-handlebars" id="transportTemplate">
<div id="controls">
<button>previous</button>
<button>play</button>
<button>pause</button>
<button>stop</button>
<button>next</button>
<button data-action="previous">previous</button>
<button data-action="play">play</button>
<button data-action="pause">pause</button>
<button data-action="stop">stop</button>
<button data-action="next">next</button>
</div>
</script>