mirror of
https://github.com/ansible/awx.git
synced 2026-03-01 00:38:45 -03:30
fix ids to support multiple syntax-highlights at once
This commit is contained in:
@@ -11,15 +11,15 @@ function atSyntaxHighlightController ($scope, AngularCodeMirror) {
|
|||||||
$scope.disabled = false;
|
$scope.disabled = false;
|
||||||
}
|
}
|
||||||
// TODO: get default value
|
// TODO: get default value
|
||||||
$scope.codeMirrorValue = $scope.codeMirrorValue || '';
|
$scope.value = $scope.value || $scope.default;
|
||||||
$scope.parseType = 'jinja2';
|
$scope.parseType = 'jinja2';
|
||||||
|
|
||||||
$scope.variablesName = variablesName;
|
$scope.variablesName = variablesName;
|
||||||
$scope[variablesName] = $scope.codeMirrorValue;
|
$scope[variablesName] = $scope.value || '';
|
||||||
const codeMirror = AngularCodeMirror($scope.disabled);
|
const codeMirror = AngularCodeMirror($scope.disabled);
|
||||||
codeMirror.addModes({
|
codeMirror.addModes({
|
||||||
jinja2: {
|
jinja2: {
|
||||||
mode: 'text/x-jinja2',
|
mode: 'jinja2',
|
||||||
matchBrackets: true,
|
matchBrackets: true,
|
||||||
autoCloseBrackets: true,
|
autoCloseBrackets: true,
|
||||||
styleActiveLine: true,
|
styleActiveLine: true,
|
||||||
@@ -29,7 +29,6 @@ function atSyntaxHighlightController ($scope, AngularCodeMirror) {
|
|||||||
scrollbarStyle: null,
|
scrollbarStyle: null,
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// codeMirror.fromTextArea(document.getElementById(`${$scope.name}_codemirror`));
|
|
||||||
codeMirror.showTextArea({
|
codeMirror.showTextArea({
|
||||||
scope: $scope,
|
scope: $scope,
|
||||||
model: variablesName,
|
model: variablesName,
|
||||||
@@ -39,12 +38,12 @@ function atSyntaxHighlightController ($scope, AngularCodeMirror) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
$scope.$watch(variablesName, () => {
|
$scope.$watch(variablesName, () => {
|
||||||
$scope.codeMirrorValue = $scope[variablesName];
|
$scope.value = $scope[variablesName];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
vm.name = $scope.name;
|
vm.name = $scope.name;
|
||||||
vm.variablesName = variablesName;
|
// vm.variablesName = variablesName;
|
||||||
vm.parseType = $scope.parseType;
|
vm.parseType = $scope.parseType;
|
||||||
if ($scope.init) {
|
if ($scope.init) {
|
||||||
$scope.init = init;
|
$scope.init = init;
|
||||||
@@ -73,7 +72,7 @@ function atCodeMirrorTextarea () {
|
|||||||
labelClass: '@',
|
labelClass: '@',
|
||||||
tooltip: '@',
|
tooltip: '@',
|
||||||
tooltipPlacement: '@',
|
tooltipPlacement: '@',
|
||||||
variables: '=',
|
value: '=',
|
||||||
name: '@',
|
name: '@',
|
||||||
init: '='
|
init: '='
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,27 +1,29 @@
|
|||||||
<div>
|
<div>
|
||||||
<div class="atCodeMirror-label">
|
<div class="atCodeMirror-label">
|
||||||
<div class="atCodeMirror-labelLeftSide">
|
<div class="atCodeMirror-labelLeftSide">
|
||||||
<span class="atCodeMirror-labelText" ng-class="labelClass">
|
<span class="atCodeMirror-labelText" ng-class="labelClass">
|
||||||
{{ label || vm.strings.get('code_mirror.label.VARIABLES') }}
|
{{ label || vm.strings.get('code_mirror.label.VARIABLES') }}
|
||||||
</span>
|
</span>
|
||||||
<a id=""
|
<a
|
||||||
href=""
|
id=""
|
||||||
aw-pop-over="{{ tooltip || vm.strings.get('code_mirror.tooltip.TOOLTIP') }}"
|
href=""
|
||||||
data-placement="{{ tooltipPlacement || 'top' }}"
|
aw-pop-over="{{ tooltip || vm.strings.get('code_mirror.tooltip.TOOLTIP') }}"
|
||||||
data-container="body"
|
data-placement="{{ tooltipPlacement || 'top' }}"
|
||||||
over-title="{{ label || vm.strings.get('code_mirror.label.VARIABLES') }}"
|
data-container="body"
|
||||||
class="help-link"
|
over-title="{{ label || vm.strings.get('code_mirror.label.VARIABLES') }}"
|
||||||
data-original-title="{{ label || vm.strings.get('code_mirror.label.VARIABLES') }}"
|
class="help-link"
|
||||||
title="{{ label || vm.strings.get('code_mirror.label.VARIABLES') }}"
|
data-original-title="{{ label || vm.strings.get('code_mirror.label.VARIABLES') }}"
|
||||||
tabindex="-1"
|
title="{{ label || vm.strings.get('code_mirror.label.VARIABLES') }}"
|
||||||
ng-if="tooltip">
|
tabindex="-1"
|
||||||
<i class="fa fa-question-circle"></i>
|
ng-if="!!tooltip"
|
||||||
</a>
|
>
|
||||||
|
<i class="fa fa-question-circle"></i>
|
||||||
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<textarea
|
<textarea
|
||||||
ng-disabled="disabled"
|
ng-disabled="disabled"
|
||||||
rows="6"
|
rows="2"
|
||||||
ng-model="codeMirrorValue"
|
ng-model="codeMirrorValue"
|
||||||
name="{{ vm.name }}_codemirror"
|
name="{{ vm.name }}_codemirror"
|
||||||
class="form-control Form-textArea"
|
class="form-control Form-textArea"
|
||||||
|
|||||||
@@ -187,11 +187,11 @@ export default ['Rest', 'Wait', 'NotificationsFormObject',
|
|||||||
"description": $scope.description,
|
"description": $scope.description,
|
||||||
"organization": $scope.organization,
|
"organization": $scope.organization,
|
||||||
"messages": $scope.customize_messages ? {
|
"messages": $scope.customize_messages ? {
|
||||||
start_message: $scope.start_message,
|
start_message: $scope.start_message,
|
||||||
start_body: $scope.start_body,
|
start_body: $scope.start_body,
|
||||||
success_message: $scope.success_message,
|
success_message: $scope.success_message,
|
||||||
success_body: $scope.success_body,
|
success_body: $scope.success_body,
|
||||||
error_message: $scope.error_message,
|
error_message: $scope.error_message,
|
||||||
error_body: $scope.error_body,
|
error_body: $scope.error_body,
|
||||||
} : null,
|
} : null,
|
||||||
"notification_type": v,
|
"notification_type": v,
|
||||||
|
|||||||
@@ -593,40 +593,43 @@ export default ['i18n', function(i18n) {
|
|||||||
class: 'Form-formGroup--fullWidth',
|
class: 'Form-formGroup--fullWidth',
|
||||||
type: 'syntax_highlight',
|
type: 'syntax_highlight',
|
||||||
default: '',
|
default: '',
|
||||||
ngShow: "true || customize_messages",
|
ngShow: "customize_messages",
|
||||||
|
rows: 1,
|
||||||
},
|
},
|
||||||
start_body: {
|
start_body: {
|
||||||
label: i18n._('Start Body'),
|
label: i18n._('Start Message Expanded'),
|
||||||
class: 'Form-formGroup--fullWidth',
|
class: 'Form-formGroup--fullWidth',
|
||||||
type: 'textarea',
|
type: ' syntax_highlight',
|
||||||
default: '',
|
default: '',
|
||||||
ngShow: "customize_messages && notification_type.value == 'email'",
|
ngShow: "customize_messages && notification_type.value == 'email'",
|
||||||
},
|
},
|
||||||
success_message: {
|
success_message: {
|
||||||
label: i18n._('Success Message'),
|
label: i18n._('Success Message'),
|
||||||
class: 'Form-formGroup--fullWidth',
|
class: 'Form-formGroup--fullWidth',
|
||||||
type: 'text',
|
type: 'syntax_highlight',
|
||||||
default: '',
|
default: '',
|
||||||
ngShow: "customize_messages",
|
ngShow: "customize_messages",
|
||||||
|
rows: 1,
|
||||||
},
|
},
|
||||||
success_body: {
|
success_body: {
|
||||||
label: i18n._('Success Body'),
|
label: i18n._('Success Message Expanded'),
|
||||||
class: 'Form-formGroup--fullWidth',
|
class: 'Form-formGroup--fullWidth',
|
||||||
type: 'textarea',
|
type: ' syntax_highlight',
|
||||||
default: '',
|
default: '',
|
||||||
ngShow: "customize_messages && notification_type.value == 'email'",
|
ngShow: "customize_messages && notification_type.value == 'email'",
|
||||||
},
|
},
|
||||||
error_message: {
|
error_message: {
|
||||||
label: i18n._('Error Message'),
|
label: i18n._('Error Message'),
|
||||||
class: 'Form-formGroup--fullWidth',
|
class: 'Form-formGroup--fullWidth',
|
||||||
type: 'text',
|
type: 'syntax_highlight',
|
||||||
default: '',
|
default: '',
|
||||||
ngShow: "customize_messages",
|
ngShow: "customize_messages",
|
||||||
|
rows: 1,
|
||||||
},
|
},
|
||||||
error_body: {
|
error_body: {
|
||||||
label: i18n._('Error Body'),
|
label: i18n._('Error Message Expanded'),
|
||||||
class: 'Form-formGroup--fullWidth',
|
class: 'Form-formGroup--fullWidth',
|
||||||
type: 'textarea',
|
type: ' syntax_highlight',
|
||||||
default: '',
|
default: '',
|
||||||
ngShow: "customize_messages && notification_type.value == 'email'",
|
ngShow: "customize_messages && notification_type.value == 'email'",
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1366,7 +1366,9 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat
|
|||||||
html += `label="${field.label}" `;
|
html += `label="${field.label}" `;
|
||||||
html += `tooltip="${field.awPopOver}" `;
|
html += `tooltip="${field.awPopOver}" `;
|
||||||
html += `name="${fld}" `;
|
html += `name="${fld}" `;
|
||||||
html += `variables="${field.variables}" `;
|
html += `value="${fld}" `;
|
||||||
|
html += `default="${field.default || ''}" `;
|
||||||
|
html += `rows="${field.rows || 6}" `;
|
||||||
html += `ng-disabled="${field.ngDisabled}" `;
|
html += `ng-disabled="${field.ngDisabled}" `;
|
||||||
html += '></at-syntax-highlight>';
|
html += '></at-syntax-highlight>';
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user