diff --git a/src/widjets-display-user-tzcld.js b/src/widjets-display-user-tzcld.js index 43f1651269d13432b0060d053ed30b762d44023d..29b47868b06998467c8261f1b24143a7a3cbc345 100644 --- a/src/widjets-display-user-tzcld.js +++ b/src/widjets-display-user-tzcld.js @@ -215,6 +215,51 @@ import("./utils.js").then((utils) => { render += `</div>`; + this.element.innerHTML = render; + }, + }); + core.Sib.register({ + name: "customtzcld-display-user-profile-first-job-short", + use: [core.StoreMixin], + + empty() { + console.debug(); + this.element.innerHTML = ""; + }, + + async populate() { + this.element.innerHTML = ` + <div class="loader"> + <div></div> + <div></div> + <div></div> + <div></div> + </div>`; + let tzcldprofile = { + jobs: await this.resource["ldp:contains"] + }; + if("label" in this.element.attributes) { + for(let ignore of this.element.attributes['label'].value.split(',')) { + tzcldprofile[ignore.trim()] = null; + } + } + let render = `<div class="segment full margin-top-xxsmall margin-bottom-xxsmall user-first-job whitespace-normal">`; + for(let job of tzcldprofile.jobs) { + if(await job.organisation !="") { + if(await job.link !="") { + render += `<h4 class="position text-medium padding-bottom-large">${await job.position} - <a class="link text-top" target="_blank" href="${await job.link}">${await job.organisation}</a></h4>`; + } else { + render += `<h4 class="position text-medium padding-bottom-large">${await job.position} - ${await job.organisation}</h4>`; + } + } else { + render += `<h4 class="position text-medium padding-bottom-large">${await job.position}</h4>`; + } + + break ; + } + + render += `</div>`; + this.element.innerHTML = render; }, });