2018-09-29 00:22:00 +00:00
|
|
|
script.
|
2018-10-12 17:11:13 +00:00
|
|
|
document.addEventListener("WebComponentsReady", function(event) {
|
2018-09-29 00:22:00 +00:00
|
|
|
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 '';
|
|
|
|
}
|
2018-10-12 17:11:13 +00:00
|
|
|
return `<div>${firstname} ${lastname}</div>`;
|
2018-09-29 00:22:00 +00:00
|
|
|
// + `<div id="${email}">${email}</div>`;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
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 '';
|
|
|
|
}
|
2018-10-17 21:04:03 +00:00
|
|
|
return `<span>${city} - ${country}</span>`;
|
2018-09-29 00:22:00 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
customElements.define("hdapp-usercell", HDAppCell);
|
|
|
|
});
|
|
|
|
|
|
|
|
div
|
|
|
|
h1 Members
|
|
|
|
sib-display#profiles-list(
|
|
|
|
data-src=`${sdn}/members/`,
|
2018-10-17 21:04:03 +00:00
|
|
|
data-fields='header, footer'
|
2018-10-12 17:11:13 +00:00
|
|
|
set-header='avatar, user, pseudonym, bio',
|
2018-10-17 21:04:03 +00:00
|
|
|
set-footer='cell, roles, skills',
|
2018-10-12 17:11:13 +00:00
|
|
|
set-pseudonym='before-pseudo, pseudo',
|
2018-09-29 00:22:00 +00:00
|
|
|
value-before-pseudo='@',
|
|
|
|
widget-avatar='sib-display-img',
|
|
|
|
widget-user='hdapp-userinfo',
|
|
|
|
widget-cell='hdapp-usercell',
|
2018-10-17 21:04:03 +00:00
|
|
|
widget-roles='sib-display-lookuplist',
|
2018-09-29 00:22:00 +00:00
|
|
|
widget-skills='sib-display-lookuplist',
|
|
|
|
set-searchset='user.first_name, user.last_name',
|
|
|
|
search-fields='searchset',
|
|
|
|
next='member'
|
|
|
|
)
|