Only store operations to preview on the PreviewList

This commit is contained in:
Nathan Sobo
2012-07-23 19:10:07 -06:00
parent 5659f9bab1
commit 94251a2fad
2 changed files with 9 additions and 10 deletions

View File

@@ -18,7 +18,7 @@ class CommandPanel extends View
@instance = new CommandPanel(rootView)
@deactivate: ->
@instance.detach()
@instance.destroy()
@serialize: ->
text: @instance.miniEditor.getText()
@@ -60,6 +60,9 @@ class CommandPanel extends View
@previewList.hide()
destroy: ->
@previewList.destroy()
toggle: ->
if @miniEditor.isFocused
@detach()
@@ -89,9 +92,6 @@ class CommandPanel extends View
detach: ->
@rootView.focus()
@previewList.hide()
if @previewedOperations
operation.destroy() for operation in @previewedOperations
@previewedOperations = undefined
super
execute: (command = @miniEditor.getText()) ->
@@ -100,7 +100,8 @@ class CommandPanel extends View
@history.push(command)
@historyIndex = @history.length
if operationsToPreview?.length
@populatePreviewList(operationsToPreview)
@previewList.populate(operationsToPreview)
@previewList.focus()
else
@detach()
catch error
@@ -110,11 +111,6 @@ class CommandPanel extends View
else
throw error
populatePreviewList: (operations) ->
@previewedOperations = operations
@previewList.populate(operations)
@previewList.focus()
navigateBackwardInHistory: ->
return if @historyIndex == 0
@historyIndex--

View File

@@ -13,6 +13,9 @@ class PreviewList extends View
@on 'move-up', => @selectPreviousOperation()
@on 'command-panel:execute', => @executeSelectedOperation()
destroy: ->
@destroyOperations() if @operations
hasOperations: -> @operations?
populate: (operations) ->