fixing upload refresh

This commit is contained in:
Jon Lambson 2017-10-26 11:08:34 -06:00
parent 092714087e
commit 894ccf09df
2 changed files with 33 additions and 21 deletions

View File

@ -227,7 +227,9 @@ app.controller('websiteCtrl', [
if (result.data.error) { if (result.data.error) {
var msg = vm.newFileUploaded + " has encountered an error. " + result.data.error.message + '.'; var msg = vm.newFileUploaded + " has encountered an error. " + result.data.error.message + '.';
} else { } else {
var msg = vm.newFileUploaded + " has been uploaded."; var msg = "'" + vm.newFileUploaded + "'" + " has been uploaded.";
vm.uploadFolderContainer = false;
vm.uploadFileContainer = false;
} }
opts.progress.uploadTotal = 0; opts.progress.uploadTotal = 0;
vm.buildNotification(result, msg); vm.buildNotification(result, msg);
@ -347,6 +349,9 @@ app.controller('websiteCtrl', [
console.log(r); console.log(r);
}; };
vm.cleanUploads = function (r) {
vm.folderName = '';
};
vm.breadcrumbs = []; vm.breadcrumbs = [];
vm.breadcrumbsPath = ['']; vm.breadcrumbsPath = [''];
@ -404,7 +409,6 @@ app.controller('websiteCtrl', [
vm.previousSearchQuery = dir; vm.previousSearchQuery = dir;
vm.displaySpinner = ''; vm.displaySpinner = '';
var pkg = Auth.oauth3.pkg('www@daplie.com'); var pkg = Auth.oauth3.pkg('www@daplie.com');
console.log('searching ->', cleanPathQuery(vm.breadcrumbsPath.join('/')));
return pkg.contents({ return pkg.contents({
hostname: r.domain, hostname: r.domain,
domain: r.domain, domain: r.domain,
@ -437,10 +441,8 @@ app.controller('websiteCtrl', [
}; };
vm.getDirectoriesFromBreadcrumbs = function (dir) { vm.getDirectoriesFromBreadcrumbs = function (dir) {
debugger;
if (vm.copyR.shareAccess.path !== '/') { if (vm.copyR.shareAccess.path !== '/') {
var strictArray = vm.copyR.shareAccess.path.split('/'); var strictArray = vm.copyR.shareAccess.path.split('/');
console.log('searching ->', cleanPathQuery(vm.breadcrumbsPath.join('/')));
if (vm.breadcrumbsPath.join('/') === '') { if (vm.breadcrumbsPath.join('/') === '') {
vm.breadcrumbsPath = strictArray; vm.breadcrumbsPath = strictArray;
} else { } else {
@ -456,14 +458,18 @@ app.controller('websiteCtrl', [
vm.getDirectories = function (dir) { vm.getDirectories = function (dir) {
if (vm.copyR.shareAccess.path !== '/') { if (vm.copyR.shareAccess.path !== '/') {
vm.breadcrumbs.push(dir);
if (vm.breadcrumbsPath.length === 0) { if (vm.breadcrumbsPath.length === 0) {
var breadcrumblies = vm.strictPath + dir; var breadcrumblies = vm.strictPath + dir;
vm.breadcrumbsPath = breadcrumblies.split('/'); vm.breadcrumbsPath = breadcrumblies.split('/');
vm.breadcrumbs.push(dir);
} else {
if (vm.copyR.shareAccess.path !== '/') {
vm.breadcrumbsPath.push(dir);
vm.breadcrumbs.push(dir);
} else {
vm.breadcrumbsPath.push(dir);
}
} }
// else {
// vm.breadcrumbsPath.push(dir);
// }
vm.Sites.contents(vm.copyR, vm.breadcrumbsPath.join('/')); vm.Sites.contents(vm.copyR, vm.breadcrumbsPath.join('/'));
} else { } else {
vm.breadcrumbs.push(dir); vm.breadcrumbs.push(dir);
@ -484,6 +490,7 @@ app.controller('websiteCtrl', [
vm.deleteFilesFrom = function (r, opts) { vm.deleteFilesFrom = function (r, opts) {
var file = opts; var file = opts;
vm.pathRemoved = file;
var requestedPath; var requestedPath;
if (r.shareAccess.path !== '/') { if (r.shareAccess.path !== '/') {
if (vm.breadcrumbsPath.length === 0) { if (vm.breadcrumbsPath.length === 0) {
@ -493,6 +500,9 @@ app.controller('websiteCtrl', [
requestedPath = vm.breadcrumbsPath.join('/') + '/' + file; requestedPath = vm.breadcrumbsPath.join('/') + '/' + file;
} else { } else {
requestedPath = vm.breadcrumbsPath.join('/') + '/' + file; requestedPath = vm.breadcrumbsPath.join('/') + '/' + file;
if (vm.breadcrumbsPath.join('/') === '') {
requestedPath = vm.strictPath + '/' + file;
}
} }
} }
} else { } else {
@ -503,7 +513,6 @@ app.controller('websiteCtrl', [
} }
} }
requestedPath = cleanPathQuery(requestedPath); requestedPath = cleanPathQuery(requestedPath);
debugger;
opts = { opts = {
path: requestedPath path: requestedPath
}; };
@ -514,12 +523,11 @@ app.controller('websiteCtrl', [
path = cleanPathQuery(path); path = cleanPathQuery(path);
var opts = { var opts = {
path: path path: path
} };
vm.Sites.remove(r, opts) 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;
} }
@ -533,7 +541,7 @@ app.controller('websiteCtrl', [
path: opts.path || r.path, path: opts.path || r.path,
confirm: opts.confirm || r.confirm confirm: opts.confirm || r.confirm
}).then(function (result) { }).then(function (result) {
var msg = "'"+ vm.pathRemoved + "'" + ' has been removed'; var msg = "'"+ vm.pathRemoved + "'" + ' has been removed.';
vm.buildNotification(result, msg); vm.buildNotification(result, msg);
vm.Sites.contents(vm.copyR, vm.previousSearchQuery); vm.Sites.contents(vm.copyR, vm.previousSearchQuery);
}); });
@ -555,6 +563,12 @@ app.controller('websiteCtrl', [
}); });
}; };
var doIT = function () {
r.shareAccess.write = true;
r.shareAccess.read = true;
r.shareAccess.invite = true;
};
vm.shareFolderFrom = function (r, opts) { vm.shareFolderFrom = function (r, opts) {
var sharePath; var sharePath;
if (vm.breadcrumbsPath.join('/') === '' && vm.breadcrumbs.join('/') === '') { if (vm.breadcrumbsPath.join('/') === '' && vm.breadcrumbs.join('/') === '') {
@ -575,7 +589,6 @@ app.controller('websiteCtrl', [
if (vm.breadcrumbsPath.length === 0) { if (vm.breadcrumbsPath.length === 0) {
vm.breadcrumbsPath = vm.strictPath.split('/'); vm.breadcrumbsPath = vm.strictPath.split('/');
vm.breadcrumbsPath.pop(); vm.breadcrumbsPath.pop();
vm.breadcrumbsPath.push(vm.folderName);
} else { } else {
vm.breadcrumbsPath.push(vm.folderName); vm.breadcrumbsPath.push(vm.folderName);
r.folderName = vm.breadcrumbsPath.join('/'); r.folderName = vm.breadcrumbsPath.join('/');
@ -610,9 +623,8 @@ app.controller('websiteCtrl', [
vm.breadcrumbsPath.unshift(''); vm.breadcrumbsPath.unshift('');
} }
} }
if (vm.breadcrumbsPath.join('/') === '') { if (vm.breadcrumbsPath.join('/') !== '') {
} else { r.uploadPath = vm.breadcrumbsPath.join('/') + '/' + vm.folderName + '/';
r.uploadPath = vm.breadcrumbsPath.join('/') + '/';
r.uploadPath = cleanPathQuery(r.uploadPath); r.uploadPath = cleanPathQuery(r.uploadPath);
} }
} }

View File

@ -27,9 +27,9 @@
<div> <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> <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-if="r.shareAccess.write"><span><i class="fa fa-upload cp"></i> <a ng-click="vm.autoPopulateFolderName(); vm.uploadFileContainer = true; vm.uploadFolderContainer = 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(); vm.uploadFileContainer = true; vm.uploadFolderContainer = false; vm.cleanUploads(r);" 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.uploadFolderContainer = true; vm.uploadFileContainer = 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.uploadFolderContainer = true; vm.uploadFileContainer = false; vm.cleanUploads(r);" 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> <li ng-if="r.shareAccess.write"><span><i class="fa fa-trash cp"></i> <a ng-click="vm.triggerDeleteFolder(vm.breadcrumbsPath.join('/'), r); vm.cleanUploads(r);" data="{{ vm.currentFolder }}" class="cp">Delete {{ vm.currentFolder | capitalize }} Folder</a></span></li>
</ul> </ul>
</div> </div>
</div> </div>