RootView is initialized with a url and opens it with its editor

This commit is contained in:
Corey Johnson & Nathan Sobo
2012-01-03 13:57:10 -08:00
parent 2cfea9fa42
commit f8b04cd902
3 changed files with 20 additions and 8 deletions

View File

@@ -7,11 +7,6 @@ Template = require 'template'
module.exports =
class RootView extends Template
@attach: ->
view = @build()
$('body').append view
view
content: ->
@link rel: 'stylesheet', href: "#{require.resolve('atom.css')}?#{(new Date).getTime()}"
@div id: 'app-horizontal', =>
@@ -20,11 +15,13 @@ class RootView extends Template
@subview 'editor', Editor.build()
viewProperties:
initialize: ->
initialize: ({url}) ->
@bindKey 'meta+s', => @editor.save()
@bindKey 'meta+w', => window.close()
@bindKey 'meta+t', => @toggleFileFinder()
@editor.open url
addPane: (view) ->
pane = $('<div class="pane">')
pane.append(view)

View File

@@ -13,8 +13,8 @@ windowAdditions =
startup: ->
@menuItemActions = {}
@rootView = RootView.attach()
@rootView.editor.open $atomController.url?.toString()
@rootView = RootView.build(url: $atomController.url?.toString())
$('body').append @rootView
@registerEventHandlers()
@bindMenuItems()
$(window).focus()