mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
Added toggle to Pane. Makes more sense there.
Also made pane be more jquery'y
This commit is contained in:
@@ -10,7 +10,9 @@ class Project extends Pane
|
||||
showing: false
|
||||
|
||||
position: 'left'
|
||||
html: require "project/project.html"
|
||||
|
||||
html:
|
||||
$ require "project/project.html"
|
||||
|
||||
keymap:
|
||||
'Command-Ctrl-N': 'toggle'
|
||||
@@ -36,19 +38,9 @@ class Project extends Pane
|
||||
|
||||
false # Don't bubble!
|
||||
|
||||
toggle: ->
|
||||
if @showing
|
||||
$('#project').parent().remove()
|
||||
else
|
||||
activeWindow.addPane this
|
||||
@reload()
|
||||
|
||||
@showing = not @showing
|
||||
|
||||
reload: ->
|
||||
$('#project .cwd').text _.last dir.split '/'
|
||||
$('#project li').remove()
|
||||
$('#project .files').append @createList dir
|
||||
@html.children('#project .cwd').text _.last @dir.split '/'
|
||||
@html.children('#project li').remove()
|
||||
@html.children('#project .files').append @createList @dir
|
||||
|
||||
createList: (dir) ->
|
||||
files = File.list dir
|
||||
|
||||
@@ -26,4 +26,15 @@ class Pane
|
||||
@initialize options
|
||||
|
||||
# Override in your subclass
|
||||
initialize: ->
|
||||
initialize: ->
|
||||
|
||||
toggle: ->
|
||||
if @showing
|
||||
@html.parent().detach()
|
||||
else
|
||||
# This require should be at the top of the file, BUT it doesn't work.
|
||||
# Would like to figure out why.
|
||||
{activeWindow} = require 'app'
|
||||
activeWindow.addPane this
|
||||
|
||||
@showing = not @showing
|
||||
|
||||
@@ -24,9 +24,9 @@ class Window extends Pane
|
||||
verticalDiv = $('#app-vertical')
|
||||
horizontalDiv = $('#app-horizontal')
|
||||
|
||||
el = document.createElement "div"
|
||||
el.setAttribute 'class', "pane " + position
|
||||
el.innerHTML = html
|
||||
el = $ "<div>"
|
||||
el.addClass "pane " + position
|
||||
el.append html
|
||||
|
||||
switch position
|
||||
when 'top', 'main'
|
||||
|
||||
Reference in New Issue
Block a user