1
0
mirror of https://github.com/bitwarden/browser synced 2026-02-28 10:33:31 +00:00
Files
browser/src/app/global/mainController.js
2017-03-30 23:49:35 -04:00

55 lines
1.5 KiB
JavaScript

angular
.module('bit.global')
.controller('mainController', function ($scope, $state, authService, appSettings, toastr) {
var vm = this;
vm.bodyClass = '';
vm.searchVaultText = null;
vm.version = appSettings.version;
$scope.currentYear = new Date().getFullYear();
$scope.$on('$viewContentLoaded', function () {
authService.getUserProfile().then(function (profile) {
vm.userProfile = profile;
});
if ($.AdminLTE) {
if ($.AdminLTE.layout) {
$.AdminLTE.layout.fix();
$.AdminLTE.layout.fixSidebar();
}
if ($.AdminLTE.pushMenu) {
$.AdminLTE.pushMenu.expandOnHover();
}
$(document).off('click', '.sidebar li a');
}
});
$scope.$on('$stateChangeSuccess', function (event, toState, toParams, fromState, fromParams) {
vm.searchVaultText = null;
if (toState.data.bodyClass) {
vm.bodyClass = toState.data.bodyClass;
return;
}
else {
vm.bodyClass = '';
}
});
$scope.searchVault = function () {
$state.go('backend.user.vault');
};
$scope.addLogin = function () {
$scope.$broadcast('vaultAddLogin');
};
$scope.addFolder = function () {
$scope.$broadcast('vaultAddFolder');
};
});