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

Add pane number to browser links.

This commit is contained in:
Dan Barber 2013-12-13 16:54:26 +00:00
parent f15605e4c1
commit 9b99eb80ed
5 changed files with 9 additions and 5 deletions

View File

@ -35,8 +35,10 @@ var Library = can.Control.extend({
addPane: function(data) {
var newElement = document.createElement('div');
$('.browser', this.element).append(newElement);
data['pos'] = this.panes.length;
var newPane = new Pane(newElement, data);
this.panes.push(newPane);
this.setTitle(newPane.title);
this.nextPane();

View File

@ -16,7 +16,7 @@ var Pane = can.Control.extend({
renderPane: {
root: function() {
this.element.html(
can.view('views/library/root.ejs', {})
can.view('views/library/root.ejs', { pane: 0 })
);
this.title = 'Library';
},
@ -43,7 +43,7 @@ var Pane = can.Control.extend({
renderCallback: function(type) {
return function(items) {
$(this.element).html(
can.view('views/library/' + type + '.ejs', { items: items }, { formatLength: timeHelpers.formatLength })
can.view('views/library/' + type + '.ejs', { items: items, pane: this.data.pos }, { formatLength: timeHelpers.formatLength })
);
}.bind(this)
}

View File

@ -3,6 +3,7 @@
<li id="<%= album.attr('id') %>">
<%== can.route.link(album.attr('title'), {
page: 'library',
pane: pane + 1,
show: 'songs',
artist: album.attr('artist'),
album: album.attr('title')

View File

@ -3,6 +3,7 @@
<li id="<%= artist.attr('id') %>">
<%== can.route.link(artist.attr('name'), {
page: 'library',
pane: pane + 1,
show: 'albums',
artist: artist.attr('name')
}) %>

View File

@ -1,5 +1,5 @@
<ul class="root">
<li><%== can.route.link('Artists', { page: 'library', show: 'artists' }) %></li>
<li><%== can.route.link('Albums', { page: 'library', show: 'albums' }) %></li>
<li><%== can.route.link('Songs', { page: 'library', show: 'songs' }) %></li>
<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>
</ul>