Matteo Scandolo | bf14f88 | 2016-06-02 10:01:34 -0700 | [diff] [blame] | 1 | /* |
Brian O'Connor | 8fb63ec | 2017-08-03 22:46:35 -0700 | [diff] [blame^] | 2 | * Copyright 2015 Open Networking Foundation |
Matteo Scandolo | bf14f88 | 2016-06-02 10:01:34 -0700 | [diff] [blame] | 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 () { |
| 18 | 'use strict'; |
| 19 | |
| 20 | var urlSuffix = '/rs/bundle'; |
| 21 | |
| 22 | var basic = 'basic', |
| 23 | family = 'family'; |
| 24 | |
Matteo Scandolo | a3844ec | 2016-06-02 15:45:19 -0700 | [diff] [blame] | 25 | angular.module('mCord') |
Matteo Scandolo | bf14f88 | 2016-06-02 10:01:34 -0700 | [diff] [blame] | 26 | .controller('CordBundleCtrl', function ($log, $scope, $resource, cordConfig) { |
| 27 | var BundleData, resource, |
| 28 | getData; |
Matteo Scandolo | bf14f88 | 2016-06-02 10:01:34 -0700 | [diff] [blame] | 29 | $scope.show = false; |
| 30 | |
| 31 | // set the current bundle |
| 32 | $scope.name = cordConfig.bundles[cordConfig.activeBundle].name; |
| 33 | $scope.desc = cordConfig.bundles[cordConfig.activeBundle].desc; |
| 34 | $scope.funcs = cordConfig.bundles[cordConfig.activeBundle].functions; |
| 35 | |
| 36 | // set the available bundle |
| 37 | if(cordConfig.activeBundle === 0) { |
| 38 | $scope.available = cordConfig.bundles[1]; |
| 39 | } |
| 40 | else{ |
| 41 | $scope.available = cordConfig.bundles[0]; |
| 42 | } |
| 43 | |
| 44 | // switching the bundles |
| 45 | $scope.changeBundle = function (id) { |
| 46 | if(cordConfig.activeBundle === 0){ |
| 47 | cordConfig.activeBundle = 1; |
| 48 | $scope.available = cordConfig.bundles[0]; |
| 49 | } |
| 50 | else{ |
| 51 | cordConfig.activeBundle = 0; |
| 52 | $scope.available = cordConfig.bundles[1]; |
| 53 | } |
| 54 | $scope.name = cordConfig.bundles[cordConfig.activeBundle].name; |
| 55 | $scope.desc = cordConfig.bundles[cordConfig.activeBundle].desc; |
| 56 | $scope.funcs = cordConfig.bundles[cordConfig.activeBundle].functions; |
| 57 | }; |
| 58 | |
| 59 | // hiding and showing bundles |
| 60 | $scope.showBundles = function () { |
| 61 | $scope.show = !$scope.show; |
| 62 | }; |
| 63 | |
| 64 | $log.debug('Cord Bundle Ctrl has been created.'); |
| 65 | }) |
| 66 | .directive('bundleAvailable', function () { |
| 67 | return { |
Matteo Scandolo | a3844ec | 2016-06-02 15:45:19 -0700 | [diff] [blame] | 68 | templateUrl: 'app/view/services/available.html' |
Matteo Scandolo | bf14f88 | 2016-06-02 10:01:34 -0700 | [diff] [blame] | 69 | }; |
| 70 | }); |
| 71 | }()); |