Commit 9229e1641dbc5c4917e6f9eb779b108088fde1f2

Authored by Leonardo Merlin
1 parent ddbe93cb

Fixes #43

src/app/components/app-navbar/app-navbar.directive.js
... ... @@ -9,17 +9,25 @@
9 9 function appNavbar() {
10 10  
11 11 /** @ngInject */
12   - function NavbarController($log) {
  12 + function NavbarController(AuthService, $log) {
13 13 $log.debug('NavbarController');
14 14  
15 15 var vm = this;
16   -
17   - vm.scrollTo = function(hash) {
18   - var $el = angular.element('#' + hash);
19   - angular.element('body').animate({scrollTop: $el.offset().top}, 'slow');
20   - };
  16 + vm.AuthService = AuthService;
  17 + vm.$log = $log;
21 18 }
22 19  
  20 + // NavbarController.prototype.scrollTo = function (hash){
  21 + // var $el = angular.element('#' + hash);
  22 + // angular.element('body').animate({scrollTop: $el.offset().top}, 'slow');
  23 + // };
  24 +
  25 + NavbarController.prototype.onClickLogout = function (){
  26 + var vm = this;
  27 +
  28 + vm.AuthService.logout();
  29 + };
  30 +
23 31 var directive = {
24 32 restrict: 'E',
25 33 templateUrl: 'app/components/app-navbar/app-navbar.html',
... ...
src/app/components/app-navbar/app-navbar.html
... ... @@ -22,6 +22,11 @@
22 22  
23 23 <div id="navbar-collapse" class="collapse navbar-collapse">
24 24 <ul class="nav navbar-nav navbar-right">
  25 + <li class="hidden-sm hidden-md hidden-lg">
  26 + <a ng-show="$root.currentUser === undefined" ui-sref="entrar">Entrar</a>
  27 + <a ng-show="$root.currentUser !== undefined" href="#" ng-click="vm.onClickLogout()">Sair</a>
  28 + </li>
  29 + <li ui-sref-active="active"><a ui-sref="inicio">Início</a></li>
25 30 <li ui-sref-active="active"><a ui-sref="sobre">Sobre</a></li>
26 31 <li ui-sref-active="active"><a ui-sref="programas">Programas</a></li>
27 32 <li ui-sref-active="active"><a ui-sref="propostas">Propostas</a></li>
... ... @@ -33,7 +38,7 @@
33 38 <social-share class="dropdown-menu dropdown-menu-right" arrow-class="social-share--arrow"></social-share>
34 39 <div class="clearfix"></div>
35 40 </li>
36   - <li class="hidden-sm hidden-md hidden-lg" style="border: none; padding-bottom: 10px !important;">
  41 + <li class="hidden-sm hidden-md hidden-lg" style="border: none; margin-top: 15px; padding-bottom: 10px !important;">
37 42 <div class="text text-right" style="padding-right: 20px;">DIALOGA <b>NAS REDES</b></div>
38 43 <ul class="social-share list-inline">
39 44 <li>
... ...
src/app/components/auth/auth.service.js
... ... @@ -204,7 +204,7 @@
204 204 function logout () {
205 205  
206 206 Session.destroy();
207   - $rootScope.currentUser = null;
  207 + $rootScope.currentUser = undefined;
208 208 $rootScope.$broadcast(AUTH_EVENTS.logoutSuccess);
209 209 }
210 210  
... ...