forked from maestrano/mno-enterprise
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request maestrano#84 from alexnoox/215-app-init-refactor
[MNOE-215] App initialisation refactor
- Loading branch information
Showing
11 changed files
with
67 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,17 @@ | ||
angular.module 'mnoEnterpriseAngular' | ||
.controller 'LayoutController', ($stateParams, $state, $q, MnoeCurrentUser, MnoeOrganizations, MnoeMarketplace) -> | ||
.controller 'LayoutController', ($scope, $stateParams, $state, $q, MnoeCurrentUser, MnoeOrganizations) -> | ||
'ngInject' | ||
|
||
layout = this | ||
|
||
# Hide the layout | ||
layout.isLoggedIn = false | ||
|
||
# App initialization | ||
userPromise = MnoeCurrentUser.get() | ||
|
||
# Load the current organization if defined (url param, cookie or first) | ||
organizationPromise = MnoeOrganizations.getCurrentId($stateParams.dhbRefId) | ||
|
||
$q.all([userPromise, organizationPromise]).then( | ||
-> | ||
# Display the layout | ||
layout.isLoggedIn = true | ||
|
||
# Pre-load the market place | ||
MnoeMarketplace.getApps() | ||
|
||
# Remove param from url | ||
$state.go('.', {dhbRefId: undefined}) | ||
# Impac! is displayed only to admin and super admin | ||
$scope.$watch(MnoeOrganizations.getSelectedId, (newValue) -> | ||
MnoeCurrentUser.get().then( | ||
(response) -> | ||
selectedOrg = _.find(response.organizations, {id: parseInt(newValue)}) | ||
if MnoeOrganizations.role.atLeastAdmin(selectedOrg.current_user_role) | ||
$state.go('home.impac') | ||
else | ||
$state.go('home.apps') | ||
) if newValue? | ||
) | ||
|
||
return |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.