mirror of
https://github.com/ansible/awx.git
synced 2024-11-04 12:51:18 +03:00
AC-447 Fixed bug in /lib/directive.js-> awRequiredWhen.
This commit is contained in:
parent
fd16c0827a
commit
c4f8872ae4
@ -83,8 +83,6 @@ angular.module('ProjectFormDefinition', [])
|
||||
type: 'select',
|
||||
id: 'local-path-select',
|
||||
ngOptions: 'path for path in project_local_paths',
|
||||
addRequired: false,
|
||||
editRequired: false,
|
||||
awRequiredWhen: { variable: "pathRequired", init: "true" },
|
||||
ngShow: "scm_type == '' || scm_type == null",
|
||||
awPopOver: '<p>Select from the list of directories found in the base path.' +
|
||||
|
@ -107,22 +107,30 @@ angular.module('AWDirectives', ['RestServices', 'Utilities', 'AuthService', 'Hos
|
||||
|
||||
function checkIt () {
|
||||
var viewValue = elm.val();
|
||||
var txt, label;
|
||||
validity = true;
|
||||
if ( scope[attrs.awRequiredWhen] && (elm.attr('required') == null || elm.attr('required') == undefined) ) {
|
||||
$(elm).attr('required','required');
|
||||
if ($(elm).hasClass('lookup')) {
|
||||
$(elm).parent().parent().parent().find('label').prepend('* ');
|
||||
}
|
||||
else {
|
||||
$(elm).parent().parent().find('label').prepend('* ');
|
||||
}
|
||||
}
|
||||
else if (!scope[attrs.awRequiredWhen]) {
|
||||
elm.removeAttr('required');
|
||||
if ($(elm).hasClass('lookup')) {
|
||||
var txt = $(elm).parent().parent().parent().find('label').text();
|
||||
var txt = txt.replace(/^\*/,'');
|
||||
var label = $(elm).parent().parent().parent().find('label');
|
||||
if (label) {
|
||||
label.text(txt);
|
||||
}
|
||||
txt = $(elm).parent().parent().parent().find('label').text();
|
||||
label = $(elm).parent().parent().parent().find('label');
|
||||
}
|
||||
else {
|
||||
txt = $(elm).parent().parent().find('label').text();
|
||||
label = $(elm).parent().parent().find('label');
|
||||
}
|
||||
txt = txt.replace(/^\* /,'');
|
||||
if (label) {
|
||||
label.text(txt);
|
||||
}
|
||||
}
|
||||
if (scope[attrs.awRequiredWhen] && (viewValue == undefined || viewValue == null || viewValue == '')) {
|
||||
|
Loading…
Reference in New Issue
Block a user