blob: e183466c49a36d691b0dfea78046cb06e46d775a [file] [log] [blame]
Matteo Scandolo4eb4ccb2016-01-26 11:02:16 -08001/*
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 Scandolo9fb53f72016-01-26 11:34:15 -080018 'use strict';
Matteo Scandolo4eb4ccb2016-01-26 11:02:16 -080019
Matteo Scandolo9fb53f72016-01-26 11:34:15 -080020 var modules = [
21 'ngRoute',
22 'ngResource',
23 'ngAnimate',
24 'cordMast',
25 'cordFoot',
26 'cordNav',
27 'cordLogin',
28 'cordHome',
29 'cordUser',
30 'cordBundle'
31 ],
32 viewIds = [
33 ],
34 viewDependencies = [],
35 dependencies;
Matteo Scandolo4eb4ccb2016-01-26 11:02:16 -080036
Matteo Scandolo9fb53f72016-01-26 11:34:15 -080037 function capitalize(word) {
38 return word ? word[0].toUpperCase() + word.slice(1) : word;
39 }
40
41 viewIds.forEach(function (id) {
42 if (id) {
43 viewDependencies.push('cord' + capitalize(id));
Matteo Scandolo4eb4ccb2016-01-26 11:02:16 -080044 }
Matteo Scandolo9fb53f72016-01-26 11:34:15 -080045 });
Matteo Scandolo4eb4ccb2016-01-26 11:02:16 -080046
Matteo Scandolo9fb53f72016-01-26 11:34:15 -080047 dependencies = modules.concat(viewDependencies);
Matteo Scandolo4eb4ccb2016-01-26 11:02:16 -080048
Matteo Scandolo9fb53f72016-01-26 11:34:15 -080049 angular.module('cordGui', dependencies)
50 .config(['$routeProvider', function ($routeProvider) {
51 $routeProvider
52 .when('/login', {
53 controller: 'CordLoginCtrl',
54 controllerAs: 'ctrl',
55 templateUrl: 'app/view/login/login.html'
56 })
57 .when('/home', {
58 controller: 'CordHomeCtrl',
59 controllerAs: 'ctrl',
60 templateUrl: 'app/view/home/home.html'
61 })
62 .when('/user', {
63 controller: 'CordUserCtrl',
64 controllerAs: 'ctrl',
65 templateUrl: 'app/view/user/user.html'
66 })
67 .when('/bundle', {
68 controller: 'CordBundleCtrl',
69 controllerAs: 'ctrl',
70 templateUrl: 'app/view/bundle/bundle.html'
71 })
72 .otherwise({
73 redirectTo: '/login'
74 });
75 }])
76 .controller('CordCtrl', ['$scope', '$location',
77 function ($scope, $location) {
78 $scope.shared = {
79 url: 'http://' + $location.host() + ':' + $location.port(),
80 userActivity: {}
81 };
82 $scope.page = {};
83 }]);
Matteo Scandolo4eb4ccb2016-01-26 11:02:16 -080084}());