diff --git a/css/styles.css b/css/styles.css index 02440da..443ce94 100644 --- a/css/styles.css +++ b/css/styles.css @@ -420,3 +420,6 @@ label.tree_label:after { border-bottom: 0; } padding: 1em; border-radius: 0.3em; } +.tree ul { + -webkit-padding-start: 0; +} diff --git a/js/controllers/website-controller.js b/js/controllers/website-controller.js index d99a060..bbac974 100644 --- a/js/controllers/website-controller.js +++ b/js/controllers/website-controller.js @@ -30,7 +30,7 @@ function handleFiles(ev) { } window.document.body.addEventListener('change', handleFiles); -app.directive('daplieFileChange', function () { +app.directive('daplieFileChange', [function () { return { restrict: 'A', require:"ngModel", @@ -42,7 +42,15 @@ app.directive('daplieFileChange', function () { }); } }; -}); +}]); + +app.directive('fileTree', [function () { + return { + restrict: 'EA', + templateUrl: '/templates/widgets/filetree.html', + controller: 'websiteCtrl as vm' + }; +}]); app.controller('websiteCtrl', [ '$scope', '$q', 'Auth', 'azp@oauth3.org', '$timeout' @@ -336,22 +344,38 @@ app.controller('websiteCtrl', [ window.alert(JSON.stringify(result)); }); }; - vm.Sites.contents = function (r) { - vm.showListFiles = true; - 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.newPath - }).then(function (result) { - // window.alert(JSON.stringify(result.data)); - vm.folderStructure = result; - }); + vm.breadcrumbs = ['Root']; + vm.Sites.contents = function (r) { + vm.siteResults = r; + vm.showListFiles = true; + vm.siteDirectories = []; + var pkg = Auth.oauth3.pkg('www@daplie.com'); + vm.getSiteContents = function (site) { + return pkg.contents({ + hostname: site.domain, + domain: site.domain, + tld: site.tld, + sld: site.sld, + //, sub: r.sub, + path: site.newPath + }).then(function (result) { + vm.folderStructure = result; + result.data.forEach(function(file) { + if (file.directory) { + vm.siteDirectories.push(file.name); + } + }); + }); + }; + vm.getSiteContents(r); }; + + vm.doSomething = function (path) { + vm.newPath = data; + vm.getSiteContents(path); + }; + vm.Shares = {}; vm.Shares.invite = function (r) { var pkg = Auth.oauth3.pkg('www@daplie.com'); @@ -486,8 +510,9 @@ app.controller('websiteCtrl', [ return matches; }; -}]) -.filter('stringify', function() { +}]); + +app.filter('stringify', function() { function getSerialize (fn, decycle) { var seen = [], keys = []; decycle = decycle || function(key, value) { diff --git a/templates/website.html b/templates/website.html index 5f74ec9..d268ae0 100644 --- a/templates/website.html +++ b/templates/website.html @@ -179,13 +179,7 @@
-
-
-
-
{{ vm.folderStructure | stringify }}
-
-
-
+
diff --git a/templates/widgets/filetree.html b/templates/widgets/filetree.html new file mode 100644 index 0000000..d8363be --- /dev/null +++ b/templates/widgets/filetree.html @@ -0,0 +1,53 @@ +
+
+ +
+
+
    +
  • + + +
  • +
    +
  • + + +
      +
    • + + +
        +
      • Level 2
      • +
      • Level 2
      • +
      +
    • +
    • + + +
        +
      • Level 2
      • +
      • + + +
          +
        • Level 3
        • +
        +
      • +
      +
    • +
    +
  • +
+
+
+
+
+
{{ vm.folderStructure | stringify }}
+
+
+