From 4c4e48c1993a119465dd23eeb2a722d292c9c664 Mon Sep 17 00:00:00 2001
From: Jaden Diefenbaugh <blakcap@users.noreply.github.com>
Date: Wed, 8 Feb 2017 14:03:56 +0100
Subject: [PATCH] style fixes, no more global var app

---
 .../reports/static/reports/app/app.config.js  | 28 ++++++-----
 beat/web/reports/static/reports/app/app.js    | 46 ++++++-------------
 .../app/controllers/reportController.js       | 12 ++---
 3 files changed, 34 insertions(+), 52 deletions(-)

diff --git a/beat/web/reports/static/reports/app/app.config.js b/beat/web/reports/static/reports/app/app.config.js
index 0b9a5c261..0896cf9b7 100644
--- a/beat/web/reports/static/reports/app/app.config.js
+++ b/beat/web/reports/static/reports/app/app.config.js
@@ -1,34 +1,32 @@
 /*
  * Copyright (c) 2016 Idiap Research Institute, http://www.idiap.ch/
  * Contact: beat.support@idiap.ch
- * 
+ *
  * This file is part of the beat.web module of the BEAT platform.
- * 
+ *
  * Commercial License Usage
  * Licensees holding valid commercial BEAT licenses may use this file in
  * accordance with the terms contained in a written agreement between you
  * and Idiap. For further information contact tto@idiap.ch
- * 
+ *
  * Alternatively, this file may be used under the terms of the GNU Affero
  * Public License version 3 as published by the Free Software and appearing
  * in the file LICENSE.AGPL included in the packaging of this file.
  * The BEAT platform is distributed in the hope that it will be useful, but
  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  * or FITNESS FOR A PARTICULAR PURPOSE.
- * 
+ *
  * You should have received a copy of the GNU Affero Public License along
  * with the BEAT platform. If not, see http://www.gnu.org/licenses/.
-*/
-var app = angular.module('reportApp');
-
-app.config(function configureStartEndSymbol($interpolateProvider) {
-            $interpolateProvider.startSymbol('{$').endSymbol('$}');
-        }
+ */
+angular.module('reportApp').config(function configureStartEndSymbol($interpolateProvider) {
+	$interpolateProvider.startSymbol('{$').endSymbol('$}');
+}
 );
 
-app.config(function configHttp($httpProvider) {
-            $httpProvider.defaults.xsrfCookieName = 'csrftoken';
-            $httpProvider.defaults.xsrfHeaderName = 'X-CSRFToken';
-            $httpProvider.defaults.withCredentials = true;
-        }
+angular.module('reportApp').config(function configHttp($httpProvider) {
+	$httpProvider.defaults.xsrfCookieName = 'csrftoken';
+	$httpProvider.defaults.xsrfHeaderName = 'X-CSRFToken';
+	$httpProvider.defaults.withCredentials = true;
+}
 );
diff --git a/beat/web/reports/static/reports/app/app.js b/beat/web/reports/static/reports/app/app.js
index 569fbec8b..7ebf397a4 100644
--- a/beat/web/reports/static/reports/app/app.js
+++ b/beat/web/reports/static/reports/app/app.js
@@ -1,51 +1,35 @@
 /*
  * Copyright (c) 2016 Idiap Research Institute, http://www.idiap.ch/
  * Contact: beat.support@idiap.ch
- * 
+ *
  * This file is part of the beat.web module of the BEAT platform.
- * 
+ *
  * Commercial License Usage
  * Licensees holding valid commercial BEAT licenses may use this file in
  * accordance with the terms contained in a written agreement between you
  * and Idiap. For further information contact tto@idiap.ch
- * 
+ *
  * Alternatively, this file may be used under the terms of the GNU Affero
  * Public License version 3 as published by the Free Software and appearing
  * in the file LICENSE.AGPL included in the packaging of this file.
  * The BEAT platform is distributed in the hope that it will be useful, but
  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  * or FITNESS FOR A PARTICULAR PURPOSE.
- * 
+ *
  * You should have received a copy of the GNU Affero Public License along
  * with the BEAT platform. If not, see http://www.gnu.org/licenses/.
-*/
-var app = angular.module('reportApp', ['ui.router', 'angular.filter']);
+ */
+angular.module('reportApp', ['ui.router', 'angular.filter']);
 
 
-app.config(function ($stateProvider, $urlRouterProvider){
+angular.module('reportApp').config(function ($stateProvider, $urlRouterProvider){
+	$urlRouterProvider
+	.otherwise('/');
 
-    $urlRouterProvider
-        .otherwise('/');
-
-    $stateProvider
-        .state('report', {
-            url: '/',
-            views: {
-                //'myReportInfo': {
-                //    //templateUrl: '/platform/reports/partials/reportInfo/',
-                //    templateUrl: function(params)
-                //    {
-                //        console.log("ici");
-                //        console.log(params);
-                //        console.log($scope);
-                //    },
-                //    //templateUrl: '/reports/partials/reportGeneralInfo.html',
-                //    controller: 'reportController',
-                //    //controller: function($scope)
-                //    //{
-                //    //    console.log($scope);
-                //    //},
-                //}
-            }
-        })
+	$stateProvider
+	.state('report', {
+		url: '/',
+		views: {
+		}
+	});
 });
diff --git a/beat/web/reports/static/reports/app/controllers/reportController.js b/beat/web/reports/static/reports/app/controllers/reportController.js
index 5381a592b..abe6f20fa 100644
--- a/beat/web/reports/static/reports/app/controllers/reportController.js
+++ b/beat/web/reports/static/reports/app/controllers/reportController.js
@@ -60,7 +60,7 @@ angular.module('reportApp').controller('reportController',['$scope', 'reportFact
 		getReportData($scope.user, $scope.report_id);
 		$scope.item_content = dataFactory.getData(data_itemcontent_file);
 		$scope.table_item_content = dataFactory.getData(data_table_itemcontent_file);
-	}
+	};
 
 	$scope.initWithReportNumber = function(report_number, url_prefix, data_itemcontent_file, data_table_itemcontent_file){
 		$scope.report_number = report_number;
@@ -68,7 +68,7 @@ angular.module('reportApp').controller('reportController',['$scope', 'reportFact
 		getReportDataFromNumber($scope.report_number);
 		$scope.item_content = dataFactory.getData(data_itemcontent_file);
 		$scope.table_item_content = dataFactory.getData(data_table_itemcontent_file);
-	}
+	};
 
 	function getReportData(user, report_id){
 		reportFactory.getReportInformation(user, report_id, $scope.url_prefix)
@@ -167,7 +167,7 @@ angular.module('reportApp').controller('reportController',['$scope', 'reportFact
 			for(var i = 0; i < Object.keys($scope.sorted_experiments_keys_tables_sortkey).length; i++){
 				$scope.sorted_tables.push(Object.keys($scope.sorted_experiments_keys_tables_sortkey)[i]);
 			}
-		})
+		});
 	}
 
 	function getExperimentDataForAuthor(all_experiments){
@@ -212,7 +212,7 @@ angular.module('reportApp').controller('reportController',['$scope', 'reportFact
 				$scope.sorted_tables.push(Object.keys($scope.sorted_experiments_keys_tables_sortkey)[i]);
 			}
 
-		})
+		});
 	}
 
 	function getExperimentData(experiment_id){
@@ -237,7 +237,7 @@ angular.module('reportApp').controller('reportController',['$scope', 'reportFact
 
 			intersectBlocks(experiment_id);
 			algorithmParameters(experiment_id);
-		})
+		});
 	}
 
 	function getPlotters(){
@@ -310,7 +310,7 @@ angular.module('reportApp').controller('reportController',['$scope', 'reportFact
 
 	function intersectBlocks(experiment_id){
 		$scope.report_experiments_blocks[experiment_id] = Object.keys($scope.report_experiments[experiment_id].blocks_status);
-		var values = $.map($scope.report_experiments_blocks[experiment_id], function(value, key) { return value });
+		var values = $.map($scope.report_experiments_blocks[experiment_id], function(value, key) { return value; });
 		$scope.report_experiments_blocks_merged_blocks.push(values);
 	}
 
-- 
GitLab