file tree navigation
This commit is contained in:
parent
5314114b4b
commit
57eb74d1c9
|
@ -83,6 +83,7 @@ app.controller('websiteCtrl', [
|
||||||
//vm.unzipPath = '/';
|
//vm.unzipPath = '/';
|
||||||
vm.uploadPath = '/';
|
vm.uploadPath = '/';
|
||||||
|
|
||||||
|
|
||||||
// already validated
|
// already validated
|
||||||
function domainIsVerified(r) {
|
function domainIsVerified(r) {
|
||||||
return r.verifiedAt || r.mode;
|
return r.verifiedAt || r.mode;
|
||||||
|
@ -345,6 +346,109 @@ app.controller('websiteCtrl', [
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
vm.breadcrumbs = [];
|
||||||
|
vm.breadcrumbsPath = [''];
|
||||||
|
vm.siteDirectories = [];
|
||||||
|
vm.siteFiles = [];
|
||||||
|
vm.Sites.allContents = function (r) {
|
||||||
|
vm.copyR = r;
|
||||||
|
vm.strictPath = r.shareAccess.path;
|
||||||
|
var pkg = Auth.oauth3.pkg('www@daplie.com');
|
||||||
|
return pkg.contents({
|
||||||
|
hostname: r.domain
|
||||||
|
, domain: r.domain
|
||||||
|
, tld: r.tld
|
||||||
|
, sld: r.sld
|
||||||
|
//, sub: r.sub
|
||||||
|
, path: r.shareAccess.path
|
||||||
|
}).then(function (result) {
|
||||||
|
if (r.shareAccess.path !== '/') {
|
||||||
|
var strictPathName = r.shareAccess.path.split('/');
|
||||||
|
strictPathName = strictPathName[strictPathName.length - 2];
|
||||||
|
vm.breadcrumbs.push(strictPathName);
|
||||||
|
} else {
|
||||||
|
vm.breadcrumbs.push('root');
|
||||||
|
}
|
||||||
|
vm.folderStructure = result;
|
||||||
|
result.data.forEach(function(data){
|
||||||
|
if (data.file) {
|
||||||
|
vm.siteFiles.push(data.name);
|
||||||
|
}
|
||||||
|
if (data.directory) {
|
||||||
|
vm.siteDirectories.push(data.name);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
vm.displaySpinner = 'hidden';
|
||||||
|
// window.alert(JSON.stringify(result));
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
vm.Sites.contents = function (r, dir) {
|
||||||
|
vm.displaySpinner = '';
|
||||||
|
var pkg = Auth.oauth3.pkg('www@daplie.com');
|
||||||
|
return pkg.contents({
|
||||||
|
hostname: r.domain
|
||||||
|
, domain: r.domain
|
||||||
|
, tld: r.tld
|
||||||
|
, sld: r.sld
|
||||||
|
//, sub: r.sub
|
||||||
|
, path: dir
|
||||||
|
}).then(function (result) {
|
||||||
|
vm.displaySpinner = 'hidden';
|
||||||
|
vm.siteFiles = [];
|
||||||
|
vm.siteDirectories = [];
|
||||||
|
vm.folderStructure = result;
|
||||||
|
result.data.forEach(function(data){
|
||||||
|
if (data.file) {
|
||||||
|
vm.siteFiles.push(data.name);
|
||||||
|
}
|
||||||
|
if (data.directory) {
|
||||||
|
vm.siteDirectories.push(data.name);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// window.alert(JSON.stringify(result));
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
vm.getDirectoriesFromBreadcrumbs = function (dir) {
|
||||||
|
if (vm.copyR.shareAccess.path !== '/') {
|
||||||
|
var arry = vm.breadcrumbsPath.split('/');
|
||||||
|
arry.pop();
|
||||||
|
var removeFromBreadcrumbs = arry.indexOf(dir) + 1;
|
||||||
|
var notearry = vm.breadcrumbs;
|
||||||
|
notearry.pop();
|
||||||
|
vm.breadcrumbsPath = arry.splice(0,removeFromBreadcrumbs);
|
||||||
|
vm.breadcrumbs = vm.breadcrumbs.splice(0,removeFromBreadcrumbs);
|
||||||
|
vm.Sites.contents(vm.copyR, vm.breadcrumbsPath.join('/'));
|
||||||
|
} else {
|
||||||
|
var removeFromBreadcrumbs = vm.breadcrumbsPath.indexOf(dir) + 1;
|
||||||
|
vm.breadcrumbsPath = vm.breadcrumbsPath.splice(0,removeFromBreadcrumbs);
|
||||||
|
vm.breadcrumbs = vm.breadcrumbs.splice(0,removeFromBreadcrumbs);
|
||||||
|
vm.Sites.contents(vm.copyR, vm.breadcrumbsPath.join('/'));
|
||||||
|
if (dir === 'root') {
|
||||||
|
vm.breadcrumbs = ['root'];
|
||||||
|
vm.breadcrumbsPath = [''];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
vm.getDirectories = function (dir) {
|
||||||
|
if (vm.copyR.shareAccess.path !== '/') {
|
||||||
|
vm.breadcrumbs.push(dir);
|
||||||
|
vm.breadcrumbsPath = vm.copyR.shareAccess.path + dir + '/';
|
||||||
|
vm.Sites.contents(vm.copyR, vm.breadcrumbsPath);
|
||||||
|
} else {
|
||||||
|
vm.breadcrumbs.push(dir);
|
||||||
|
vm.breadcrumbsPath.push(dir);
|
||||||
|
vm.Sites.contents(vm.copyR, vm.breadcrumbsPath.join('/'));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
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');
|
||||||
|
|
|
@ -157,7 +157,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-3">
|
<div class="col-md-3">
|
||||||
<div class="square-service-block">
|
<div class="square-service-block">
|
||||||
<a ng-click="vm.showAction('files'); vm.Sites.contents(r);" class="cp trigger-files-list-refresh">
|
<a ng-click="vm.showAction('files'); vm.Sites.allContents(r);" class="cp trigger-files-list-refresh">
|
||||||
<div class="ssb-icon"><i class="fa fa-sitemap" aria-hidden="true"></i></div>
|
<div class="ssb-icon"><i class="fa fa-sitemap" aria-hidden="true"></i></div>
|
||||||
<h2 class="ssb-title">Files</h2>
|
<h2 class="ssb-title">Files</h2>
|
||||||
</a>
|
</a>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<div class="text-left" ng-hide="vm.displayFileTree">
|
<div class="text-left" ng-hide="vm.displayFileTree">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<ul class="breadcrumb">
|
<ul class="breadcrumb">
|
||||||
<li ng-repeat="breadcrumb in vm.breadcrumbs track by $index" ng-click="vm.getDirectoriesFromBreadcrumbs(breadcrumb); vm.cleanPath();" data="{{ breadcrumb }}" class="cp breadcrumbs-list">
|
<li ng-repeat="breadcrumb in vm.breadcrumbs track by $index" ng-click="vm.getDirectoriesFromBreadcrumbs(breadcrumb);" data="{{ breadcrumb }}" class="cp breadcrumbs-list">
|
||||||
{{ breadcrumb | capitalize }}
|
{{ breadcrumb | capitalize }}
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
@ -14,7 +14,7 @@
|
||||||
<ul class="tree ls-none">
|
<ul class="tree ls-none">
|
||||||
<li class="directories-go-here" ng-repeat="directory in vm.siteDirectories track by $index">
|
<li class="directories-go-here" ng-repeat="directory in vm.siteDirectories track by $index">
|
||||||
<input type="checkbox" id="{{ r.challenge }}{{ $index }}" />
|
<input type="checkbox" id="{{ r.challenge }}{{ $index }}" />
|
||||||
<label class="tree_label" for="{{ r.challenge }}{{ $index }}" ng-click="vm.getDirectories(directory); vm.cleanPath();" data="{{ directory }}">{{ directory }}</label><span class="pull-right"><button ng-if="r.shareAccess.write" type="button" class="btn btn-danger btn-xs" ng-click="vm.deleteFilesFrom(r, directory)" data="{{ directory }}" ><i class="fa fa-trash"></i></button></span>
|
<label class="tree_label" for="{{ r.challenge }}{{ $index }}" ng-click="vm.getDirectories(directory);" data="{{ directory }}">{{ directory }}</label><span class="pull-right"><button ng-if="r.shareAccess.write" type="button" class="btn btn-danger btn-xs" ng-click="vm.deleteFilesFrom(r, directory)" data="{{ directory }}" ><i class="fa fa-trash"></i></button></span>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<ul class="tree files-only ls-none">
|
<ul class="tree files-only ls-none">
|
||||||
|
|
Loading…
Reference in New Issue