diff --git a/spec/atom/file-finder-spec.coffee b/spec/atom/file-finder-spec.coffee index d83242991..d0dbb19e3 100644 --- a/spec/atom/file-finder-spec.coffee +++ b/spec/atom/file-finder-spec.coffee @@ -11,7 +11,7 @@ describe 'FileFinder', -> it "displays matching urls in the ol element", -> expect(finder.urlList.find('li')).not.toExist() - finder.input.text('ap') + finder.input.val('ap') finder.input.keypress() expect(finder.urlList.children().length).toBe 2 @@ -19,7 +19,7 @@ describe 'FileFinder', -> expect(finder.urlList.find('li:contains(atom/app.coffee)').length).toBe 1 # we should clear the list before re-populating it - finder.input.text('a/ap') + finder.input.val('a/ap') finder.input.keypress() expect(finder.urlList.children().length).toBe 1 diff --git a/spec/atom/layout-spec.coffee b/spec/atom/layout-spec.coffee new file mode 100644 index 000000000..48d28dbab --- /dev/null +++ b/spec/atom/layout-spec.coffee @@ -0,0 +1,15 @@ +$ = require 'jquery' +Layout = require 'layout' + +fdescribe "Layout", -> + layout = null + beforeEach -> layout = Layout.build() + + describe ".addPane(view)", -> + it "adds the given view to the layout (at the bottom by default)", -> + expect(layout.vertical.children().length).toBe 1 + + layout.addPane $('
') + + expect(layout.vertical.children().length).toBe 2 + diff --git a/src/atom/file-finder.coffee b/src/atom/file-finder.coffee index e615017e0..fffc8813d 100644 --- a/src/atom/file-finder.coffee +++ b/src/atom/file-finder.coffee @@ -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 $("
  • #{url}
  • ") findMatches: (query) -> diff --git a/src/atom/layout.coffee b/src/atom/layout.coffee index 2496aa567..86241ab14 100644 --- a/src/atom/layout.coffee +++ b/src/atom/layout.coffee @@ -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 = $('
    ') + pane.append(view) + @main.after(pane) diff --git a/src/atom/window.coffee b/src/atom/window.coffee index e7542e8b3..f62ab7361 100644 --- a/src/atom/window.coffee +++ b/src/atom/window.coffee @@ -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() diff --git a/src/stdlib/require.coffee b/src/stdlib/require.coffee index d05474601..4598710ca 100644 --- a/src/stdlib/require.coffee +++ b/src/stdlib/require.coffee @@ -8,6 +8,7 @@ paths = [ "#{resourcePath}/src" "#{resourcePath}/extensions" "#{resourcePath}/vendor" + "#{resourcePath}/static" ] window.__filename = null diff --git a/static/atom.css b/static/atom.css index 08340a825..66f904647 100644 --- a/static/atom.css +++ b/static/atom.css @@ -20,45 +20,24 @@ body { display: -webkit-box; -webkit-box-flex: 1; -webkit-box-orient: vertical; + background-color: red; } #main { + position: relative; display: -webkit-box; -webkit-box-flex: 1; -webkit-box-orient: vertical; -} - -.main { - -webkit-box-flex: 1; -} - -.pane.hidden { - display: none; + background-color: yellow; } .pane { display: -webkit-box; - -webkit-box-orient: vertical; -} - -.left { - background-color: gray; -} - -.right { - background-color: green; -} - -.top { - background-color: purple; -} - -.bottom { background-color: blue; + -webkit-box-flex: 1; } .ace_editor { - position: relative !important; font: 18px Inconsolata, Monaco, Courier !important; width: 100%; height: 100%;