diff --git a/assets/js/components/library.js b/assets/js/components/library.js index 1b5a831..83ff0f5 100644 --- a/assets/js/components/library.js +++ b/assets/js/components/library.js @@ -4,4 +4,28 @@ can.Component.extend({ template: can.view('views/library.mustache'), + events: { + show: function() { + $(this.element).addClass('show'); + }, + + hide: function() { + $(this.element).removeClass('show'); + }, + + 'a.close click': 'hide', + + ':type route': function(data) { + if (data.type == 'library') { + this.show(); + if (data.pane > this.browser.currentPane) { + this.addPane(data); + } + else if (data.pane < this.browser.currentPane) { + this.removePane(data); + } + } + } + } + }); diff --git a/assets/js/mpd-client.js b/assets/js/mpd-client.js index 3e3b82a..0375d66 100644 --- a/assets/js/mpd-client.js +++ b/assets/js/mpd-client.js @@ -4,8 +4,7 @@ //= require ./routes.js //= require_tree ./helpers/ -//= require_tree ./models/ -//= require_tree ./controls/ //= require_tree ./constructs/ +//= require_tree ./models/ //= require_tree ./components/ //= require ./application.js diff --git a/assets/js/routes.js b/assets/js/routes.js index 723926a..c57b060 100644 --- a/assets/js/routes.js +++ b/assets/js/routes.js @@ -1,2 +1,2 @@ -can.route(':page'); +can.route(':type'); can.route.ready();