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

Can show and hide library.

This commit is contained in:
Dan Barber 2014-04-15 15:32:17 +01:00
parent 49cb0746c6
commit 87bc4a434a
6 changed files with 16 additions and 6 deletions

View File

@ -1,2 +1,7 @@
mpdClient.controller('library', function ($scope, api) { mpdClient.controller('library', function ($scope, api) {
$scope.show = false
$scope.$on('library:show', function () { $scope.show = true })
$scope.hide = function () { $scope.show = false }
}) })

View File

@ -0,0 +1,5 @@
mpdClient.controller('mpd-client', function ($rootScope, $scope) {
$scope.showLibrary = function () {
$scope.$broadcast('library:show')
}
})

0
assets/javascripts/libs/angular-resource.js vendored Executable file → Normal file
View File

View File

@ -1,6 +1,6 @@
<div id="library" ng-controller="library"> <div id="library" ng-controller="library" ng-class="{ show: show }">
<header> <header>
<a class="close" href="#!">Close</a> <a class="close" href="#" ng-click="hide()">Close</a>
<h1>Library</h1> <h1>Library</h1>
</header> </header>
</div> </div>

View File

@ -1,9 +1,9 @@
<div id="queue" ng-controller="queue"> <div id="queue">
<header> <header>
<a class="library" href="#!library">Library</a> <a class="library" href="#" ng-click="showLibrary()">Library</a>
<h1>Queue</h1> <h1>Queue</h1>
</header> </header>
<ol class="songs"> <ol class="songs" ng-controller="queue">
<li ng-repeat="song in queueSongs" ng-click="playTrack(song.pos)" ng-class="{ playing: song.playing }"> <li ng-repeat="song in queueSongs" ng-click="playTrack(song.pos)" ng-class="{ playing: song.playing }">
<p class="title">{{ song.title }}</p> <p class="title">{{ song.title }}</p>
<p class="artist">{{ song.artist }}</p> <p class="artist">{{ song.artist }}</p>

View File

@ -8,7 +8,7 @@
</head> </head>
<body> <body>
<main> <main ng-controller="mpd-client">
<div id="content"> <div id="content">
<ng-include src="'<%= asset_path 'views/library.html' %>'"></ng-include> <ng-include src="'<%= asset_path 'views/library.html' %>'"></ng-include>
<ng-include src="'<%= asset_path 'views/queue.html' %>'"></ng-include> <ng-include src="'<%= asset_path 'views/queue.html' %>'"></ng-include>