added delete functionality
This commit is contained in:
parent
57eb74d1c9
commit
e91d913547
|
@ -447,6 +447,46 @@ app.controller('websiteCtrl', [
|
|||
|
||||
|
||||
|
||||
vm.removeAllFiles = function (r, opts) {
|
||||
console.log(r);
|
||||
console.log(opts);
|
||||
opts = {
|
||||
path: '/',
|
||||
confirm: true
|
||||
};
|
||||
vm.Sites.remove(r, opts);
|
||||
};
|
||||
|
||||
vm.deleteFilesFrom = function (r, opts) {
|
||||
var file = opts;
|
||||
var requestedPath = vm.breadcrumbsPath.join('/') + '/' + file;
|
||||
opts = {
|
||||
path: requestedPath
|
||||
};
|
||||
vm.Sites.remove(r, opts);
|
||||
};
|
||||
|
||||
vm.Sites.remove = function (r, opts) {
|
||||
if (!window.confirm("Delete files for this site?")) {
|
||||
return;
|
||||
}
|
||||
var pkg = Auth.oauth3.pkg('www@daplie.com');
|
||||
debugger;
|
||||
return pkg.remove({
|
||||
hostname: r.domain,
|
||||
domain: r.domain,
|
||||
tld: r.tld,
|
||||
sld: r.sld,
|
||||
// sub: vm.record.sub,
|
||||
path: opts.path || r.path,
|
||||
confirm: opts.confirm || r.confirm
|
||||
}).then(function (result) {
|
||||
var msg = "'"+ vm.pathRemoved + "'" + ' has been removed';
|
||||
vm.buildNotification(result, msg);
|
||||
window.alert(JSON.stringify(result));
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -81,7 +81,7 @@
|
|||
</div>
|
||||
<div class="row">
|
||||
<div class="padding-side-15">
|
||||
<button ng-if="r.shareAccess.write" type="button" class="btn btn-danger pull-right" ng-click="vm.deleteFilesFrom(r, path)"><i class="fa fa-trash"></i> Remove all Files</button>
|
||||
<button ng-if="r.shareAccess.write" type="button" class="btn btn-danger pull-right" ng-click="vm.removeAllFiles(r, opts)"><i class="fa fa-trash"></i> Remove all Files</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue