40 lines
1.3 KiB
Plaintext
40 lines
1.3 KiB
Plaintext
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}`;
|
|
}
|
|
}
|
|
customElements.define('hdapp-author', HDAppAuthor);
|
|
});
|
|
});
|
|
|
|
div
|
|
h1 Job offers
|
|
sib-display#offers-list(
|
|
data-src=`${sdn}/job-offers/`,
|
|
data-fields='author, title, description, skills',
|
|
set-searchset='title, description',
|
|
widget-skills='sib-display-lookuplist',
|
|
widget-author='hdapp-author',
|
|
search-fields='searchset'
|
|
) |