mirror of
https://github.com/atom/atom.git
synced 2026-04-06 03:02:13 -04:00
CoffeeScript is still a global because it's used by require() to
open .coffee files. However, you can also load your own:
cs4 = require('my-coffee-script').CoffeeScript
🚬
32 lines
724 B
CoffeeScript
32 lines
724 B
CoffeeScript
$ = require 'jquery'
|
|
_ = require 'underscore'
|
|
|
|
{Chrome, Dir, File, Process} = require 'osx'
|
|
{bindKey} = require 'editor'
|
|
|
|
exports.init = ->
|
|
@html = File.read(Chrome.appRoot() + "/plugins/project/project.html")
|
|
|
|
bindKey 'toggleProjectDrawer', 'Command-Ctrl-N', (env) =>
|
|
@toggle()
|
|
|
|
exports.toggle = ->
|
|
if @showing
|
|
$('#project').parent().remove()
|
|
else
|
|
Chrome.addPane 'left', @html
|
|
@reload()
|
|
|
|
@showing = not @showing
|
|
|
|
exports.reload = ->
|
|
dir = OSX.NSFileManager.defaultManager.currentDirectoryPath
|
|
$('#project .cwd').text(dir)
|
|
|
|
files = Dir.list(dir)
|
|
listItems = _.map files, (file) ->
|
|
file = file.replace(dir, "")
|
|
"<li>#{file}</li>"
|
|
|
|
$('#project .files').append(listItems.join('\n'))
|