Fixed toggle controls on added content permission role rows
This commit is contained in:
parent
905d339572
commit
3f61bfc43c
|
@ -1,6 +1,8 @@
|
||||||
/**
|
/**
|
||||||
* @extends {Component}
|
* @extends {Component}
|
||||||
*/
|
*/
|
||||||
|
import {htmlToDom} from "../services/dom";
|
||||||
|
|
||||||
class EntityPermissions {
|
class EntityPermissions {
|
||||||
|
|
||||||
setup() {
|
setup() {
|
||||||
|
@ -53,11 +55,8 @@ class EntityPermissions {
|
||||||
|
|
||||||
// Get and insert new row
|
// Get and insert new row
|
||||||
const resp = await window.$http.get(`/permissions/form-row/${this.entityType}/${roleId}`);
|
const resp = await window.$http.get(`/permissions/form-row/${this.entityType}/${roleId}`);
|
||||||
const wrap = document.createElement('div');
|
const row = htmlToDom(resp.data);
|
||||||
wrap.innerHTML = resp.data;
|
|
||||||
const row = wrap.children[0];
|
|
||||||
this.roleContainer.append(row);
|
this.roleContainer.append(row);
|
||||||
window.components.init(row);
|
|
||||||
|
|
||||||
this.roleSelect.disabled = false;
|
this.roleSelect.disabled = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -117,4 +117,17 @@ export function removeLoading(element) {
|
||||||
for (const el of loadingEls) {
|
for (const el of loadingEls) {
|
||||||
el.remove();
|
el.remove();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert the given html data into a live DOM element.
|
||||||
|
* Initiates any components defined in the data.
|
||||||
|
* @param {String} html
|
||||||
|
* @returns {Element}
|
||||||
|
*/
|
||||||
|
export function htmlToDom(html) {
|
||||||
|
const wrap = document.createElement('div');
|
||||||
|
wrap.innerHTML = html;
|
||||||
|
window.components.init(wrap);
|
||||||
|
return wrap.children[0];
|
||||||
}
|
}
|
Loading…
Reference in New Issue