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:
parent
9b48cdad23
commit
b297e11cb8
@ -29,20 +29,15 @@ mpd-library
|
|||||||
top: 0
|
top: 0
|
||||||
header
|
header
|
||||||
top: 0
|
top: 0
|
||||||
.browser
|
ul, ol
|
||||||
position: absolute
|
|
||||||
height: 100%
|
|
||||||
width: 100%
|
width: 100%
|
||||||
@include transition(left 0.25s ease-in-out)
|
ul.root, ol.artists, ol.albums
|
||||||
ul, ol
|
@extend .list
|
||||||
width: 100%
|
ol.songs
|
||||||
ul.root, ol.artists, ol.albums
|
@extend .song-list
|
||||||
@extend .list
|
mpd-panel
|
||||||
ol.songs
|
position: absolute
|
||||||
@extend .song-list
|
width: $interface-width
|
||||||
mpd-panel
|
height: 100%
|
||||||
position: absolute
|
padding: 2.5em 0 0
|
||||||
width: $interface-width
|
overflow: auto
|
||||||
height: 100%
|
|
||||||
padding: 2.5em 0 0
|
|
||||||
overflow: auto
|
|
||||||
|
|||||||
@ -4,6 +4,10 @@ can.Component.extend({
|
|||||||
|
|
||||||
template: can.view('views/library.mustache'),
|
template: can.view('views/library.mustache'),
|
||||||
|
|
||||||
|
scope: {
|
||||||
|
currentPane: 0
|
||||||
|
},
|
||||||
|
|
||||||
events: {
|
events: {
|
||||||
show: function() {
|
show: function() {
|
||||||
$(this.element).addClass('show');
|
$(this.element).addClass('show');
|
||||||
@ -13,15 +17,17 @@ can.Component.extend({
|
|||||||
$(this.element).removeClass('show');
|
$(this.element).removeClass('show');
|
||||||
},
|
},
|
||||||
|
|
||||||
'a.close click': 'hide',
|
'route': function(data) {
|
||||||
|
this.hide();
|
||||||
|
},
|
||||||
|
|
||||||
':type route': function(data) {
|
':type route': function(data) {
|
||||||
if (data.type == 'library') {
|
if (data.type == 'library') {
|
||||||
this.show();
|
this.show();
|
||||||
if (data.pane > this.browser.currentPane) {
|
if (data.pane > this.currentPane) {
|
||||||
this.addPane(data);
|
this.addPane(data);
|
||||||
}
|
}
|
||||||
else if (data.pane < this.browser.currentPane) {
|
else if (data.pane < this.currentPane) {
|
||||||
this.removePane(data);
|
this.removePane(data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,22 +10,30 @@ can.Component.extend({
|
|||||||
artist: '@',
|
artist: '@',
|
||||||
album: '@',
|
album: '@',
|
||||||
title: function() {
|
title: function() {
|
||||||
if (this.show == 'root')
|
if (this.show == 'root') return 'Library';
|
||||||
return 'Library';
|
|
||||||
},
|
},
|
||||||
fetchItems: {
|
fetchItems: {
|
||||||
root: new can.Map,
|
root: new can.List(['Artists', 'Albums', 'Songs']),
|
||||||
artists: function() { return Artist.findAll({}) },
|
artists: function() { return Artist.findAll({}) },
|
||||||
albums: function() { Album.findAll({ artist: this.artist }) },
|
albums: function() { Album.findAll({ artist: this.artist }) },
|
||||||
songs: function() { Song.findAll({ artist: this.artist, album: this.album }) }
|
songs: function() { Song.findAll({ artist: this.artist, album: this.album }) }
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
events: {},
|
events: {
|
||||||
|
},
|
||||||
|
|
||||||
helpers: {
|
helpers: {
|
||||||
renderItems: function() {
|
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
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,3 @@
|
|||||||
<ul class="root">
|
<ul class="root">
|
||||||
<li>{{can.route.link('Artists', { page: 'library', show: 'artists', pane: pane + 1 })}}</li>
|
<li>{{{rootLink 'Artists', 'artists'}}}</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>
|
|
||||||
</ul>
|
</ul>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user