|
|
@@ -59,7 +59,9 @@ define [
|
|
|
@autoSelectDiff()
|
|
|
|
|
|
@changeListView.on "change_diff", (fromIndex, toIndex) =>
|
|
|
- @selectDocAndUpdateDiff(fromIndex, toIndex)
|
|
|
+ @findDocsInChange(fromIndex, toIndex)
|
|
|
+ @updateLabels()
|
|
|
+ @updateDiff()
|
|
|
|
|
|
@showUpgradeView()
|
|
|
|
|
|
@@ -97,6 +99,7 @@ define [
|
|
|
@disable()
|
|
|
@ide.fileTreeManager.openDoc(@doc_id)
|
|
|
@ide.tabManager.show "code"
|
|
|
+ @resetLabels()
|
|
|
|
|
|
autoSelectDiff: () ->
|
|
|
if @changes.models.length == 0
|
|
|
@@ -118,17 +121,27 @@ define [
|
|
|
@changeListView.setSelectionRange(fromIndex, 0)
|
|
|
@updateDiff()
|
|
|
|
|
|
- selectDocAndUpdateDiff: (fromIndex, toIndex) ->
|
|
|
- doc_ids = []
|
|
|
+ findDocsInChange: (fromIndex, toIndex) ->
|
|
|
+ @changed_doc_ids = []
|
|
|
for change in @changes.models.slice(toIndex, fromIndex + 1)
|
|
|
for doc in change.get("docs") or []
|
|
|
- doc_ids.push doc.id if doc.id not in doc_ids
|
|
|
+ @changed_doc_ids.push doc.id if doc.id not in @changed_doc_ids
|
|
|
|
|
|
- if !@doc_id? or @doc_id not in doc_ids
|
|
|
- @doc_id = doc_ids[0]
|
|
|
+ if !@doc_id? or @doc_id not in @changed_doc_ids
|
|
|
+ @doc_id = @changed_doc_ids[0]
|
|
|
|
|
|
@updateDiff()
|
|
|
|
|
|
+ updateLabels: () ->
|
|
|
+ labels = {}
|
|
|
+ for doc_id in @changed_doc_ids
|
|
|
+ labels[doc_id] = true
|
|
|
+ @ide.fileTreeManager.setLabels(labels)
|
|
|
+
|
|
|
+ resetLabels: () ->
|
|
|
+ @ide.fileTreeManager.setLabels({})
|
|
|
+
|
|
|
+
|
|
|
updateDiff: () ->
|
|
|
fromIndex = @changeListView.selectedFromIndex
|
|
|
toIndex = @changeListView.selectedToIndex
|