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

View File

@ -24,18 +24,17 @@
</ul> </ul>
<div class="folder-actions"> <div class="folder-actions">
<hr> <hr>
<div class=""> <div>
<button type="button" name="button" class="btn btn-block btn-primary" ng-click="vm.showUploadFilesContainer = true; vm.autoPopulateFolderName(); vm.showUploadFolderContainer = false">Upload files</button>
<button ng-if="r.shareAccess.invite" type="button" name="button" class="btn btn-block btn-primary" ng-click="vm.showAction('invite');">Share folder</button> <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"> <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 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><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-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-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-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> </ul>
</div> </div>
</div> </div>
<div class="upload-container"> <div class="upload-container">
<form ng-show="vm.showUploadFilesContainer"> <form>
<hr> <hr>
<div> <div>
<input type="file" ng-model="r.newFile" class="form-control" daplie-file-change="vm.Sites.setUpload(r)" /> <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> <button ng-click="vm.Sites.upload(r)" type="button" name="button" class="btn btn-success" >Add File</button>
</div> </div>
</form> </form>
<form class="form-inline" ng-show="vm.showUploadFolderContainer"> <form class="form-inline">
<hr> <hr>
<ul class="ls-none"> <ul class="ls-none">
<li class="add-folder"> <li class="add-folder">