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

WIP: Add marker and move away from rootscope.

This commit is contained in:
Dan Barber 2014-03-20 12:41:27 +00:00
parent 0ae60095a4
commit 7e4aa10b4d
3 changed files with 9 additions and 8 deletions

View File

@ -1,10 +1,10 @@
mpdClient.controller('queue', function ($rootScope, $scope, $resource, serverEvents) {
mpdClient.controller('queue', function ($scope, $resource, serverEvents) {
var Queue = $resource('/api/queue')
$rootScope.queueSongs = Queue.query()
$scope.queueSongs = Queue.query()
$scope.updateQueue = function(data) {
$rootScope.queueSongs = data
$scope.queueSongs = data
}
serverEvents.onUpdateQueue($scope.updateQueue)

View File

@ -1,20 +1,20 @@
mpdClient.controller('transport', function ($rootScope, $scope, $http, serverEvents) {
mpdClient.controller('transport', function ($scope, $http, serverEvents) {
var Status = $http({ method: 'GET', url: '/api/status' })
$rootScope.status = {}
$scope.status = {}
Status.success(function (data, status, headers, config) {
$scope.updateStatus(data)
})
$scope.updateStatus = function(data) {
$rootScope.status = data
$scope.status = data
if (data.time) { $scope.updateTime(data.time) }
}
$scope.updateTime = function(data) {
$rootScope.elapsedTime = data[0]
$rootScope.totalTime = data[1]
$scope.elapsedTime = data[0]
$scope.totalTime = data[1]
}
$scope.sendCommand = function (command) {

View File

@ -28,6 +28,7 @@
<div class="time elapsed">{{ elapsedTime | formatLength }}</div>
<div class="time total">{{ totalTime | formatLength }}</div>
<div class="track">
<div class="marker" style="left: {{ markerPosition }}%"></div>
</div>
</div>
<nav class="controls">