From bc4f27ef8f6be09920a760aae985a6640edcbf85 Mon Sep 17 00:00:00 2001 From: chouseknecht Date: Wed, 18 Sep 2013 16:28:12 +0000 Subject: [PATCH] Latest changes to add ID element to form elements. --- awx/ui/static/js/helpers/Lookup.js | 1 + awx/ui/static/lib/ansible/form-generator.js | 31 +++++++++++---------- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/awx/ui/static/js/helpers/Lookup.js b/awx/ui/static/js/helpers/Lookup.js index cfd76b319d..2e8019bce3 100644 --- a/awx/ui/static/js/helpers/Lookup.js +++ b/awx/ui/static/js/helpers/Lookup.js @@ -38,6 +38,7 @@ angular.module('LookUpHelper', [ 'RestServices', 'Utilities', 'SearchHelper', 'P scope['lookUp' + name] = function() { var listGenerator = GenerateList; var listScope = listGenerator.inject(list, { mode: 'lookup', hdr: hdr }); + listScope = scope; listScope.selectAction = function() { var found = false; var name; diff --git a/awx/ui/static/lib/ansible/form-generator.js b/awx/ui/static/lib/ansible/form-generator.js index 17f0e610ea..f06b020f50 100644 --- a/awx/ui/static/lib/ansible/form-generator.js +++ b/awx/ui/static/lib/ansible/form-generator.js @@ -183,9 +183,9 @@ angular.module('FormGenerator', ['GeneratorHelpers', 'ngCookies']) if (this.scope[this.form.name + '_form'][fld]) { this.scope[this.form.name + '_form'][fld].$setPristine(); } - if (this.form.fields[fld].awPassMatch) { - this.scope[this.form.name + '_form'][fld].$setValidity('awpassmatch', true); - } + //if (this.scope.fields[fld].awPassMatch) { + // this.scope[this.form.name + '_form'][fld].$setValidity('awpassmatch', true); + //} if (this.form.fields[fld].ask) { this.scope[fld + '_ask'] = false; } @@ -363,13 +363,13 @@ angular.module('FormGenerator', ['GeneratorHelpers', 'ngCookies']) return x; } - function buildId(field, fld) { + function buildId(field, fld, form) { var html = ''; if (field.id) { - html += Attr(field,'id') : ""; + html += Attr(field,'id'); } else { - html += "id=\"" + this.form.name + "_" + fld + "\" "; + html += "id=\"" + form.name + "_" + fld + "\" "; } return html; } @@ -448,7 +448,7 @@ angular.module('FormGenerator', ['GeneratorHelpers', 'ngCookies']) html += 'name="' + fld + '" '; html += (field.ngChange) ? this.attr(field,'ngChange') : ""; html += (field.chkPass) ? "chk-pass " : ""; - html += buildId(field, fld); + html += buildId(field, fld, this.form); html += "class=\"form-control"; html += (field['class']) ? " " + this.attr(field, 'class') : ""; html += "\" "; @@ -587,7 +587,7 @@ angular.module('FormGenerator', ['GeneratorHelpers', 'ngCookies']) html += (field['class']) ? " " + field['class'] : ""; html += "\" "; html += (field.ngChange) ? this.attr(field,'ngChange') : ""; - html += buildId(field, fld); + html += buildId(field, fld, this.form); html += (field.placeholder) ? this.attr(field,'placeholder') : ""; html += (options.mode == 'edit' && field.editRequired) ? "required " : ""; html += (options.mode == 'add' && field.addRequired) ? "required " : ""; @@ -626,7 +626,7 @@ angular.module('FormGenerator', ['GeneratorHelpers', 'ngCookies']) html += "\" "; html += this.attr(field, 'ngOptions'); html += (field.ngChange) ? this.attr(field,'ngChange') : ""; - html += buildId(field, fld); + html += buildId(field, fld, this.form); html += (options.mode == 'edit' && field.editRequired) ? "required " : ""; html += (options.mode == 'add' && field.addRequired) ? "required " : ""; html += (field.readonly) ? "readonly " : ""; @@ -671,7 +671,7 @@ angular.module('FormGenerator', ['GeneratorHelpers', 'ngCookies']) html += (field.spinner) ? "ng-spinner=\"" + fld + "\" " : ""; html += "ng-model=\"" + fld + '" '; html += 'name="' + fld + '" '; - html += buildId(field, fld); + html += buildId(field, fld, this.form); html += (field.min || field.min == 0) ? this.attr(field, 'min') : ""; html += (field.max) ? this.attr(field, 'max') : ""; html += (field.ngChange) ? this.attr(field,'ngChange') : ""; @@ -776,7 +776,7 @@ angular.module('FormGenerator', ['GeneratorHelpers', 'ngCookies']) html += (field.labelClass) ? " " + field.labelClass : ""; html += "\" "; html += (field.labelNGClass) ? "ng-class=\"" + field.labelNGClass + "\" " : ""; - html += "id=\"" + this.field.name + "_" + fld + "_lookup\" "; + html += "id=\"" + this.form.name + "_" + fld + "_lookup\" "; html += ">\n"; html += (field.awPopOver) ? this.attr(field, 'awPopOver', fld) : ""; html += "