hookup expand-collapse

This commit is contained in:
Justin Palmer
2013-02-13 12:52:01 -08:00
parent 84ff844f17
commit f86e23e705
3 changed files with 19 additions and 1 deletions

View File

@@ -46,6 +46,9 @@ class CommandPanelView extends View
rootView.command 'command-panel:repeat-relative-address-in-reverse', => @repeatRelativeAddressInReverse()
rootView.command 'command-panel:set-selection-as-regex-address', => @setSelectionAsLastRelativeAddress()
@on 'click', '.expand', @onExpandAll
@on 'click', '.collapse', @onCollapseAll
@previewList.hide()
@previewCount.hide()
@errorMessages.hide()
@@ -93,6 +96,12 @@ class CommandPanelView extends View
@loadingMessage.html 'Searching...'
@loadingMessage.show()
onExpandAll: (event) =>
@previewList.expandAllPaths()
onCollapseAll: (event) =>
@previewList.collapseAllPaths()
attach: (text='', options={}) ->
@errorMessages.hide()
@@ -118,6 +127,7 @@ class CommandPanelView extends View
try
@commandInterpreter.eval(command, rootView.getActiveEditSession()).done ({operationsToPreview, errorMessages}) =>
@toggleLoading()
@expandCollapse.show()
@history.push(command)
@historyIndex = @history.length

View File

@@ -31,6 +31,14 @@ class PreviewList extends ScrollView
e.children('ul.matches').toggle 100, (e) ->
$(this).closest('li.path').toggleClass 'is-collapsed'
expandAllPaths: ->
@find('ul.matches').show()
@find('.path').removeClass 'is-collapsed'
collapseAllPaths: ->
@find('ul.matches').hide()
@find('.path').addClass 'is-collapsed'
destroy: ->
@destroyOperations() if @operations