2016-12-15 03:33:47 +00:00
|
|
|
angular.module('main', [])
|
2017-01-22 23:14:34 +00:00
|
|
|
.controller('MainController', ['$scope', '$cookieStore', 'StateManager',
|
|
|
|
function ($scope, $cookieStore, StateManager) {
|
2016-12-15 03:33:47 +00:00
|
|
|
|
2016-06-02 05:34:03 +00:00
|
|
|
/**
|
|
|
|
* Sidebar Toggle & Cookie Control
|
|
|
|
*/
|
|
|
|
var mobileView = 992;
|
|
|
|
$scope.getWidth = function() {
|
|
|
|
return window.innerWidth;
|
|
|
|
};
|
|
|
|
|
2017-01-22 23:14:34 +00:00
|
|
|
$scope.applicationState = StateManager.getState();
|
|
|
|
|
2016-06-02 05:34:03 +00:00
|
|
|
$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();
|
|
|
|
};
|
|
|
|
}]);
|