Meta-t adds file finder to bottom of layout.

This commit is contained in:
Corey Johnson & Nathan Sobo
2011-12-28 16:30:08 -06:00
parent cc2b28451c
commit c6d90748f7
7 changed files with 36 additions and 31 deletions

View File

@@ -16,7 +16,7 @@ class FileFinder extends Template
populateUrlList: ->
@urlList.empty()
for url in @findMatches(@input.text())
for url in @findMatches(@input.val())
@urlList.append $("<li>#{url}</li>")
findMatches: (query) ->

View File

@@ -5,12 +5,17 @@ module.exports =
class Layout extends Template
@attach: ->
view = @build()
$('body').append(view)
$('body').append view
view
content: ->
@link rel: 'stylesheet', href: 'static/atom.css'
@div id: 'app-horizontal', =>
@div id: 'app-vertical', =>
@div id: 'main'
@div id: 'app-vertical', outlet: 'vertical', =>
@div id: 'main', outlet: 'main'
viewProperties:
addPane: (view) ->
pane = $('<div class="pane">')
pane.append(view)
@main.after(pane)

View File

@@ -4,6 +4,7 @@ $ = require 'jquery'
Layout = require 'layout'
Editor = require 'editor'
FileFinder = require 'file-finder'
# This a weirdo file. We don't create a Window class, we just add stuff to
# the DOM window.
@@ -31,9 +32,13 @@ windowAdditions =
$(window).unbind('blur')
$(window).unbind('keydown')
findFile: ->
window.layout.addPane(FileFinder.build(urls: [@editor.buffer.url]))
bindKeys: ->
@bindKey 'meta+s', => @editor.save()
@bindKey 'meta+w', => @close()
@bindKey 'meta+t', => @findFile()
bindMenuItems: ->
@bindMenuItem "File > Save", "meta+s", => @editor.save()

View File

@@ -8,6 +8,7 @@ paths = [
"#{resourcePath}/src"
"#{resourcePath}/extensions"
"#{resourcePath}/vendor"
"#{resourcePath}/static"
]
window.__filename = null