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

Library has single panel.

This commit is contained in:
Dan Barber 2014-01-08 17:47:29 +00:00
parent 9b48cdad23
commit b297e11cb8
4 changed files with 34 additions and 27 deletions

View File

@ -29,20 +29,15 @@ mpd-library
top: 0
header
top: 0
.browser
position: absolute
height: 100%
ul, ol
width: 100%
@include transition(left 0.25s ease-in-out)
ul, ol
width: 100%
ul.root, ol.artists, ol.albums
@extend .list
ol.songs
@extend .song-list
mpd-panel
position: absolute
width: $interface-width
height: 100%
padding: 2.5em 0 0
overflow: auto
ul.root, ol.artists, ol.albums
@extend .list
ol.songs
@extend .song-list
mpd-panel
position: absolute
width: $interface-width
height: 100%
padding: 2.5em 0 0
overflow: auto

View File

@ -4,6 +4,10 @@ can.Component.extend({
template: can.view('views/library.mustache'),
scope: {
currentPane: 0
},
events: {
show: function() {
$(this.element).addClass('show');
@ -13,15 +17,17 @@ can.Component.extend({
$(this.element).removeClass('show');
},
'a.close click': 'hide',
'route': function(data) {
this.hide();
},
':type route': function(data) {
if (data.type == 'library') {
this.show();
if (data.pane > this.browser.currentPane) {
if (data.pane > this.currentPane) {
this.addPane(data);
}
else if (data.pane < this.browser.currentPane) {
else if (data.pane < this.currentPane) {
this.removePane(data);
}
}

View File

@ -10,22 +10,30 @@ can.Component.extend({
artist: '@',
album: '@',
title: function() {
if (this.show == 'root')
return 'Library';
if (this.show == 'root') return 'Library';
},
fetchItems: {
root: new can.Map,
root: new can.List(['Artists', 'Albums', 'Songs']),
artists: function() { return Artist.findAll({}) },
albums: function() { Album.findAll({ artist: this.artist }) },
songs: function() { Song.findAll({ artist: this.artist, album: this.album }) }
}
},
events: {},
events: {
},
helpers: {
renderItems: function() {
return can.view.render('views/library/' + this.show, {});
return can.view.render('views/library/' + this.show, {
items: this.fetchItems.root
});
},
rootLink: function(label, show) {
return can.route.link(label, {
type: 'library', show: show
});
}
}

View File

@ -1,5 +1,3 @@
<ul class="root">
<li>{{can.route.link('Artists', { page: 'library', show: 'artists', pane: pane + 1 })}}</li>
<li>{{can.route.link('Albums', { page: 'library', show: 'albums', pane: pane + 1 })}}</li>
<li>{{can.route.link('Songs', { page: 'library', show: 'songs', pane: pane + 1 })}}</li>
<li>{{{rootLink 'Artists', 'artists'}}}</li>
</ul>