diff --git a/js/controllers/website-controller.js b/js/controllers/website-controller.js index 7b93933..84a92f1 100644 --- a/js/controllers/website-controller.js +++ b/js/controllers/website-controller.js @@ -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 = {}; diff --git a/templates/website.html b/templates/website.html index ca87f7a..87f1afd 100644 --- a/templates/website.html +++ b/templates/website.html @@ -178,7 +178,6 @@ -->
{{ vm.folderStructure | stringify }}