functionality to delete file by pathname
This commit is contained in:
		
							parent
							
								
									f60017b725
								
							
						
					
					
						commit
						5627e4983d
					
				@ -67,7 +67,6 @@ app.controller('websiteCtrl', [
 | 
				
			|||||||
  vm.domains = [];
 | 
					  vm.domains = [];
 | 
				
			||||||
  //vm.unzipPath = '/';
 | 
					  //vm.unzipPath = '/';
 | 
				
			||||||
  vm.uploadPath = '/';
 | 
					  vm.uploadPath = '/';
 | 
				
			||||||
  vm.deleteAllFiles = false;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // already validated
 | 
					  // already validated
 | 
				
			||||||
  function domainIsVerified(r) {
 | 
					  function domainIsVerified(r) {
 | 
				
			||||||
@ -346,11 +345,31 @@ app.controller('websiteCtrl', [
 | 
				
			|||||||
      window.open(result.data.url);
 | 
					      window.open(result.data.url);
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
  };
 | 
					  };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  vm.Sites.remove = function (r, opts) {
 | 
					  vm.Sites.remove = function (r, opts) {
 | 
				
			||||||
 | 
					    function getPathToDelete(r, pathName) {
 | 
				
			||||||
 | 
					      vm.autoPopulateWebPath;
 | 
				
			||||||
 | 
					      if (vm.autoPopulateWebPath === undefined && opts !== undefined) {
 | 
				
			||||||
 | 
					        r.path = '/' + opts;
 | 
				
			||||||
 | 
					      } else {
 | 
				
			||||||
 | 
					        r.path = vm.autoPopulateWebPath + pathName;
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					      if (opts === undefined) {
 | 
				
			||||||
 | 
					        opts = {};
 | 
				
			||||||
 | 
					        r.path = '/';
 | 
				
			||||||
 | 
					        opts.path = '/';
 | 
				
			||||||
 | 
					        r.confirm = true;
 | 
				
			||||||
 | 
					        opts.confirm = true;
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    getPathToDelete(r, opts);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!window.confirm("Delete files for this site?")) {
 | 
					    if (!window.confirm("Delete files for this site?")) {
 | 
				
			||||||
      return;
 | 
					      return;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    var pkg = Auth.oauth3.pkg('www@daplie.com');
 | 
					    var pkg = Auth.oauth3.pkg('www@daplie.com');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return pkg.remove({
 | 
					    return pkg.remove({
 | 
				
			||||||
      hostname: r.domain
 | 
					      hostname: r.domain
 | 
				
			||||||
    , domain: r.domain
 | 
					    , domain: r.domain
 | 
				
			||||||
@ -365,6 +384,7 @@ app.controller('websiteCtrl', [
 | 
				
			|||||||
    });
 | 
					    });
 | 
				
			||||||
  };
 | 
					  };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  vm.breadcrumbs = ['Root'];
 | 
					  vm.breadcrumbs = ['Root'];
 | 
				
			||||||
  vm.breadcrumbsPath = ['/'];
 | 
					  vm.breadcrumbsPath = ['/'];
 | 
				
			||||||
  vm.breadcrumbPathClicked = false;
 | 
					  vm.breadcrumbPathClicked = false;
 | 
				
			||||||
 | 
				
			|||||||
@ -16,7 +16,7 @@
 | 
				
			|||||||
      </ul>
 | 
					      </ul>
 | 
				
			||||||
      <ul class="tree files-only ls-none">
 | 
					      <ul class="tree files-only ls-none">
 | 
				
			||||||
        <li ng-repeat="file in vm.siteFiles track by $index">
 | 
					        <li ng-repeat="file in vm.siteFiles track by $index">
 | 
				
			||||||
          <span class="tree_label filez">{{ file }}</span><span class="pull-right"><button type="button" class="btn btn-danger btn-xs" ng-click="vm.Sites.remove(file)" data="{{ file }}"><i class="fa fa-trash"></i></button></span>
 | 
					          <span class="tree_label filez">{{ file }}</span><span class="pull-right"><button type="button" class="btn btn-danger btn-xs" ng-click="vm.Sites.remove(r, file)" data="{{ file }}" data="{{ r }}"><i class="fa fa-trash"></i></button></span>
 | 
				
			||||||
        </li>
 | 
					        </li>
 | 
				
			||||||
        <li class="move-back">
 | 
					        <li class="move-back">
 | 
				
			||||||
          <a ng-click="vm.showUploadContainer = true;"><i class="fa fa-plus"></i> Add Files</a>
 | 
					          <a ng-click="vm.showUploadContainer = true;"><i class="fa fa-plus"></i> Add Files</a>
 | 
				
			||||||
@ -52,7 +52,8 @@
 | 
				
			|||||||
  </div>
 | 
					  </div>
 | 
				
			||||||
  <div class="row">
 | 
					  <div class="row">
 | 
				
			||||||
    <div class="text-center">
 | 
					    <div class="text-center">
 | 
				
			||||||
      <button type="button" class="btn btn-danger" ng-click="vm.Sites.remove(r);"><i class="fa fa-trash"></i> Remove all Files</button>
 | 
					      <span class="text-danger">TODO:// Fix functionality to delete ALL files...</span><br>
 | 
				
			||||||
 | 
					      <button type="button" class="btn btn-danger" ng-click="vm.Sites.remove(r)"><i class="fa fa-trash"></i> Remove all Files</button>
 | 
				
			||||||
    </div>
 | 
					    </div>
 | 
				
			||||||
  </div>
 | 
					  </div>
 | 
				
			||||||
</div>
 | 
					</div>
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user