fix WebComponentsReady

This commit is contained in:
Clément 2018-09-29 00:48:46 +02:00
parent 1c7e7f3e37
commit b74f4f9871
3 changed files with 51 additions and 57 deletions

View File

@ -1,24 +1,22 @@
script.
document.addEventListener('WebComponentsReady', function(event) {
document.addEventListener("HTMLImportsLoaded", function(event) {
class HDAppMember extends SIBWidget {
get template() {
return `
<div name="${this.name}">
<img src="${this.value.avatar}"/>
</div>
`;
}
render() {
store.get(this.value).then( (value) => {
this._value = value;
this.innerHTML = this.template;
});
}
class HDAppMember extends SIBWidget {
get template() {
return `
<div name="${this.name}">
<img src="${this.value.avatar}"/>
</div>
`;
}
customElements.define("hdapp-member", HDAppMember);
});
render() {
store.get(this.value).then( (value) => {
this._value = value;
this.innerHTML = this.template;
});
}
}
customElements.define("hdapp-member", HDAppMember);
});
#channel-profile(style='display: none')

View File

@ -1,31 +1,29 @@
script.
document.addEventListener('WebComponentsReady', function(event) {
document.addEventListener('HTMLImportsLoaded', function(event) {
class HDAppAuthor extends SIBDisplayLookupList {
get parentElement() {
return 'div';
}
getTemplate(value, index) {
var firstname, lastname;
if (typeof value == 'object')
if (Object.keys(value).length > 1) {
firstname = value.user.first_name;
lastname = value.user.last_name;
} else {
store.get(value).then(resource => {
this.value.push(resource);
this.render();
});
if (Array.isArray(this.value))
this.value.splice(this.value.indexOf(value), 1);
else this.value = [];
return '';
}
return `${firstname} ${lastname}`;
}
class HDAppAuthor extends SIBDisplayLookupList {
get parentElement() {
return 'div';
}
customElements.define('hdapp-author', HDAppAuthor);
});
getTemplate(value, index) {
var firstname, lastname;
if (typeof value == 'object')
if (Object.keys(value).length > 1) {
firstname = value.user.first_name;
lastname = value.user.last_name;
} else {
store.get(value).then(resource => {
this.value.push(resource);
this.render();
});
if (Array.isArray(this.value))
this.value.splice(this.value.indexOf(value), 1);
else this.value = [];
return '';
}
return `${firstname} ${lastname}`;
}
}
customElements.define('hdapp-author', HDAppAuthor);
});
div

View File

@ -1,21 +1,19 @@
script.
document.addEventListener('WebComponentsReady', function(event) {
document.addEventListener("HTMLImportsLoaded", function(event) {
class HDAppClient extends SIBWidget {
get template() {
class HDAppClient extends SIBWidget {
get template() {
return `<img name="${this.name}" src="${this.value.logo}"/>`;
}
render() {
store.get(this.value).then( (value) => {
this._value = value;
this.innerHTML = this.template;
});
}
return `<img name="${this.name}" src="${this.value.logo}"/>`;
}
customElements.define("hdapp-client", HDAppClient);
});
render() {
store.get(this.value).then( (value) => {
this._value = value;
this.innerHTML = this.template;
});
}
}
customElements.define("hdapp-client", HDAppClient);
});
#projects(style='display: none')