From 9b48cdad23752210b87ff6e9bc7efd0380648e3f Mon Sep 17 00:00:00 2001 From: Dan Barber Date: Wed, 8 Jan 2014 15:02:44 +0000 Subject: [PATCH] Library now pops up. --- assets/js/components/library.js | 24 ++++++++++++++++++++++++ assets/js/mpd-client.js | 3 +-- assets/js/routes.js | 2 +- 3 files changed, 26 insertions(+), 3 deletions(-) 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();