Matteo Scandolo | 4eb4ccb | 2016-01-26 11:02:16 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2015 Open Networking Laboratory |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | (function () { |
Matteo Scandolo | 94992fd | 2016-01-27 13:51:07 -0800 | [diff] [blame] | 18 | 'use strict'; |
Matteo Scandolo | 4eb4ccb | 2016-01-26 11:02:16 -0800 | [diff] [blame] | 19 | |
Matteo Scandolo | 94992fd | 2016-01-27 13:51:07 -0800 | [diff] [blame] | 20 | var urlSuffix = '/rs/logout'; |
Matteo Scandolo | 4eb4ccb | 2016-01-26 11:02:16 -0800 | [diff] [blame] | 21 | |
Matteo Scandolo | 94992fd | 2016-01-27 13:51:07 -0800 | [diff] [blame] | 22 | angular.module('cordMast', []) |
| 23 | .controller('CordMastCtrl', function ($log, $scope, $location, User) { |
| 24 | $scope.logout = function () { |
| 25 | User.logout() |
| 26 | .then(function(){ |
| 27 | $location.path('/login'); |
Matteo Scandolo | 4eb4ccb | 2016-01-26 11:02:16 -0800 | [diff] [blame] | 28 | }); |
Matteo Scandolo | 94992fd | 2016-01-27 13:51:07 -0800 | [diff] [blame] | 29 | }; |
| 30 | }) |
| 31 | .directive('mast', function () { |
| 32 | return { |
| 33 | restrict: 'E', |
Matteo Scandolo | 413c45d | 2016-01-29 11:40:41 -0800 | [diff] [blame] | 34 | templateUrl: 'app/fw/mast/mast.html', |
| 35 | controller: 'CordMastCtrl', |
| 36 | controllerAs: '' |
Matteo Scandolo | 94992fd | 2016-01-27 13:51:07 -0800 | [diff] [blame] | 37 | }; |
Matteo Scandolo | 413c45d | 2016-01-29 11:40:41 -0800 | [diff] [blame] | 38 | }) |
| 39 | .directive('closeOnRouteChange', function(){ |
| 40 | return { |
| 41 | restrict: 'A', |
| 42 | link: function(scope, elem){ |
| 43 | scope.$on('$routeChangeStart', function(next, current) { |
| 44 | elem.removeClass('in'); |
| 45 | }); |
| 46 | } |
| 47 | } |
| 48 | }); |
Matteo Scandolo | 4eb4ccb | 2016-01-26 11:02:16 -0800 | [diff] [blame] | 49 | }()); |