mirror of
https://github.com/ansible/awx.git
synced 2026-03-21 02:47:35 -02:30
Improves UX for readonly codemirrors so that users can copy/paste
This commit is contained in:
@@ -37,15 +37,6 @@
|
|||||||
|
|
||||||
// Disabled
|
// Disabled
|
||||||
textarea[disabled="disabled"] + div[id*="-container"]{
|
textarea[disabled="disabled"] + div[id*="-container"]{
|
||||||
.CodeMirror {
|
|
||||||
cursor: not-allowed;
|
|
||||||
}
|
|
||||||
|
|
||||||
.CodeMirror.cm-s-default,
|
|
||||||
.CodeMirror-line {
|
|
||||||
background-color: @ebgrey;
|
|
||||||
}
|
|
||||||
|
|
||||||
.CodeMirror-gutters {
|
.CodeMirror-gutters {
|
||||||
border-color: @b7grey;
|
border-color: @b7grey;
|
||||||
}
|
}
|
||||||
@@ -55,12 +46,4 @@ textarea[disabled="disabled"] + div[id*="-container"]{
|
|||||||
background-color: @default-bg;
|
background-color: @default-bg;
|
||||||
color: @default-interface-txt;
|
color: @default-interface-txt;
|
||||||
}
|
}
|
||||||
|
|
||||||
.CodeMirror-lines {
|
|
||||||
cursor: default;
|
|
||||||
}
|
|
||||||
|
|
||||||
.CodeMirror-cursors {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,6 +18,11 @@
|
|||||||
flex: 1 0 auto;
|
flex: 1 0 auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.atCodeMirror-labelRightSide{
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
.atCodeMirror-labelText{
|
.atCodeMirror-labelText{
|
||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
color: #707070;
|
color: #707070;
|
||||||
@@ -74,3 +79,8 @@
|
|||||||
margin-left: 10px;
|
margin-left: 10px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.atCodeMirror-badge{
|
||||||
|
display: initial;
|
||||||
|
margin-right: 20px;
|
||||||
|
}
|
||||||
@@ -13,8 +13,12 @@ function atCodeMirrorController (
|
|||||||
ParseVariableString
|
ParseVariableString
|
||||||
) {
|
) {
|
||||||
const vm = this;
|
const vm = this;
|
||||||
|
|
||||||
function init (vars) {
|
function init (vars) {
|
||||||
|
if ($scope.disabled === 'true') {
|
||||||
|
$scope.disabled = true;
|
||||||
|
} else if ($scope.disabled === 'false') {
|
||||||
|
$scope.disabled = false;
|
||||||
|
}
|
||||||
$scope.variables = ParseVariableString(_.cloneDeep(vars));
|
$scope.variables = ParseVariableString(_.cloneDeep(vars));
|
||||||
$scope.parseType = ParseType;
|
$scope.parseType = ParseType;
|
||||||
const options = {
|
const options = {
|
||||||
|
|||||||
@@ -9,8 +9,8 @@ function CodeMirrorStrings (BaseString) {
|
|||||||
VARIABLES: t.s('VARIABLES'),
|
VARIABLES: t.s('VARIABLES'),
|
||||||
EXPAND: t.s('EXPAND'),
|
EXPAND: t.s('EXPAND'),
|
||||||
YAML: t.s('YAML'),
|
YAML: t.s('YAML'),
|
||||||
JSON: t.s('JSON')
|
JSON: t.s('JSON'),
|
||||||
|
READONLY: t.s('READ ONLY')
|
||||||
};
|
};
|
||||||
|
|
||||||
ns.tooltip = {
|
ns.tooltip = {
|
||||||
|
|||||||
@@ -16,8 +16,12 @@ function atCodeMirrorModalController (
|
|||||||
ParseVariableString
|
ParseVariableString
|
||||||
) {
|
) {
|
||||||
const vm = this;
|
const vm = this;
|
||||||
|
|
||||||
function resize () {
|
function resize () {
|
||||||
|
if ($scope.disabled === 'true') {
|
||||||
|
$scope.disabled = true;
|
||||||
|
} else if ($scope.disabled === 'false') {
|
||||||
|
$scope.disabled = false;
|
||||||
|
}
|
||||||
const editor = $(`${CodeMirrorModalID} .CodeMirror`)[0].CodeMirror;
|
const editor = $(`${CodeMirrorModalID} .CodeMirror`)[0].CodeMirror;
|
||||||
const height = $(ModalHeight).height() - $(ModalHeader).height() -
|
const height = $(ModalHeight).height() - $(ModalHeader).height() -
|
||||||
$(ModalFooter).height() - 100;
|
$(ModalFooter).height() - 100;
|
||||||
@@ -30,6 +34,11 @@ function atCodeMirrorModalController (
|
|||||||
}
|
}
|
||||||
|
|
||||||
function init () {
|
function init () {
|
||||||
|
if ($scope.disabled === 'true') {
|
||||||
|
$scope.disabled = true;
|
||||||
|
} else if ($scope.disabled === 'false') {
|
||||||
|
$scope.disabled = false;
|
||||||
|
}
|
||||||
$(CodeMirrorModalID).modal('show');
|
$(CodeMirrorModalID).modal('show');
|
||||||
$scope.extra_variables = ParseVariableString(_.cloneDeep($scope.variables));
|
$scope.extra_variables = ParseVariableString(_.cloneDeep($scope.variables));
|
||||||
$scope.parseType = ParseType;
|
$scope.parseType = ParseType;
|
||||||
|
|||||||
@@ -42,7 +42,10 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div class="atCodeMirror-labelRightSide">
|
||||||
|
<div class="at-RowItem-tag at-RowItem-tag--header atCodeMirror-badge" ng-show="disabled === 'true' || disabled === true">
|
||||||
|
{{ vm.strings.get('label.READONLY')}}
|
||||||
|
</div>
|
||||||
<button type="button" class="close" ng-click="closeFn()">
|
<button type="button" class="close" ng-click="closeFn()">
|
||||||
<i class="fa fa-times-circle"></i>
|
<i class="fa fa-times-circle"></i>
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
Reference in New Issue
Block a user