From ac7f171a98ef46b723c15ca8840f5c3c244c193c Mon Sep 17 00:00:00 2001 From: jaden <noreply@example.com> Date: Fri, 2 Jun 2017 10:26:42 +0200 Subject: [PATCH] removed last of reportController code, make it the bootstrapper, #41 --- .../app/controllers/reportController.js | 32 ++----------------- .../web/reports/templates/reports/report.html | 5 +-- 2 files changed, 4 insertions(+), 33 deletions(-) diff --git a/beat/web/reports/static/reports/app/controllers/reportController.js b/beat/web/reports/static/reports/app/controllers/reportController.js index 2c4700588..64b783d7b 100644 --- a/beat/web/reports/static/reports/app/controllers/reportController.js +++ b/beat/web/reports/static/reports/app/controllers/reportController.js @@ -21,33 +21,7 @@ */ /* reportController - * - * This controller retrieves data from the reportFactory/experimentFactory through the REST API and associates it with the $scope. - * The $scope is ultimately bound to the report view. - * - * This controller is "deprecated" - it needs to be completely removed, and should not be expanded/built upon. + * bootstraps the reports angular code by requiring the ReportService. + * NOTE: DONT add any code to this controller. */ -angular.module('reportApp').controller('reportController',['$scope', 'reportFactory', 'ReportService', function ($scope, reportFactory, ReportService){ - $scope.user; - $scope.report_id; - $scope.url_prefix; - $scope.reportFactory = reportFactory; - $scope.report = {}; - $scope.report_experiments = {}; - $scope.num_report_items = 0; - $scope.max_num = 0; - $scope.item_content = []; - $scope.table_item_content = []; - $scope.selectedObject = {}; - - $scope.init = function(user, report_id, url_prefix){ - $scope.user = user; - $scope.report_id = report_id; - $scope.url_prefix = url_prefix; - }; - - $scope.initWithReportNumber = function(report_number, url_prefix){ - $scope.report_number = report_number; - $scope.url_prefix = url_prefix; - }; -}]); +angular.module('reportApp').controller('reportController',['ReportService', function (ReportService){}]); diff --git a/beat/web/reports/templates/reports/report.html b/beat/web/reports/templates/reports/report.html index 4934e4fd5..a5eb70ed2 100644 --- a/beat/web/reports/templates/reports/report.html +++ b/beat/web/reports/templates/reports/report.html @@ -140,10 +140,7 @@ {% block content %} -<div ng-app="reportApp" ng-controller="reportController" - {% if author and not report_number %}ng-init="init('{{ author }}', '{{report_name}}', '{{ URL_PREFIX }}')"{% endif %} - {% if report_number and not author %}ng-init="initWithReportNumber('{{report_number}}', '{{ URL_PREFIX }}')"{% endif %} - > +<div ng-app="reportApp" ng-controller="reportController"> {% csrf_token %} {% if report %} -- GitLab