mirror of https://github.com/portainer/portainer
36 lines
846 B
JavaScript
36 lines
846 B
JavaScript
|
angular.module('dashboard')
|
||
|
.controller('MasterCtrl', ['$scope', '$cookieStore', 'Settings', function ($scope, $cookieStore, Settings) {
|
||
|
/**
|
||
|
* Sidebar Toggle & Cookie Control
|
||
|
*/
|
||
|
var mobileView = 992;
|
||
|
|
||
|
$scope.getWidth = function() {
|
||
|
return window.innerWidth;
|
||
|
};
|
||
|
|
||
|
$scope.$watch($scope.getWidth, function(newValue, oldValue) {
|
||
|
if (newValue >= mobileView) {
|
||
|
if (angular.isDefined($cookieStore.get('toggle'))) {
|
||
|
$scope.toggle = ! $cookieStore.get('toggle') ? false : true;
|
||
|
} else {
|
||
|
$scope.toggle = true;
|
||
|
}
|
||
|
} else {
|
||
|
$scope.toggle = false;
|
||
|
}
|
||
|
|
||
|
});
|
||
|
|
||
|
$scope.toggleSidebar = function() {
|
||
|
$scope.toggle = !$scope.toggle;
|
||
|
$cookieStore.put('toggle', $scope.toggle);
|
||
|
};
|
||
|
|
||
|
window.onresize = function() {
|
||
|
$scope.$apply();
|
||
|
};
|
||
|
|
||
|
$scope.uiVersion = Settings.uiVersion;
|
||
|
}]);
|