From af2f7a7a5a6c9426cff2aa89a9e958d59df64add Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Wed, 29 Mar 2017 19:21:06 -0400 Subject: [PATCH] organization listing from side menu --- src/app/global/sideNavController.js | 28 +++++++++++++----- src/app/views/userLayout.html | 44 ++++------------------------- 2 files changed, 27 insertions(+), 45 deletions(-) diff --git a/src/app/global/sideNavController.js b/src/app/global/sideNavController.js index 099d5108..76e20488 100644 --- a/src/app/global/sideNavController.js +++ b/src/app/global/sideNavController.js @@ -4,14 +4,28 @@ angular .controller('sideNavController', function ($scope, $state, authService) { $scope.$state = $state; $scope.params = $state.params; + $scope.orgs = []; - if ($state.includes('backend.org')) { - authService.getUserProfile().then(function (userProfile) { - if (!userProfile.organizations || !($state.params.orgId in userProfile.organizations)) { - return; - } + authService.getUserProfile().then(function (userProfile) { + if (!userProfile.organizations) { + return; + } + if ($state.includes('backend.org') && ($state.params.orgId in userProfile.organizations)) { $scope.orgProfile = userProfile.organizations[$state.params.orgId]; - }); - } + } + else { + var orgs = []; + for (var orgId in userProfile.organizations) { + if (userProfile.organizations.hasOwnProperty(orgId)) { + orgs.push(userProfile.organizations[orgId]); + } + } + $scope.orgs = orgs; + } + }); + + $scope.viewOrganization = function (id) { + $state.go('backend.org.dashboard', { orgId: id }); + }; }); diff --git a/src/app/views/userLayout.html b/src/app/views/userLayout.html index d2d42cc8..4a55f840 100644 --- a/src/app/views/userLayout.html +++ b/src/app/views/userLayout.html @@ -79,49 +79,17 @@ Get Help -
  • - FREE - MOBILE APPS -
  • - - iOS - -
  • -
  • - - Android + + Download Apps
  • - FREE - BROWSER EXTENSIONS + ORGANIZATIONS
  • -
  • - - Chrome - -
  • -
  • - - Firefox - -
  • -
  • - - Opera - -
  • -
  • - - coming soon - Edge +
  • + + {{org.name}}