ui: fix production build only empty role modal (#5806)

Adds the ability for multiple components to use the same dom buffer
This commit is contained in:
John Cowen 2019-05-08 10:01:26 +01:00 committed by GitHub
parent 211545f94e
commit c50ca4f02c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 4 deletions

View File

@ -11,12 +11,17 @@ export default Service.extend(Evented, {
},
add: function(name, dom) {
this.trigger('add', dom);
buffer[name] = dom;
if (typeof buffer[name] === 'undefined') {
buffer[name] = [];
}
buffer[name].push(dom);
return dom;
},
remove: function(name) {
if (typeof buffer[name] !== 'undefined') {
buffer[name].remove();
buffer[name].forEach(function(item) {
item.remove();
});
delete buffer[name];
}
},

View File

@ -8,7 +8,7 @@
{{/block-slot}}
{{#block-slot 'body'}}
<input id="{{name}}_state_role" type="radio" name="{{name}}[state]" value="role" checked={{eq state 'role'}} onchange={{action 'change'}} />
<input id="{{name}}_state_role" type="radio" name="{{name}}[state]" value="role" checked={{if (eq state 'role') 'checked'}} onchange={{action 'change'}} />
{{#role-form form=form dc=dc}}
{{#block-slot 'policy'}}
@ -23,7 +23,7 @@
{{/block-slot}}
{{/role-form}}
<input id="{{name}}_state_policy" type="radio" name="{{name}}[state]" value="policy" checked={{eq state 'policy'}} onchange={{action 'change'}} />
<input id="{{name}}_state_policy" type="radio" name="{{name}}[state]" value="policy" checked={{if (eq state 'policy') 'checked'}} onchange={{action 'change'}} />
{{policy-form data-test-policy-form name="role[policy]" form=policyForm dc=dc}}
{{/block-slot}}