From 0af2980d10408276837787f6424e7c8a8b2e6920 Mon Sep 17 00:00:00 2001 From: Chris Houseknecht Date: Thu, 21 Nov 2013 17:36:03 +0000 Subject: [PATCH] Fixed js error. For some reason form generator was unable to get the scope for js-tree after changes related to source_regions. Added a way to pass in scope. --- awx/ui/static/js/helpers/Groups.js | 3 ++- awx/ui/static/lib/ansible/form-generator.js | 9 +++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/awx/ui/static/js/helpers/Groups.js b/awx/ui/static/js/helpers/Groups.js index 377789cbdb..c56f3d8d1c 100644 --- a/awx/ui/static/js/helpers/Groups.js +++ b/awx/ui/static/js/helpers/Groups.js @@ -894,7 +894,8 @@ angular.module('GroupsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', ' } scope.removeChoicesComplete = scope.$on('choicesReady', function() { - generator.inject(form, { mode: 'edit', modal: false, related: false, id: 'tree-form', breadCrumbs: false }); + generator.inject(form, { mode: 'edit', modal: false, related: false, id: 'tree-form', + breadCrumbs: false, scope: scope }); generator.reset(); // Retrieve detail record and prepopulate the form diff --git a/awx/ui/static/lib/ansible/form-generator.js b/awx/ui/static/lib/ansible/form-generator.js index 3460ef76d9..e10d3a4ed7 100644 --- a/awx/ui/static/lib/ansible/form-generator.js +++ b/awx/ui/static/lib/ansible/form-generator.js @@ -68,9 +68,14 @@ angular.module('FormGenerator', ['GeneratorHelpers', 'ngCookies', 'Utilities']) else { element.html(this.build(options)); } + + if (options.scope) { + this.scope = options.scope; + } + else { + this.scope = element.scope(); + } - this.scope = element.scope(); // Set scope specific to the element we're compiling, avoids circular reference - // From here use 'scope' to manipulate the form, as the form is not in '$scope' $compile(element)(this.scope); if (!options.buildTree && !options.html) {