fixing deleting folders

This commit is contained in:
Jon Lambson 2017-10-25 13:46:05 -06:00
parent 763c14e77d
commit dfc0bd65a2
2 changed files with 21 additions and 10 deletions

View File

@ -246,7 +246,7 @@ app.controller('websiteCtrl', [
var sub;
var sld;
var tld;
debugger;
/*
//vm.unlock('webpreneur');
if (!vm.currentFiles || !vm.currentFiles.length) {
@ -356,6 +356,7 @@ app.controller('websiteCtrl', [
vm.Sites.allContents = function (r) {
vm.copyR = r;
vm.strictPath = r.shareAccess.path;
var pkg = Auth.oauth3.pkg('www@daplie.com');
return pkg.contents({
hostname: r.domain,
@ -382,6 +383,7 @@ app.controller('websiteCtrl', [
}
});
vm.displaySpinner = 'hidden';
vm.currentFolder = vm.breadcrumbs[vm.breadcrumbs.length - 1];
});
};
@ -443,6 +445,7 @@ app.controller('websiteCtrl', [
crumbsCleanUp(dir);
vm.Sites.contents(vm.copyR, vm.breadcrumbsPath.join('/'));
}
vm.currentFolder = vm.breadcrumbs[vm.breadcrumbs.length - 1];
};
vm.getDirectories = function (dir) {
@ -461,6 +464,7 @@ app.controller('websiteCtrl', [
vm.breadcrumbsPath.unshift('');
vm.Sites.contents(vm.copyR, vm.breadcrumbsPath.join('/'));
}
vm.currentFolder = vm.breadcrumbs[vm.breadcrumbs.length - 1];
};
vm.removeAllFiles = function (r, opts) {
@ -494,7 +498,16 @@ app.controller('websiteCtrl', [
vm.Sites.remove(r, opts);
};
vm.triggerDeleteFolder = function (path, r) {
path = cleanPathQuery(path);
var opts = {
path: path
}
vm.Sites.remove(r, opts)
}
vm.Sites.remove = function (r, opts) {
debugger;
if (!window.confirm("Delete files for this site?")) {
return;
}
@ -620,7 +633,6 @@ app.controller('websiteCtrl', [
token: vm.Shares.inviteToken
}).then(function (result) {
window.alert(JSON.stringify(result));
console.log('shasres')
vm.listSites();
});
};
@ -756,7 +768,7 @@ app.controller('websiteCtrl', [
$scope.$watch('vm.selectedDomain', function (domainSelected) {
if (domainSelected !== undefined) {
vm.dom = domainSelected.description;
vm.dom = domainSelected;
vm.selectDomain(vm.selectedDomain.description);
}
});

View File

@ -24,18 +24,17 @@
</ul>
<div class="folder-actions">
<hr>
<div class="">
<button type="button" name="button" class="btn btn-block btn-primary" ng-click="vm.showUploadFilesContainer = true; vm.autoPopulateFolderName(); vm.showUploadFolderContainer = false">Upload files</button>
<div>
<button ng-if="r.shareAccess.invite" type="button" name="button" class="btn btn-block btn-primary" ng-click="vm.showAction('invite');">Share folder</button>
<ul class="ls-none folder-actions-list">
<li ng-hide="vm.showFolderAction"><span><i class="fa fa-upload cp"></i> <a ng-click="vm.showUploadFilesContainer = true; vm.autoPopulateFolderName(); vm.showUploadFolderContainer = false;" class="cp">Upload files</a></span></li>
<li><span><i class="fa fa-folder cp"></i> <a ng-click="vm.cleanPath(); vm.showUploadFolderContainer = true; vm.showFileUploadBtn = false;" class="cp">New folder</a></span></li>
<li ng-hide="vm.showUploadButton" ng-if="r.shareAccess.write"><span><i class="fa fa-trash cp"></i> <a ng-click="vm.triggerDeleteFolder(vm.currentFolder, r)" data="{{ vm.currentFolder }}" class="cp">Delete {{ vm.currentFolder | capitalize }} Folder</a></span></li>
<li ng-if="r.shareAccess.write"><span><i class="fa fa-upload cp"></i> <a ng-click="vm.autoPopulateFolderName();" class="cp">Upload files</a></span></li>
<li ng-if="r.shareAccess.write"><span><i class="fa fa-folder cp"></i> <a ng-click="vm.cleanPath();" class="cp">New folder</a></span></li>
<li ng-if="r.shareAccess.write"><span><i class="fa fa-trash cp"></i> <a ng-click="vm.triggerDeleteFolder(vm.breadcrumbsPath.join('/'), r);" data="{{ vm.currentFolder }}" class="cp">Delete {{ vm.currentFolder | capitalize }} Folder</a></span></li>
</ul>
</div>
</div>
<div class="upload-container">
<form ng-show="vm.showUploadFilesContainer">
<form>
<hr>
<div>
<input type="file" ng-model="r.newFile" class="form-control" daplie-file-change="vm.Sites.setUpload(r)" />
@ -47,7 +46,7 @@
<button ng-click="vm.Sites.upload(r)" type="button" name="button" class="btn btn-success" >Add File</button>
</div>
</form>
<form class="form-inline" ng-show="vm.showUploadFolderContainer">
<form class="form-inline">
<hr>
<ul class="ls-none">
<li class="add-folder">