diff --git a/awx/ui/static/js/controllers/JobTemplates.js b/awx/ui/static/js/controllers/JobTemplates.js index dc1baf5960..7719229cd9 100644 --- a/awx/ui/static/js/controllers/JobTemplates.js +++ b/awx/ui/static/js/controllers/JobTemplates.js @@ -554,7 +554,7 @@ function JobTemplatesEdit($scope, $rootScope, $compile, $location, $log, $routeP Alert, ProcessErrors, LoadBreadCrumbs, RelatedSearchInit, RelatedPaginateInit, ReturnToCaller, ClearScope, InventoryList, CredentialList, ProjectList, LookUpInit, GetBasePath, md5Setup, ParseTypeChange, JobStatusToolTip, FormatDate, Wait, Stream, Empty, Prompt, ParseVariableString, ToJSON, SchedulesControllerInit, JobsControllerInit, JobsListUpdate, - GetChoices, SchedulesListInit, SchedulesList, CallbackHelpInit, PlaybookRun, SurveyControllerInit){ + GetChoices, SchedulesListInit, SchedulesList, CallbackHelpInit, PlaybookRun, SurveyControllerInit, $sce){ ClearScope(); @@ -593,7 +593,8 @@ function JobTemplatesEdit($scope, $rootScope, $compile, $location, $log, $routeP SurveyControllerInit({ scope: $scope, parent_scope: $scope, - id: id + id: id, + sce: $sce }); callback = function() { @@ -1061,5 +1062,5 @@ JobTemplatesEdit.$inject = ['$scope', '$rootScope', '$compile', '$location', '$l 'ReturnToCaller', 'ClearScope', 'InventoryList', 'CredentialList', 'ProjectList', 'LookUpInit', 'GetBasePath', 'md5Setup', 'ParseTypeChange', 'JobStatusToolTip', 'FormatDate', 'Wait', 'Stream', 'Empty', 'Prompt', 'ParseVariableString', 'ToJSON', 'SchedulesControllerInit', 'JobsControllerInit', 'JobsListUpdate', 'GetChoices', - 'SchedulesListInit', 'SchedulesList', 'CallbackHelpInit', 'PlaybookRun' , 'SurveyControllerInit' + 'SchedulesListInit', 'SchedulesList', 'CallbackHelpInit', 'PlaybookRun' , 'SurveyControllerInit', '$sce' ]; \ No newline at end of file diff --git a/awx/ui/static/js/helpers/Survey.js b/awx/ui/static/js/helpers/Survey.js index 70897702a0..2ba260f1d9 100644 --- a/awx/ui/static/js/helpers/Survey.js +++ b/awx/ui/static/js/helpers/Survey.js @@ -13,7 +13,7 @@ 'use strict'; -angular.module('SurveyHelper', [ 'Utilities', 'RestServices', 'SchedulesHelper', 'SearchHelper', 'PaginationHelpers', 'ListGenerator', 'ModalDialog', +angular.module('SurveyHelper', [ 'Utilities', 'RestServices', 'SchedulesHelper', 'SearchHelper', 'PaginationHelpers', 'ListGenerator', 'ModalDialog' , 'GeneratorHelpers']) .factory('ShowSurveyModal', ['Wait', 'CreateDialog', 'Empty', '$compile' , @@ -288,6 +288,7 @@ angular.module('SurveyHelper', [ 'Utilities', 'RestServices', 'SchedulesHelper', defaultValue = (question.default) ? question.default : ""; defaultValue = defaultValue.replace(//g, ">"); + defaultValue = scope.serialize(defaultValue); html+='
'+ '
'+ ''+ @@ -297,6 +298,7 @@ angular.module('SurveyHelper', [ 'Utilities', 'RestServices', 'SchedulesHelper', defaultValue = (question.default) ? question.default : (question.default_textarea) ? question.default_textarea: "" ; defaultValue = defaultValue.replace(//g, ">"); + defaultValue = scope.serialize(defaultValue); html+='
'+ '
'+ ''+ @@ -311,6 +313,7 @@ angular.module('SurveyHelper', [ 'Utilities', 'RestServices', 'SchedulesHelper', checked = (!Empty(question.default) && question.default.indexOf(choices[i])!==-1) ? "checked" : ""; choices[i] = choices[i] .replace(//g, ">"); + choices[i] = scope.serialize(choices[i]); html+= '' + ''+choices[i] +'
' ; } @@ -462,8 +465,9 @@ angular.module('SurveyHelper', [ 'Utilities', 'RestServices', 'SchedulesHelper', id = params.id, i, url, html, element, questions = [], - form = SurveyQuestionForm; - + form = SurveyQuestionForm, + sce = params.sce; + scope.sce = sce; scope.survey_questions = []; scope.answer_types=[ {name: 'Text' , type: 'text'}, @@ -474,6 +478,10 @@ angular.module('SurveyHelper', [ 'Utilities', 'RestServices', 'SchedulesHelper', {name: 'Float', type: 'float'} ]; + scope.serialize = function(expression){ + return scope.sce.getTrustedHtml(expression); + }; + scope.deleteSurvey = function() { DeleteSurvey({ scope: scope, diff --git a/awx/ui/static/lib/ansible/directives.js b/awx/ui/static/lib/ansible/directives.js index 441fd75d1a..4d4e0d2dd2 100644 --- a/awx/ui/static/lib/ansible/directives.js +++ b/awx/ui/static/lib/ansible/directives.js @@ -117,11 +117,7 @@ angular.module('AWDirectives', ['RestServices', 'Utilities', 'AuthService', 'Job }; }) - // caplitalize Add to any input field where the first letter of each - // word should be capitalized. Use in place of css test-transform. - // For some reason "text-transform: capitalize" in breadcrumbs - // causes a break at each blank space. And of course, - // "autocapitalize='word'" only works in iOS. Use this as a fix. + .directive('awSurveyQuestion', function() { return { require: 'ngModel',