Blame view
src/app/components/navigation/navigation.controller.js
3.44 KB
66ee5529f
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 |
(function(){ 'use strict'; angular.module('sbAdminApp') .controller('con',['$scope',con]) .controller('MainController', ['navService','$rootScope','$mdSidenav', '$mdBottomSheet', '$log', '$q', '$state', '$mdToast', '$scope', '$mdMedia', '$mdDialog','LoginService', 'toaster', MainController]); function MainController(navService,$rootScope, $mdSidenav, $mdBottomSheet, $log, $q, $state, $mdToast, $scope, $mdMedia, $mdDialog, LoginService, toaster) { var vm = this; //vm.menuItems = [ ]; vm.selectItem = selectItem; vm.toggleItemsList = toggleItemsList; vm.showActions = showActions; vm.title = $state.current.data.title; vm.showSimpleToast = showSimpleToast; vm.toggleRightSidebar = toggleRightSidebar; vm.autoFocusContent = false; vm.isOpen = isOpen; vm.toggleOpen = toggleOpen; vm.menu = navService; $scope.companyName = localStorage.getItem("companyName"); /*navService.loadAllItems().then(function(menuItems) { vm.menuItems = [].concat(menuItems); });*/ function toggleRightSidebar() { $mdSidenav('right').toggle(); } function toggleItemsList() { var pending = $mdBottomSheet.hide() || $q.when(true); pending.then(function(){ $mdSidenav('left').toggle(); }); } function isOpen(section) { return navService.isSectionSelected(section); } function toggleOpen(section) { navService.toggleSelectSection(section); } function selectItem (item) { /*$scope.searchDID = false; if(item.name == 'DID'){ $scope.searchDID = true; }*/ vm.title = item.name; vm.toggleItemsList(); vm.showSimpleToast(vm.title); } function showActions($event) { $mdBottomSheet.show({ parent: angular.element(document.getElementById('content')), templateUrl: 'app/views/partials/bottomSheet.html', controller: [ '$mdBottomSheet', SheetController], controllerAs: "vm", bindToController : true, targetEvent: $event }).then(function(clickedItem) { clickedItem && $log.debug( clickedItem.name + ' clicked!'); }); function SheetController( $mdBottomSheet ) { var vm = this; vm.actions = [ { name: 'Share', icon: 'share', url: 'https://twitter.com/intent/tweet?text=Angular%20Material%20Dashboard%20https://github.com/flatlogic/angular-material-dashboard%20via%20@flatlogicinc' }, { name: 'Star', icon: 'star', url: 'https://github.com/flatlogic/angular-material-dashboard/stargazers' } ]; vm.performAction = function(action) { $mdBottomSheet.hide(action); }; } } function showSimpleToast(title) { $mdToast.show( $mdToast.simple() .content(title) .hideDelay(2000) .position('bottom right') ); } $scope.logout = function() { LoginService.logOut().save().$promise.then(function(result){ window.location.reload(); LoginService.deleteUser(); $state.go("login"); }, function(error){ if(error){ toaster.error("server error"); } }); } } function con($scope){ $scope.class = "sidebar-full"; $scope.changeClass = function(){ if ($scope.class === "sidebar-full"){ $scope.class = "sidebar-mini"; } else{ $scope.class = "sidebar-full"; } }; } })(); |