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:
parent
64a59274e8
commit
881fdcfd96
@ -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'));
|
||||
});
|
||||
|
||||
@ -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>
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user