This commit is contained in:
Jon Lambson 2017-09-26 13:06:05 -06:00
parent a737338278
commit 9b53de6cd6
3 changed files with 37 additions and 39 deletions

View File

@ -344,26 +344,40 @@ app.controller('websiteCtrl', [
window.alert(JSON.stringify(result)); window.alert(JSON.stringify(result));
}); });
}; };
// TODO: finish thissssssss
vm.breadcrumbs = ['Root']; vm.breadcrumbs = ['Root'];
vm.breadcrumbsPath = ['/'];
vm.Sites.contents = function (r) { vm.Sites.contents = function (r) {
vm.siteResults = r; vm.siteResults = r;
vm.directoryPath = r.newPath;
vm.showListFiles = true; vm.showListFiles = true;
vm.siteDirectories = []; vm.siteDirectories = [];
vm.siteFiles = [];
var pkg = Auth.oauth3.pkg('www@daplie.com'); var pkg = Auth.oauth3.pkg('www@daplie.com');
vm.getSiteContents = function (site) { vm.getSiteContents = function (site, newPath) {
newPath = site;
site = vm.siteResults;
function updatePath (path) {
if (typeof path !== 'object') {
vm.breadcrumbs.push(path);
vm.breadcrumbsPath.push(path);
}
}
updatePath(newPath);
return pkg.contents({ return pkg.contents({
hostname: site.domain, hostname: site.domain,
domain: site.domain, domain: site.domain,
tld: site.tld, tld: site.tld,
sld: site.sld, sld: site.sld,
//, sub: r.sub, //, sub: r.sub,
path: site.newPath path: vm.breadcrumbsPath.join('/')
}).then(function (result) { }).then(function (result) {
vm.folderStructure = result; vm.folderStructure = result;
result.data.forEach(function(file) { result.data.forEach(function(file) {
if (file.directory) { if (file.directory) {
vm.siteDirectories.push(file.name); vm.siteDirectories.push(file.name);
} else if (file.file) {
vm.siteFiles.push(file.name);
} }
}); });
}); });
@ -371,9 +385,17 @@ app.controller('websiteCtrl', [
vm.getSiteContents(r); vm.getSiteContents(r);
}; };
vm.doSomething = function (path) { vm.getDirectories = function (path) {
vm.newPath = data; vm.siteDirectories = [];
vm.getSiteContents(path); vm.siteFiles = [];
var site = vm.siteResults;
vm.directoryPath = path;
vm.getSiteContents(path, site);
};
vm.doSomething = function (x) {
console.log('path requested', x);
console.log('current path', vm.breadcrumbsPath);
}; };
vm.Shares = {}; vm.Shares = {};

View File

@ -173,9 +173,9 @@
</form> </form>
<form class="form-inline text-center"> <form class="form-inline text-center">
<h4 class="text-left">List Files:</h4> <h4 class="text-left">List Files:</h4>
<div class="form-group"> <!-- <div class="form-group">
<input type="text" class="form-control" ng-model="r.newPath" placeholder="Ex: Directory Name" /> <input type="text" class="form-control" ng-model="r.newPath" placeholder="Ex: Directory Name" />
</div> </div> -->
<button class="btn btn-info trigger-search" ng-click="vm.Sites.contents(r)">List Files</button> <button class="btn btn-info trigger-search" ng-click="vm.Sites.contents(r)">List Files</button>
<div class="white-well" ng-show="vm.showListFiles"> <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> <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>

View File

@ -1,8 +1,8 @@
<div class="text-left"> <div class="text-left">
<div class="row"> <div class="row">
<ul class="breadcrumb"> <ul class="breadcrumb">
<li ng-repeat="breadcrumb in vm.breadcrumbs"> <li ng-repeat="breadcrumb in vm.breadcrumbs track by $index">
<a>{{ breadcrumb }}</a> <a ng-click="vm.doSomething(breadcrumb)" data="{{ breadcrumb }}">{{ breadcrumb }}</a>
<!-- <li class="active">Data</li> --> <!-- <li class="active">Data</li> -->
</li> </li>
</ul> </ul>
@ -11,36 +11,12 @@
<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.doSomething(directory)" data="{{ directory }}">{{ directory }}</label> <label class="tree_label" for="{{ r.challenge }}{{ $index }}" ng-click="vm.getDirectories(directory)" data="{{ directory }}">{{ directory }}</label>
</li> </li>
<hr> </ul>
<li> <ul class="tree ls-none">
<input type="checkbox" id="{{ r.challenge }}" /> <li ng-repeat="file in vm.siteFiles track by $index">
<label class="tree_label" for="{{ r.challenge }}">Level 0</label> <span class="tree_label">{{ file }}</span>
<ul class="ls-none">
<li>
<input type="checkbox" id="{{ r.challenge }}1" />
<label for="{{ r.challenge }}1" class="tree_label">Level 1</label>
<ul class="ls-none">
<li><span class="tree_label">Level 2</span></li>
<li><span class="tree_label">Level 2</span></li>
</ul>
</li>
<li>
<input type="checkbox" id="{{ r.challenge }}2" />
<label for="{{ r.challenge }}2" class="tree_label">Looong level 1 <br/>label text <br/>with line-breaks</label>
<ul class="ls-none">
<li><span class="tree_label">Level 2</span></li>
<li>
<input type="checkbox" id="{{ r.challenge }}3" />
<label for="{{ r.challenge }}3" class="tree_label"><span class="tree_custom">Specified tree item view</span></label>
<ul class="ls-none">
<li><span class="tree_label">Level 3</span></li>
</ul>
</li>
</ul>
</li>
</ul>
</li> </li>
</ul> </ul>
</div> </div>