sharing should be dynamic

This commit is contained in:
Jon Lambson 2017-10-17 15:19:41 -06:00
parent e91d913547
commit 5cf80bb80b
2 changed files with 19 additions and 40 deletions

View File

@ -444,9 +444,6 @@ app.controller('websiteCtrl', [
} }
}; };
vm.removeAllFiles = function (r, opts) { vm.removeAllFiles = function (r, opts) {
console.log(r); console.log(r);
console.log(opts); console.log(opts);
@ -471,7 +468,6 @@ app.controller('websiteCtrl', [
return; return;
} }
var pkg = Auth.oauth3.pkg('www@daplie.com'); var pkg = Auth.oauth3.pkg('www@daplie.com');
debugger;
return pkg.remove({ return pkg.remove({
hostname: r.domain, hostname: r.domain,
domain: r.domain, domain: r.domain,
@ -487,9 +483,6 @@ app.controller('websiteCtrl', [
}); });
}; };
vm.Sites.archive = function (r) { vm.Sites.archive = function (r) {
var pkg = Auth.oauth3.pkg('www@daplie.com'); var pkg = Auth.oauth3.pkg('www@daplie.com');
return pkg.archive({ return pkg.archive({
@ -506,27 +499,27 @@ app.controller('websiteCtrl', [
}); });
}; };
vm.doSomething = function (r) { vm.doSomething = function (r) {
window.alert("Fix me"); window.alert("Fix me");
}; };
vm.Shares = {}; vm.shareFolderFrom = function (r, opts) {
vm.Shares.invite = function (r) { var sharePath;
vm.domainName = r.domain; if (vm.breadcrumbsPath.join('/') === '' && vm.breadcrumbs.join('/') === '') {
if (vm.copiedShareMode === undefined) { sharePath = '/';
r.shareMode = '';
} else { } else {
r.shareMode = vm.copiedShareMode; sharePath = vm.breadcrumbsPath.join('/');
} }
r.sharePath = vm.breadcrumbsPath.join(''); // FIXME: shareMode may be broken
opts = {
sharePath: sharePath,
shareMode: ''
};
vm.Shares.invite(r, opts);
};
vm.Shares = {};
vm.Shares.invite = function (r, opts) {
var pkg = Auth.oauth3.pkg('www@daplie.com'); var pkg = Auth.oauth3.pkg('www@daplie.com');
return pkg.invite({ return pkg.invite({
comment: r.shareEmail comment: r.shareEmail
@ -535,27 +528,13 @@ app.controller('websiteCtrl', [
, tld: r.tld , tld: r.tld
, sld: r.sld , sld: r.sld
//, sub: r.sub //, sub: r.sub
, path: r.sharePath , path: opts.sharePath || r.sharePath
, mode: r.shareMode , mode: opts.shareMode || r.shareMode
}).then(function (result) { }).then(function (result) {
var arr = r.sharedWith || []; var arr = r.sharedWith || [];
arr.push(result.data); arr.push(result.data);
r.sharedWith = arr; r.sharedWith = arr;
var msg; window.alert(JSON.stringify(result.data));
var person = result.data.comment;
if (result.data.error) {
msg = result.data.error.message;
} else {
vm.displaySpinner = 'hidden';
msg = 'shared with ' + person;
vm.showInviteContainer = false;
vm.showSharesContainer = true;
r.shareEmail = '';
$scope.selectedAccess = [];
vm.currentFolder = undefined;
}
vm.buildNotification(result, msg);
// window.alert(JSON.stringify(result.data));
}); });
}; };

View File

@ -212,7 +212,7 @@
</div> </div>
</div> </div>
<div class="text-right" ng-show="showShareBtn"> <div class="text-right" ng-show="showShareBtn">
<button type="submit" class="btn btn-success text-center" ng-click="vm.Shares.invite(r)">Share</button> <button type="submit" class="btn btn-success text-center" ng-click="vm.shareFolderFrom(r, opts)">Share</button>
</div> </div>
</form> </form>
</div> </div>