mirror of
https://github.com/danbee/mpd-client
synced 2025-03-04 08:39:09 +00:00
Can browse down through library.
This commit is contained in:
parent
226da39e59
commit
9d3916c892
@ -14,6 +14,8 @@ mpdClient.controller('library', function ($scope, api) {
|
||||
]
|
||||
}
|
||||
|
||||
$scope.currentPanelTemplate = 'panels/root.html'
|
||||
|
||||
$scope.panes = [rootPane]
|
||||
|
||||
$scope.currentPaneIndex = 0
|
||||
@ -22,7 +24,14 @@ mpdClient.controller('library', function ($scope, api) {
|
||||
return $scope.panes[$scope.currentPaneIndex]
|
||||
}
|
||||
|
||||
$scope.newPane = function (path, params) {
|
||||
console.log(path)
|
||||
$scope.newPane = function (path, params, queryParams) {
|
||||
$scope.panes.push({
|
||||
title: params.title,
|
||||
entries: api.getItems(path).query(queryParams)
|
||||
})
|
||||
|
||||
$scope.currentPaneIndex += 1
|
||||
|
||||
$scope.currentPanelTemplate = 'panels' + path + '.html'
|
||||
}
|
||||
})
|
||||
|
||||
@ -1,5 +1,3 @@
|
||||
mpdClient.controller('mpd-client', function ($rootScope, $scope) {
|
||||
$scope.showLibrary = function () { $scope.$broadcast('library:show') }
|
||||
|
||||
$scope.currentPanelTemplate = 'panels/root.html'
|
||||
})
|
||||
|
||||
@ -17,6 +17,10 @@ mpdClient.factory('api', function ($rootScope, $http, $resource) {
|
||||
|
||||
getQueue: function () {
|
||||
return $resource(apiUrl + '/queue')
|
||||
},
|
||||
|
||||
getItems: function (path) {
|
||||
return $resource(apiUrl + path)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
6
public/panels/albums.html
Normal file
6
public/panels/albums.html
Normal file
@ -0,0 +1,6 @@
|
||||
<ol class="albums">
|
||||
<li ng-repeat="entry in currentPane().entries"
|
||||
ng-click="newPane('/songs', { title: entry.title }, { artist: entry.artist, album: entry.title })">
|
||||
{{ entry.title }}
|
||||
</li>
|
||||
</ol>
|
||||
6
public/panels/artists.html
Normal file
6
public/panels/artists.html
Normal file
@ -0,0 +1,6 @@
|
||||
<ol class="artists">
|
||||
<li ng-repeat="entry in currentPane().entries"
|
||||
ng-click="newPane('/albums', { title: entry.name }, { artist: entry.name })">
|
||||
{{ entry.name }}
|
||||
</li>
|
||||
</ol>
|
||||
@ -1,3 +1,6 @@
|
||||
<ul class="root">
|
||||
<li ng-repeat="entry in currentPane().entries" ng-click="newPane(entry.path, {})">{{ entry.label }}</li>
|
||||
<li ng-repeat="entry in currentPane().entries"
|
||||
ng-click="newPane(entry.path, { title: entry.label })">
|
||||
{{ entry.label }}
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
7
public/panels/songs.html
Normal file
7
public/panels/songs.html
Normal file
@ -0,0 +1,7 @@
|
||||
<ol class="songs">
|
||||
<li ng-repeat="entry in currentPane().entries" ng-click="newPane('/songs', { title: entry.title, artist: entry.artist })">
|
||||
<p class="title">{{ entry.title }}</p>
|
||||
<p class="artist">{{ entry.artist }}</p>
|
||||
<p class="length">{{ entry.length | formatLength }}</p>
|
||||
</li>
|
||||
</ol>
|
||||
Loading…
Reference in New Issue
Block a user