1
0
mirror of https://github.com/danbee/mpd-client synced 2025-03-04 08:39:09 +00:00
mpd-client/assets/js/components/panel.js
2013-12-19 14:50:31 +00:00

40 lines
720 B
JavaScript

can.Component.extend({
init: function() {
console.log('Initializing');
},
tag: 'panel',
template: can.view('views/panel.mustache'),
scope: {
show: '@',
artist: '@',
album: '@',
title: function() {
if (this.show == 'root')
return 'Library';
},
fetchItems: {
root: new can.Map,
artists: Artist.findAll({}),
albums: Album.findAll({ artist: this.artist }),
songs: Song.findAll({ artist: this.artist, album: this.album })
}
},
events: {
inserted: function() {
console.log('Panel inserted.');
}
},
helpers: {
renderItems: function() {
return can.view.render('views/library/' + this.show, {});
}
}
});