diff --git a/js/controllers/website-controller.js b/js/controllers/website-controller.js index bbac974..7b93933 100644 --- a/js/controllers/website-controller.js +++ b/js/controllers/website-controller.js @@ -344,26 +344,40 @@ app.controller('websiteCtrl', [ window.alert(JSON.stringify(result)); }); }; - + // TODO: finish thissssssss vm.breadcrumbs = ['Root']; + vm.breadcrumbsPath = ['/']; vm.Sites.contents = function (r) { vm.siteResults = r; + vm.directoryPath = r.newPath; vm.showListFiles = true; vm.siteDirectories = []; + vm.siteFiles = []; 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({ hostname: site.domain, domain: site.domain, tld: site.tld, sld: site.sld, //, sub: r.sub, - path: site.newPath + path: vm.breadcrumbsPath.join('/') }).then(function (result) { vm.folderStructure = result; result.data.forEach(function(file) { if (file.directory) { 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.doSomething = function (path) { - vm.newPath = data; - vm.getSiteContents(path); + vm.getDirectories = function (path) { + vm.siteDirectories = []; + 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 = {}; diff --git a/templates/website.html b/templates/website.html index d268ae0..ca87f7a 100644 --- a/templates/website.html +++ b/templates/website.html @@ -173,9 +173,9 @@