Open current selection when leaving track changes

This commit is contained in:
James Allen 2014-07-03 17:12:23 +01:00
parent ac0f05a9e4
commit 5dd3f828e3
2 changed files with 15 additions and 7 deletions

View file

@ -70,6 +70,12 @@ define [
entity.selected = false
entity.selected = true
findSelectedEntity: () ->
selected = null
@forEachEntity (entity) ->
selected = entity if entity.selected
return selected
findEntityById: (id, options = {}) ->
return @$scope.rootFolder if @$scope.rootFolder.id == id

View file

@ -9,10 +9,9 @@ define [
@$scope.toggleTrackChanges = () =>
if @$scope.ui.view == "track-changes"
@$scope.ui.view = "editor"
@hide()
else
@$scope.ui.view = "track-changes"
@onShow()
@show()
@$scope.$watch "trackChanges.selection.updates", (updates) =>
if updates? and updates.length > 0
@ -24,11 +23,14 @@ define [
@$scope.trackChanges.selection.doc = entity
@reloadDiff()
onShow: () ->
show: () ->
@$scope.ui.view = "track-changes"
@reset()
# @fetchNextBatchOfChanges()
# .success () =>
# @autoSelectRecentUpdates()
hide: () ->
@$scope.ui.view = "editor"
# Make sure we run the 'open' logic for whatever is currently selected
@$scope.$emit "entity:selected", @ide.fileTreeManager.findSelectedEntity()
reset: () ->
@$scope.trackChanges = {