2014-06-21 17:20:37 -04:00
|
|
|
define [
|
|
|
|
"base"
|
|
|
|
], (App) ->
|
2014-06-22 15:49:58 -04:00
|
|
|
App.controller "FileTreeEntityController", ["$scope", "ide", "$modal", ($scope, ide, $modal) ->
|
2014-06-22 15:08:56 -04:00
|
|
|
$scope.select = () ->
|
2014-06-24 12:15:27 -04:00
|
|
|
ide.fileTreeManager.selectEntity($scope.entity)
|
2014-06-24 12:24:29 -04:00
|
|
|
$scope.$emit "entity:selected", $scope.entity
|
2014-06-24 10:31:44 -04:00
|
|
|
|
2014-06-22 15:08:56 -04:00
|
|
|
$scope.inputs =
|
|
|
|
name: $scope.entity.name
|
|
|
|
|
|
|
|
$scope.startRenaming = () ->
|
|
|
|
$scope.entity.renaming = true
|
|
|
|
|
|
|
|
$scope.finishRenaming = () ->
|
|
|
|
delete $scope.entity.renaming
|
|
|
|
ide.fileTreeManager.renameEntity($scope.entity, $scope.inputs.name)
|
|
|
|
|
|
|
|
$scope.$on "rename:selected", () ->
|
|
|
|
$scope.startRenaming() if $scope.entity.selected
|
2014-06-22 15:21:31 -04:00
|
|
|
|
2014-06-22 15:49:58 -04:00
|
|
|
$scope.openDeleteModal = () ->
|
|
|
|
$modal.open(
|
|
|
|
templateUrl: "deleteEntityModalTemplate"
|
|
|
|
controller: "DeleteEntityModalController"
|
|
|
|
scope: $scope
|
|
|
|
)
|
|
|
|
|
|
|
|
$scope.$on "delete:selected", () ->
|
|
|
|
$scope.openDeleteModal() if $scope.entity.selected
|
|
|
|
]
|
|
|
|
|
|
|
|
App.controller "DeleteEntityModalController", [
|
|
|
|
"$scope", "ide", "$modalInstance",
|
|
|
|
($scope, ide, $modalInstance) ->
|
|
|
|
$scope.state =
|
|
|
|
inflight: false
|
|
|
|
|
|
|
|
$scope.delete = () ->
|
|
|
|
$scope.state.inflight = true
|
2014-06-23 06:10:18 -04:00
|
|
|
ide.fileTreeManager
|
|
|
|
.deleteEntity($scope.entity)
|
|
|
|
.success () ->
|
2014-06-22 15:49:58 -04:00
|
|
|
$scope.state.inflight = false
|
|
|
|
$modalInstance.close()
|
|
|
|
|
|
|
|
$scope.cancel = () ->
|
|
|
|
$modalInstance.dismiss('cancel')
|
|
|
|
]
|