sharing should be dynamic
This commit is contained in:
		
							parent
							
								
									e91d913547
								
							
						
					
					
						commit
						5cf80bb80b
					
				@ -444,9 +444,6 @@ app.controller('websiteCtrl', [
 | 
			
		||||
    }
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
  vm.removeAllFiles = function (r, opts) {
 | 
			
		||||
    console.log(r);
 | 
			
		||||
    console.log(opts);
 | 
			
		||||
@ -471,7 +468,6 @@ app.controller('websiteCtrl', [
 | 
			
		||||
      return;
 | 
			
		||||
    }
 | 
			
		||||
    var pkg = Auth.oauth3.pkg('www@daplie.com');
 | 
			
		||||
    debugger;
 | 
			
		||||
    return pkg.remove({
 | 
			
		||||
      hostname: r.domain,
 | 
			
		||||
      domain: r.domain,
 | 
			
		||||
@ -487,9 +483,6 @@ app.controller('websiteCtrl', [
 | 
			
		||||
    });
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
  vm.Sites.archive = function (r) {
 | 
			
		||||
    var pkg = Auth.oauth3.pkg('www@daplie.com');
 | 
			
		||||
    return pkg.archive({
 | 
			
		||||
@ -506,27 +499,27 @@ app.controller('websiteCtrl', [
 | 
			
		||||
    });
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
  vm.doSomething = function (r) {
 | 
			
		||||
    window.alert("Fix me");
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  vm.Shares = {};
 | 
			
		||||
  vm.Shares.invite = function (r) {
 | 
			
		||||
    vm.domainName = r.domain;
 | 
			
		||||
    if (vm.copiedShareMode === undefined) {
 | 
			
		||||
      r.shareMode = '';
 | 
			
		||||
  vm.shareFolderFrom = function (r, opts) {
 | 
			
		||||
    var sharePath;
 | 
			
		||||
    if (vm.breadcrumbsPath.join('/') === '' && vm.breadcrumbs.join('/') === '') {
 | 
			
		||||
      sharePath = '/';
 | 
			
		||||
    } 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');
 | 
			
		||||
    return pkg.invite({
 | 
			
		||||
      comment: r.shareEmail
 | 
			
		||||
@ -535,27 +528,13 @@ app.controller('websiteCtrl', [
 | 
			
		||||
    , tld: r.tld
 | 
			
		||||
    , sld: r.sld
 | 
			
		||||
    //, sub: r.sub
 | 
			
		||||
    , path: r.sharePath
 | 
			
		||||
    , mode: r.shareMode
 | 
			
		||||
    , path: opts.sharePath || r.sharePath
 | 
			
		||||
    , mode: opts.shareMode || r.shareMode
 | 
			
		||||
    }).then(function (result) {
 | 
			
		||||
      var arr = r.sharedWith || [];
 | 
			
		||||
      arr.push(result.data);
 | 
			
		||||
      r.sharedWith = arr;
 | 
			
		||||
      var msg;
 | 
			
		||||
      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));
 | 
			
		||||
      window.alert(JSON.stringify(result.data));
 | 
			
		||||
    });
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -212,7 +212,7 @@
 | 
			
		||||
                  </div>
 | 
			
		||||
                </div>
 | 
			
		||||
                <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>
 | 
			
		||||
              </form>
 | 
			
		||||
            </div>
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user