2015-12-09 04:35:05 +01:00
|
|
|
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 () {
|
2017-03-07 06:36:27 +01:00
|
|
|
vm.userProfile = authService.getUserProfile();
|
|
|
|
|
2015-12-09 04:35:05 +01:00
|
|
|
if ($.AdminLTE) {
|
|
|
|
if ($.AdminLTE.layout) {
|
|
|
|
$.AdminLTE.layout.fix();
|
|
|
|
$.AdminLTE.layout.fixSidebar();
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($.AdminLTE.pushMenu) {
|
|
|
|
$.AdminLTE.pushMenu.expandOnHover();
|
|
|
|
}
|
2017-02-23 06:45:54 +01:00
|
|
|
|
|
|
|
$(document).off('click', '.sidebar li a');
|
2015-12-09 04:35:05 +01:00
|
|
|
}
|
2017-03-05 02:41:45 +01:00
|
|
|
|
|
|
|
$('.table-responsive').on('shown.bs.dropdown', function (e) {
|
|
|
|
var t = $(this),
|
|
|
|
m = $(e.target).find('.dropdown-menu'),
|
|
|
|
tb = t.offset().top + t.height(),
|
|
|
|
mb = m.offset().top + m.outerHeight(true),
|
|
|
|
d = 20; // Space for shadow + scrollbar.
|
|
|
|
if (t[0].scrollWidth > t.innerWidth()) {
|
|
|
|
if (mb + d > tb) {
|
|
|
|
t.css('padding-bottom', ((mb + d) - tb));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
t.css('overflow', 'visible');
|
|
|
|
}
|
|
|
|
}).on('hidden.bs.dropdown', function () {
|
|
|
|
$(this).css({ 'padding-bottom': '', 'overflow': '' });
|
|
|
|
});
|
2015-12-09 04:35:05 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
$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 () {
|
2017-03-02 04:47:24 +01:00
|
|
|
$state.go('backend.user.vault');
|
2015-12-09 04:35:05 +01:00
|
|
|
};
|
|
|
|
|
2017-01-03 04:26:32 +01:00
|
|
|
$scope.addLogin = function () {
|
|
|
|
$scope.$broadcast('vaultAddLogin');
|
2015-12-09 04:35:05 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
$scope.addFolder = function () {
|
|
|
|
$scope.$broadcast('vaultAddFolder');
|
|
|
|
};
|
|
|
|
});
|