Skip to content

Commit

Permalink
feat(login): display currently logged in user and municipality
Browse files Browse the repository at this point in the history
  • Loading branch information
velrest committed Jul 11, 2022
1 parent bb90ccc commit 4e24d1e
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 4 deletions.
21 changes: 17 additions & 4 deletions addon/components/login-modal.hbs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{{#if this.authFetch.showAuthModal}}
<UkCard
@color="default"
class="ember-ebau-gwr-login uk-width-2xlarge uk-margin-auto" as |card|
class="ember-ebau-gwr-login uk-width-2xlarge uk-margin-auto"
as |card|
>
<card.header>
<h2 class="uk-modal-title">
Expand Down Expand Up @@ -46,7 +47,8 @@
@noMatchesMessage={{t
"ember-gwr.components.loginModal.municipalityNoneFound"
}}
@onChange={{this.updateMunicipality}} as |municipality|
@onChange={{this.updateMunicipality}}
as |municipality|
>
{{municipality.name}}
</PowerSelect>
Expand All @@ -65,6 +67,17 @@
</card.footer>
</UkCard>
{{else}}
<Logout />
<div class="uk-flex uk-flex-middle uk-flex-right">
<span class="uk-margin-right">
{{t
"ember-gwr.components.loginModal.loginInfo"
user=this.authFetch.username
municipality=(get
(find-by "id" this.authFetch.municipality this.municipalities) "name"
)
}}
</span>
<Logout />
</div>
{{yield}}
{{/if}}
{{/if}}
2 changes: 2 additions & 0 deletions addon/services/auth-fetch.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export default class AuthFetchService extends Service {
@tracked showAuthModal = false;
@tracked token;
@tracked municipality;
@tracked username;

constructor(...args) {
super(...args);
Expand Down Expand Up @@ -69,6 +70,7 @@ export default class AuthFetchService extends Service {

this.token = json.token;
this.municipality = json.municipality;
this.username = json.username;
return json;
}

Expand Down
1 change: 1 addition & 0 deletions translations/de.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ ember-gwr:
municipality: Wählen Sie Ihre Gemeinde aus...
municipalitySearch: Gemeinde suchen...
municipalityNoneFound: Es wurde keine Gemeinde gefunden
loginInfo: "{user} angemeldet in {municipality}"

logout: Abmelden

Expand Down
1 change: 1 addition & 0 deletions translations/fr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ ember-gwr:
municipality: Sélectionnez votre commune...
municipalitySearch: Chercher une commune...
municipalityNoneFound: Aucune commune n'a été trouvée
loginInfo:

logout: Se déconnecter

Expand Down

0 comments on commit 4e24d1e

Please sign in to comment.