From ff3bb3bdece329b81ac76d705d5d16e01693d9bd Mon Sep 17 00:00:00 2001 From: Dan Barber Date: Tue, 17 Dec 2013 11:42:30 +0000 Subject: [PATCH] Add back button. Just needs plumbing in. --- assets/css/library.css.sass | 9 +++++++++ assets/js/controls/library.js | 9 ++++++++- public/views/library.ejs | 3 +++ 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/assets/css/library.css.sass b/assets/css/library.css.sass index 1123609..321de6a 100644 --- a/assets/css/library.css.sass +++ b/assets/css/library.css.sass @@ -16,6 +16,15 @@ right: 10px top: 8px @include button + a.back + position: absolute + left: 10px + top: 8px + &:before + margin-right: 0.25em + @extend .icon + @extend .icon-chevron-left + @include button &.show top: 0 header diff --git a/assets/js/controls/library.js b/assets/js/controls/library.js index df34749..f54db52 100644 --- a/assets/js/controls/library.js +++ b/assets/js/controls/library.js @@ -44,6 +44,10 @@ var Library = can.Control.extend({ this.nextPane(); }, + removePane: function(data) { + this.previousPane(); + }, + 'a.close click': 'hide', 'route': function(data) { @@ -53,9 +57,12 @@ var Library = can.Control.extend({ ':page route': function(data) { if (data.page == 'library') { this.show(); - if (data.show) { + if (data.pane > this.browser.currentPane) { this.addPane(data); } + else if (data.pane < this.browser.currentPane) { + this.removePane(data); + } } } diff --git a/public/views/library.ejs b/public/views/library.ejs index 0434303..0d01f64 100644 --- a/public/views/library.ejs +++ b/public/views/library.ejs @@ -1,4 +1,7 @@
+ <% if (browser.attr('currentPane') > 0) { %> + <%== can.route.link('Back', { page: 'library', pane: browser.attr('currentPane') - 1 }, { class: 'back' }) %> + <% } %> Close

<%= browser.attr('title') %>