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

View File

@ -27,9 +27,9 @@
<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-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-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-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-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; 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); vm.cleanUploads(r);" data="{{ vm.currentFolder }}" class="cp">Delete {{ vm.currentFolder | capitalize }} Folder</a></span></li>
</ul>
</div>
</div>