From c1d34613a3401a3b1aee2fe0c03105d046acb0ec Mon Sep 17 00:00:00 2001 From: Patrizio Bekerle <patrizio.bekerle@tugraz.at> Date: Thu, 19 Sep 2019 14:46:43 +0200 Subject: [PATCH] Add profile link --- packages/auth/src/i18n/de/translation.json | 3 ++- packages/auth/src/i18n/en/translation.json | 3 ++- packages/auth/src/vpu-auth.js | 13 ++++++++++--- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/packages/auth/src/i18n/de/translation.json b/packages/auth/src/i18n/de/translation.json index 48287f0d..761eaa9c 100644 --- a/packages/auth/src/i18n/de/translation.json +++ b/packages/auth/src/i18n/de/translation.json @@ -1,4 +1,5 @@ { "login": "Einloggen", - "logout": "Ausloggen" + "logout": "Ausloggen", + "profile": "Profil" } diff --git a/packages/auth/src/i18n/en/translation.json b/packages/auth/src/i18n/en/translation.json index 8c6f4faa..fc4a7710 100644 --- a/packages/auth/src/i18n/en/translation.json +++ b/packages/auth/src/i18n/en/translation.json @@ -1,4 +1,5 @@ { "login": "Login", - "logout": "Logout" + "logout": "Logout", + "profile": "Profile" } diff --git a/packages/auth/src/vpu-auth.js b/packages/auth/src/vpu-auth.js index 944ff37d..632e60e2 100644 --- a/packages/auth/src/vpu-auth.js +++ b/packages/auth/src/vpu-auth.js @@ -38,6 +38,7 @@ class VPUAuth extends LitElement { // Create the events this.initEvent = new CustomEvent("vpu-auth-init", { "detail": "KeyCloak init event", bubbles: true, composed: true }); this.personInitEvent = new CustomEvent("vpu-auth-person-init", { "detail": "KeyCloak person init event", bubbles: true, composed: true }); + this.profileEvent = new CustomEvent("vpu-auth-profile", { "detail": "Profile event", bubbles: true, composed: true }); this.keycloakDataUpdateEvent = new CustomEvent("vpu-auth-keycloak-data-update", { "detail": "KeyCloak data was updated", bubbles: true, composed: true }); this.closeDropdown = this.closeDropdown.bind(this); @@ -194,6 +195,13 @@ class VPUAuth extends LitElement { this.dispatchEvent(this.personInitEvent); } + /** + * Dispatches the profile event + */ + dispatchProfileEvent() { + this.dispatchEvent(this.profileEvent); + } + /** * Dispatches the keycloak data update event */ @@ -275,9 +283,8 @@ class VPUAuth extends LitElement { <div class="dropdown-menu" id="dropdown-menu2" role="menu"> <div class="dropdown-content"> ${imageURL ? html`<img src="${imageURL}" width="40%" height="40%" class="dropdown-item">` : ''} - <a href="#" @click="${this.logout}" class="dropdown-item"> - ${i18n.t('logout')} - </a> + <a href="#" @click="${this.dispatchProfileEvent}" class="dropdown-item">${i18n.t('profile')}</a> + <a href="#" @click="${this.logout}" class="dropdown-item">${i18n.t('logout')}</a> </div> </div> </div> -- GitLab