fix empty template message after expanding

This commit is contained in:
Keith Grant 2019-06-07 15:59:10 -07:00 committed by Jim Ladd
parent 0f19d98d84
commit fc4c9af86f
4 changed files with 31 additions and 8 deletions

View File

@ -12,9 +12,17 @@ function atSyntaxHighlightController ($scope, AngularCodeMirror) {
}
$scope.value = $scope.value || $scope.default;
initCodeMirror();
$scope.$watch(varName, () => {
$scope.value = $scope[varName];
});
}
function initCodeMirror () {
$scope.varName = varName;
$scope[varName] = $scope.value;
const codeMirror = AngularCodeMirror($scope.disabled);
const codeMirror = AngularCodeMirror(!!$scope.disabled);
codeMirror.addModes({
jinja2: {
mode: $scope.mode,
@ -34,10 +42,6 @@ function atSyntaxHighlightController ($scope, AngularCodeMirror) {
lineNumbers: true,
mode: $scope.mode,
});
$scope.$watch(varName, () => {
$scope.value = $scope[varName];
});
}
vm.name = $scope.name;
@ -48,6 +52,9 @@ function atSyntaxHighlightController ($scope, AngularCodeMirror) {
angular.element(document).ready(() => {
init();
});
$scope.$on('reset-code-mirror', () => {
initCodeMirror();
});
}
atSyntaxHighlightController.$inject = [

View File

@ -153,6 +153,14 @@ export default ['Rest', 'Wait', 'NotificationsFormObject',
});
};
$scope.$watch('customize_messages', (value) => {
if (value) {
$scope.$broadcast('reset-code-mirror', {
customize_messages: $scope.customize_messages,
});
}
});
$scope.emailOptionsChange = function () {
if ($scope.email_options === 'use_ssl') {
if ($scope.use_ssl) {

View File

@ -237,6 +237,14 @@ export default ['Rest', 'Wait',
});
};
$scope.$watch('customize_messages', (value) => {
if (value) {
$scope.$broadcast('reset-code-mirror', {
customize_messages: $scope.customize_messages,
});
}
});
$scope.emailOptionsChange = function () {
if ($scope.email_options === 'use_ssl') {
if ($scope.use_ssl) {

View File

@ -598,7 +598,7 @@ export default ['i18n', function(i18n) {
rows: 2,
},
start_body: {
label: i18n._('Start Body'),
label: i18n._('Start Expanded Message'),
class: 'Form-formGroup--fullWidth',
type: 'syntax_highlight',
mode: 'jinja2',
@ -615,7 +615,7 @@ export default ['i18n', function(i18n) {
rows: 2,
},
success_body: {
label: i18n._('Success Body'),
label: i18n._('Success Expanded Message'),
class: 'Form-formGroup--fullWidth',
type: 'syntax_highlight',
mode: 'jinja2',
@ -632,7 +632,7 @@ export default ['i18n', function(i18n) {
rows: 2,
},
error_body: {
label: i18n._('Error Body'),
label: i18n._('Error Expanded Message'),
class: 'Form-formGroup--fullWidth',
type: 'syntax_highlight',
mode: 'jinja2',