2020-05-19 05:02:56 -04:00
|
|
|
import App from '../../../base'
|
2018-11-05 05:06:39 -05:00
|
|
|
|
2021-04-14 09:17:21 -04:00
|
|
|
export default App.controller(
|
|
|
|
'FileTreeFolderController',
|
|
|
|
function ($scope, ide, $modal, localStorage) {
|
|
|
|
$scope.expanded =
|
|
|
|
localStorage(`folder.${$scope.entity.id}.expanded`) || false
|
2020-01-02 14:21:45 -05:00
|
|
|
|
2021-04-14 09:17:21 -04:00
|
|
|
$scope.toggleExpanded = function () {
|
|
|
|
$scope.expanded = !$scope.expanded
|
|
|
|
$scope._storeCurrentStateInLocalStorage()
|
|
|
|
}
|
2018-11-05 05:06:39 -05:00
|
|
|
|
2021-04-14 09:17:21 -04:00
|
|
|
$scope.$on('entity-file:selected', function () {
|
|
|
|
$scope.expanded = true
|
|
|
|
$scope._storeCurrentStateInLocalStorage()
|
|
|
|
})
|
2020-05-19 05:02:56 -04:00
|
|
|
|
2021-04-14 09:17:21 -04:00
|
|
|
$scope._storeCurrentStateInLocalStorage = function () {
|
|
|
|
localStorage(`folder.${$scope.entity.id}.expanded`, $scope.expanded)
|
2020-05-19 05:02:56 -04:00
|
|
|
}
|
2021-04-14 09:17:21 -04:00
|
|
|
}
|
|
|
|
)
|