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

Add root pane.

This commit is contained in:
Dan Barber 2014-04-15 18:16:11 +01:00
parent 566147cf63
commit 8c2412ca98
5 changed files with 38 additions and 12 deletions

View File

@ -4,4 +4,25 @@ mpdClient.controller('library', function ($scope, api) {
$scope.$on('library:show', function () { $scope.show = true }) $scope.$on('library:show', function () { $scope.show = true })
$scope.hide = function () { $scope.show = false } $scope.hide = function () { $scope.show = false }
var rootPane = {
title: 'Library',
entries: [
{ label: 'Artists', path: '/artists' },
{ label: 'Albums', path: '/albums' },
{ label: 'Songs', path: '/songs' }
]
}
$scope.panes = [rootPane]
$scope.currentPaneIndex = 0
$scope.currentPane = function () {
return $scope.panes[$scope.currentPaneIndex]
}
$scope.newPane = function (path, params) {
console.log(path)
}
}) })

View File

@ -1,3 +1,5 @@
mpdClient.controller('mpd-client', function ($rootScope, $scope) { mpdClient.controller('mpd-client', function ($rootScope, $scope) {
$scope.showLibrary = function () { $scope.$broadcast('library:show') } $scope.showLibrary = function () { $scope.$broadcast('library:show') }
$scope.currentPanelTemplate = 'panels/root.html'
}) })

View File

@ -3,4 +3,5 @@
<a class="close" href="#" ng-click="hide()">Close</a> <a class="close" href="#" ng-click="hide()">Close</a>
<h1>Library</h1> <h1>Library</h1>
</header> </header>
<ng-include src="currentPanelTemplate"></ng-include>
</div> </div>

View File

@ -1,6 +1,7 @@
#library #library
background: white background: white
position: absolute position: absolute
padding: 2.5rem 0 0
top: 100% top: 100%
bottom: 0 bottom: 0
left: 0 left: 0
@ -30,10 +31,6 @@
top: 0 top: 0
header header
top: 0 top: 0
.browser
position: absolute
height: 100%
@include transition(left 0.25s ease-in-out)
ul.root, ol.artists, ol.albums ul.root, ol.artists, ol.albums
@extend .list @extend .list
ol.songs ol.songs

5
public/panels/root.html Normal file
View File

@ -0,0 +1,5 @@
<ul class="root">
<li ng-repeat="entry in currentPane().entries">
<a href="#" ng-click="newPane(entry.path, {})">{{ entry.label }}</a>
</li>
</ul>