=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/custom-form.html' --- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/custom-form.html 2014-07-13 13:08:50 +0000 +++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/custom-form.html 2014-11-28 17:14:38 +0000 @@ -1,1 +1,1 @@ - \ No newline at end of file + \ No newline at end of file === modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry-controller.js' --- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry-controller.js 2014-10-22 15:36:30 +0000 +++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry-controller.js 2014-11-28 17:14:38 +0000 @@ -9,6 +9,7 @@ ModalService, DialogService, CurrentSelection, + CustomFormService, TranslationService) { TranslationService.translate(); @@ -304,7 +305,7 @@ $scope.programStageDataElements[prStDe.dataElement.id] = prStDe; }); - $scope.customForm = $scope.currentStage.dataEntryForm ? $scope.currentStage.dataEntryForm.htmlCode : null; + $scope.customForm = CustomFormService.getForProgramStage($scope.currentStage); $scope.displayCustomForm = $scope.customForm ? true:false; $scope.allowProvidedElsewhereExists = false; === modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/directives.js' --- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/directives.js 2014-11-03 11:11:25 +0000 +++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/directives.js 2014-11-28 17:14:38 +0000 @@ -34,19 +34,14 @@ }; }) -.directive('d2CustomForm', function($compile, $parse, CustomFormService) { +.directive('d2CustomForm', function($compile) { return{ restrict: 'E', - link: function(scope, elm, attrs){ - - var customFormType = attrs.customFormType; - var customFormObject = $parse(attrs.customFormObject)(scope); - - if(customFormType === 'PROGRAM_STAGE'){ - var customForm = CustomFormService.getForProgramStage(customFormObject); - elm.html(customForm ? customForm : ''); - $compile(elm.contents())(scope); - } + link: function(scope, elm, attrs){ + scope.$watch('customForm', function(){ + elm.html(scope.customForm); + $compile(elm.contents())(scope); + }); } }; })