This commit is contained in:
Jon Lambson 2017-09-26 17:25:59 -06:00
parent 9b53de6cd6
commit 2acc8cb2b4
3 changed files with 41 additions and 4 deletions

View File

@ -344,9 +344,23 @@ app.controller('websiteCtrl', [
window.alert(JSON.stringify(result));
});
};
Array.prototype.remByVal = function(val) {
for (var i = 0; i < this.length; i++) {
if (this[i] === val) {
this.splice(i, 1);
i--;
}
}
return this;
};
// TODO: finish thissssssss
vm.breadcrumbs = ['Root'];
vm.breadcrumbsPath = ['/'];
vm.blah = false;
vm.Sites.contents = function (r) {
vm.siteResults = r;
vm.directoryPath = r.newPath;
@ -362,6 +376,21 @@ app.controller('websiteCtrl', [
vm.breadcrumbs.push(path);
vm.breadcrumbsPath.push(path);
}
if (vm.blah) {
if (path === 'Root') {
vm.breadcrumbs = ['Root'];
vm.breadcrumbsPath = ['/'];
vm.activePath = 'active'
vm.blah = false;
} else {
var breadcrumbsPath = vm.breadcrumbsPath;
var breadcrumbs = vm.breadcrumbs;
var removeFromBreadcrumbsPath = breadcrumbsPath.indexOf(path) + 1;
var removeFromBreadcrumbs = breadcrumbs.indexOf(path) + 1;
vm.breadcrumbsPath = breadcrumbsPath.splice(0,removeFromBreadcrumbsPath);
vm.breadcrumbs = breadcrumbs.splice(0,removeFromBreadcrumbs);
}
}
}
updatePath(newPath);
return pkg.contents({
@ -394,8 +423,10 @@ app.controller('websiteCtrl', [
};
vm.doSomething = function (x) {
console.log('path requested', x);
console.log('current path', vm.breadcrumbsPath);
vm.blah = true;
vm.siteDirectories = [];
vm.siteFiles = [];
vm.getSiteContents(x);
};
vm.Shares = {};

View File

@ -178,7 +178,6 @@
</div> -->
<button class="btn btn-info trigger-search" ng-click="vm.Sites.contents(r)">List Files</button>
<div class="white-well" ng-show="vm.showListFiles">
<button type="button" class="close" ng-click="vm.showListFiles = false" ng-show="vm.showListFiles"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>
<file-tree r="r"></file-tree>
</div>
</form>

View File

@ -1,7 +1,8 @@
<div class="text-left">
<div class="row">
<ul class="breadcrumb">
<li ng-repeat="breadcrumb in vm.breadcrumbs track by $index">
<button type="button" class="close" ng-click="vm.showListFiles = false" ng-show="vm.showListFiles"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>
<li ng-repeat="breadcrumb in vm.breadcrumbs track by $index" class="{{ vm.activePath }}">
<a ng-click="vm.doSomething(breadcrumb)" data="{{ breadcrumb }}">{{ breadcrumb }}</a>
<!-- <li class="active">Data</li> -->
</li>
@ -26,4 +27,10 @@
<pre style="font-size: 10px;">{{ vm.folderStructure | stringify }}</pre>
</div>
</div>
<div class="row">
<div class="text-center">
<h3 style="color: red;">TODO:// Add functionality</h3>
<button type="button" class="btn btn-danger"><i class="fa fa-trash"></i> Remove all Files</button>
</div>
</div>
</div>