From 5c54dd77c9be1d91271817ffff2a3bd5496f91ed Mon Sep 17 00:00:00 2001 From: Corey Johnson Date: Fri, 23 Sep 2011 16:16:27 -0700 Subject: [PATCH] pane adds itself. --- src/pane.coffee | 27 +++++++++++++++++++++++++-- src/window.coffee | 20 -------------------- 2 files changed, 25 insertions(+), 22 deletions(-) diff --git a/src/pane.coffee b/src/pane.coffee index 8359dae62..cc4978f88 100644 --- a/src/pane.coffee +++ b/src/pane.coffee @@ -1,4 +1,4 @@ -{bindKey} = require 'keybinder' +$ = require 'jquery' module.exports = class Pane @@ -9,12 +9,35 @@ class Pane showing: false constructor: (@window) -> + $('.pane').live 'click', (event) => + console.log @.constructor.name + true + + add: -> + verticalDiv = $('#app-vertical') + horizontalDiv = $('#app-horizontal') + + el = $ "
" + el.addClass "pane " + @position + el.append @html + + switch @position + when 'top', 'main' + verticalDiv.prepend el + when 'left' + horizontalDiv.prepend el + when 'bottom' + verticalDiv.append el + when 'right' + horizontalDiv.append el + else + throw "I DON'T KNOW HOW TO DEAL WITH #{@position}" toggle: -> if @showing @html.parent().detach() else - @window.addPane this + @add this @showing = not @showing diff --git a/src/window.coffee b/src/window.coffee index 045d06356..33cc1173a 100644 --- a/src/window.coffee +++ b/src/window.coffee @@ -55,26 +55,6 @@ class Window console.warn "Plugin Loading Failed: #{plugin.constructor.name}" console.warn error - addPane: ({position, html}) -> - verticalDiv = $('#app-vertical') - horizontalDiv = $('#app-horizontal') - - el = $ "
" - el.addClass "pane " + position - el.append html - - switch position - when 'top', 'main' - verticalDiv.prepend el - when 'left' - horizontalDiv.prepend el - when 'bottom' - verticalDiv.append el - when 'right' - horizontalDiv.append el - else - throw "I DON'T KNOW HOW TO DEAL WITH #{position}" - close: -> @controller.close()