2014-06-21 17:20:37 -04:00
|
|
|
define [
|
|
|
|
"base"
|
|
|
|
], (App) ->
|
2014-06-22 07:10:42 -04:00
|
|
|
App.controller "FileTreeEntityController", ["$scope", "ide", ($scope, ide) ->
|
2014-06-22 15:08:56 -04:00
|
|
|
$scope.select = () ->
|
2014-06-21 17:20:37 -04:00
|
|
|
ide.fileTreeManager.forEachEntity (entity) ->
|
|
|
|
entity.selected = false
|
|
|
|
$scope.entity.selected = true
|
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
|
|
|
|
|
|
|
if $scope.entity.type == "folder"
|
|
|
|
$scope.expanded = false
|
|
|
|
|
|
|
|
$scope.toggleExpanded = () ->
|
|
|
|
$scope.expanded = !$scope.expanded
|
2014-06-21 17:20:37 -04:00
|
|
|
]
|