From 938b042f8c893288e03e5addf9ddfced9cc88441 Mon Sep 17 00:00:00 2001 From: James Allen Date: Wed, 10 Feb 2016 15:59:51 +0000 Subject: [PATCH] Include selected entity in multi selection on first click --- .../public/coffee/ide/file-tree/FileTreeManager.coffee | 3 +++ .../controllers/FileTreeEntityController.coffee | 10 +++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/services/web/public/coffee/ide/file-tree/FileTreeManager.coffee b/services/web/public/coffee/ide/file-tree/FileTreeManager.coffee index 17150e2e64..c93ed4f4c0 100644 --- a/services/web/public/coffee/ide/file-tree/FileTreeManager.coffee +++ b/services/web/public/coffee/ide/file-tree/FileTreeManager.coffee @@ -131,6 +131,9 @@ define [ @forEachEntity (entity) -> entity.multiSelected = false @$scope.multiSelectedCount = 0 + + multiSelectSelectedEntity: () -> + @findSelectedEntity()?.multiSelected = true findSelectedEntity: () -> selected = null diff --git a/services/web/public/coffee/ide/file-tree/controllers/FileTreeEntityController.coffee b/services/web/public/coffee/ide/file-tree/controllers/FileTreeEntityController.coffee index a1bb1da702..b5c96408c7 100644 --- a/services/web/public/coffee/ide/file-tree/controllers/FileTreeEntityController.coffee +++ b/services/web/public/coffee/ide/file-tree/controllers/FileTreeEntityController.coffee @@ -5,16 +5,20 @@ define [ $scope.select = (e) -> if e.ctrlKey or e.metaKey e.stopPropagation() - ide.fileTreeManager.toggleMultiSelectEntity($scope.entity) + initialMultiSelectCount = ide.fileTreeManager.multiSelectedCount() + ide.fileTreeManager.toggleMultiSelectEntity($scope.entity) == 0 + if initialMultiSelectCount == 0 + # On first multi selection, also include the current active/open file. + ide.fileTreeManager.multiSelectSelectedEntity() else ide.fileTreeManager.selectEntity($scope.entity) $scope.$emit "entity:selected", $scope.entity $scope.draggableHelper = () -> if ide.fileTreeManager.multiSelectedCount() > 0 - return $("
#{ide.fileTreeManager.multiSelectedCount()} Files
") + return $("#{ide.fileTreeManager.multiSelectedCount()} Files") else - return $("
#{$scope.entity.name}
") + return $("#{$scope.entity.name}") $scope.inputs = name: $scope.entity.name