From 9b53de6cd6ee2bbb71edfebd526cb739aefa8d21 Mon Sep 17 00:00:00 2001 From: Jon Lambson Date: Tue, 26 Sep 2017 13:06:05 -0600 Subject: [PATCH] got it --- js/controllers/website-controller.js | 34 ++++++++++++++++++++----- templates/website.html | 4 +-- templates/widgets/filetree.html | 38 +++++----------------------- 3 files changed, 37 insertions(+), 39 deletions(-) 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 @@

List Files:

-
+
diff --git a/templates/widgets/filetree.html b/templates/widgets/filetree.html index d8363be..757d4cb 100644 --- a/templates/widgets/filetree.html +++ b/templates/widgets/filetree.html @@ -1,8 +1,8 @@
@@ -11,36 +11,12 @@
  • - +
  • -
    -
  • - - -
      -
    • - - -
        -
      • Level 2
      • -
      • Level 2
      • -
      -
    • -
    • - - -
        -
      • Level 2
      • -
      • - - -
          -
        • Level 3
        • -
        -
      • -
      -
    • -
    +
+
    +
  • + {{ file }}