script.
document.addEventListener("WebComponentsReady", function(event) {
class HDAppUserInfo extends SIBDisplayLookupList {
get parentElement() {return "div"}
getTemplate(value, index) {
var firstname, lastname, email;
if(typeof value == "object")
if(Object.keys(value).length > 1) {
firstname = value.first_name;
lastname = value.last_name;
email = value.email;
}
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}
`;
// + `${email}
`;
}
}
customElements.define('hdapp-userinfo', HDAppUserInfo);
class HDAppCell extends SIBDisplayLookupList {
get parentElement() {return "div"}
getTemplate(value, index) {
var city, country;
if(typeof value == "object")
if(Object.keys(value).length > 1) {
city = value.city;
country = value.country;
}
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 `${city} ${country}`;
}
}
customElements.define("hdapp-usercell", HDAppCell);
});
div
h1 Members
sib-display#profiles-list(
data-src=`${sdn}/members/`,
data-fields='header, cell, skills',
set-header='avatar, user, pseudonym, bio'
set-pseudonym='before-pseudo, pseudo'
value-before-pseudo='@',
widget-avatar='sib-display-img',
widget-user='hdapp-userinfo',
widget-cell='hdapp-usercell',
widget-skills='sib-display-lookuplist',
set-searchset='user.first_name, user.last_name',
search-fields='searchset',
next='member'
)