From e695a5299facd17314c2d571118f4c6fe97a8b52 Mon Sep 17 00:00:00 2001 From: Richard Date: Tue, 29 Apr 2014 10:49:46 +0200 Subject: [PATCH 1/2] Moved show warning method to timelines controller. I don't actually think this was exactly related to the error in bug 7186 - i think that was because there was somehow old code - but this was also preventing the warning message from being displayed. --- .../angular/controllers/timelines-controller.js | 6 ++++++ .../timelines/timeline-table-container-directive.js | 9 ++------- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/app/assets/javascripts/angular/controllers/timelines-controller.js b/app/assets/javascripts/angular/controllers/timelines-controller.js index 36039d7e50..ae2294e7a4 100644 --- a/app/assets/javascripts/angular/controllers/timelines-controller.js +++ b/app/assets/javascripts/angular/controllers/timelines-controller.js @@ -36,4 +36,10 @@ angular.module('openproject.timelines.controllers') // Count timeline containers $scope.timelineContainerCount = 0; + + $scope.showWarning = function () { + $scope.underConstruction = false; + $scope.warning = true; + $scope.$apply(); + } }]); diff --git a/app/assets/javascripts/angular/directives/timelines/timeline-table-container-directive.js b/app/assets/javascripts/angular/directives/timelines/timeline-table-container-directive.js index fdfe8a738f..7f4d6cce96 100644 --- a/app/assets/javascripts/angular/directives/timelines/timeline-table-container-directive.js +++ b/app/assets/javascripts/angular/directives/timelines/timeline-table-container-directive.js @@ -36,6 +36,7 @@ angular.module('openproject.timelines.directives') replace: true, templateUrl: '/templates/timelines/timeline_table_container.html', link: function(scope, element, attributes) { + function fetchData() { return TimelineLoaderService.loadTimelineData(scope.timeline); } @@ -81,12 +82,6 @@ angular.module('openproject.timelines.directives') }); } - function showWarning() { - scope.underConstruction = false; - scope.warning = true; - scope.$apply(); - } - function buildWorkPackageTable(timeline){ timeline.lefthandTree = null; // reset cached data tree @@ -115,7 +110,7 @@ angular.module('openproject.timelines.directives') if (scope.rows.length > 0) { completeUI(); } else { - timeline.warn(I18n.t('js.label_no_data'), 'warning', this.showWarning); + timeline.warn(I18n.t('js.label_no_data'), 'warning', scope.showWarning); } } catch (e) { timeline.die(e); From 0ffb035838c7190c463dad93118a9146de6ad10f Mon Sep 17 00:00:00 2001 From: Richard Date: Tue, 29 Apr 2014 11:53:10 +0200 Subject: [PATCH 2/2] Moved showWarning method back to container directive. --- .../angular/controllers/timelines-controller.js | 5 ----- .../timelines/timeline-table-container-directive.js | 8 +++++++- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/app/assets/javascripts/angular/controllers/timelines-controller.js b/app/assets/javascripts/angular/controllers/timelines-controller.js index ae2294e7a4..0e9af3bb27 100644 --- a/app/assets/javascripts/angular/controllers/timelines-controller.js +++ b/app/assets/javascripts/angular/controllers/timelines-controller.js @@ -37,9 +37,4 @@ angular.module('openproject.timelines.controllers') // Count timeline containers $scope.timelineContainerCount = 0; - $scope.showWarning = function () { - $scope.underConstruction = false; - $scope.warning = true; - $scope.$apply(); - } }]); diff --git a/app/assets/javascripts/angular/directives/timelines/timeline-table-container-directive.js b/app/assets/javascripts/angular/directives/timelines/timeline-table-container-directive.js index 7f4d6cce96..06e7f45289 100644 --- a/app/assets/javascripts/angular/directives/timelines/timeline-table-container-directive.js +++ b/app/assets/javascripts/angular/directives/timelines/timeline-table-container-directive.js @@ -37,6 +37,12 @@ angular.module('openproject.timelines.directives') templateUrl: '/templates/timelines/timeline_table_container.html', link: function(scope, element, attributes) { + function showWarning() { + scope.underConstruction = false; + scope.warning = true; + scope.$apply(); + } + function fetchData() { return TimelineLoaderService.loadTimelineData(scope.timeline); } @@ -110,7 +116,7 @@ angular.module('openproject.timelines.directives') if (scope.rows.length > 0) { completeUI(); } else { - timeline.warn(I18n.t('js.label_no_data'), 'warning', scope.showWarning); + timeline.warn(I18n.t('js.label_no_data'), 'warning', showWarning); } } catch (e) { timeline.die(e);