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:
parent
f15605e4c1
commit
9b99eb80ed
@ -35,8 +35,10 @@ var Library = can.Control.extend({
|
|||||||
addPane: function(data) {
|
addPane: function(data) {
|
||||||
var newElement = document.createElement('div');
|
var newElement = document.createElement('div');
|
||||||
$('.browser', this.element).append(newElement);
|
$('.browser', this.element).append(newElement);
|
||||||
|
|
||||||
data['pos'] = this.panes.length;
|
data['pos'] = this.panes.length;
|
||||||
var newPane = new Pane(newElement, data);
|
var newPane = new Pane(newElement, data);
|
||||||
|
|
||||||
this.panes.push(newPane);
|
this.panes.push(newPane);
|
||||||
this.setTitle(newPane.title);
|
this.setTitle(newPane.title);
|
||||||
this.nextPane();
|
this.nextPane();
|
||||||
|
|||||||
@ -16,7 +16,7 @@ var Pane = can.Control.extend({
|
|||||||
renderPane: {
|
renderPane: {
|
||||||
root: function() {
|
root: function() {
|
||||||
this.element.html(
|
this.element.html(
|
||||||
can.view('views/library/root.ejs', {})
|
can.view('views/library/root.ejs', { pane: 0 })
|
||||||
);
|
);
|
||||||
this.title = 'Library';
|
this.title = 'Library';
|
||||||
},
|
},
|
||||||
@ -43,7 +43,7 @@ var Pane = can.Control.extend({
|
|||||||
renderCallback: function(type) {
|
renderCallback: function(type) {
|
||||||
return function(items) {
|
return function(items) {
|
||||||
$(this.element).html(
|
$(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)
|
}.bind(this)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,6 +3,7 @@
|
|||||||
<li id="<%= album.attr('id') %>">
|
<li id="<%= album.attr('id') %>">
|
||||||
<%== can.route.link(album.attr('title'), {
|
<%== can.route.link(album.attr('title'), {
|
||||||
page: 'library',
|
page: 'library',
|
||||||
|
pane: pane + 1,
|
||||||
show: 'songs',
|
show: 'songs',
|
||||||
artist: album.attr('artist'),
|
artist: album.attr('artist'),
|
||||||
album: album.attr('title')
|
album: album.attr('title')
|
||||||
|
|||||||
@ -3,6 +3,7 @@
|
|||||||
<li id="<%= artist.attr('id') %>">
|
<li id="<%= artist.attr('id') %>">
|
||||||
<%== can.route.link(artist.attr('name'), {
|
<%== can.route.link(artist.attr('name'), {
|
||||||
page: 'library',
|
page: 'library',
|
||||||
|
pane: pane + 1,
|
||||||
show: 'albums',
|
show: 'albums',
|
||||||
artist: artist.attr('name')
|
artist: artist.attr('name')
|
||||||
}) %>
|
}) %>
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
<ul class="root">
|
<ul class="root">
|
||||||
<li><%== can.route.link('Artists', { page: 'library', show: 'artists' }) %></li>
|
<li><%== can.route.link('Artists', { page: 'library', show: 'artists', pane: pane + 1 }) %></li>
|
||||||
<li><%== can.route.link('Albums', { page: 'library', show: 'albums' }) %></li>
|
<li><%== can.route.link('Albums', { page: 'library', show: 'albums', pane: pane + 1 }) %></li>
|
||||||
<li><%== can.route.link('Songs', { page: 'library', show: 'songs' }) %></li>
|
<li><%== can.route.link('Songs', { page: 'library', show: 'songs', pane: pane + 1 }) %></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user