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() {
|
$(document).ready(function() {
|
||||||
$('#transport').html(can.view('transportTemplate'));
|
// Bind transport click events.
|
||||||
|
$('#transport').on('click', '#controls button', function(e) {
|
||||||
$('#controls button').on('click', 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">
|
<script type="text/mustache-handlebars" id="transportTemplate">
|
||||||
<div id="controls">
|
<div id="controls">
|
||||||
<button>previous</button>
|
<button data-action="previous">previous</button>
|
||||||
<button>play</button>
|
<button data-action="play">play</button>
|
||||||
<button>pause</button>
|
<button data-action="pause">pause</button>
|
||||||
<button>stop</button>
|
<button data-action="stop">stop</button>
|
||||||
<button>next</button>
|
<button data-action="next">next</button>
|
||||||
</div>
|
</div>
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user