Skip to content

Commit

Permalink
refactor(ui5-shellbar): extract profile btn as HBS partial (#4342)
Browse files Browse the repository at this point in the history
The stakeholders can't provide own 'title' for the ShellBar's profile button. We show "profile", which is not what the stakeholders need. As currently, it's not possible to replace a specific text in the i18n bundle, we would need to provide either a HBS template hook, or an API to allow developers set their own text. The template hook is the simplest solution without any change in the APIs.
Extract the profile button mark up as Handlebars partial to allow custom component developers to overwrite the Handlebars partial and change the profile button "title" to the desired one.

Fixes: #4009
  • Loading branch information
ilhan007 authored Nov 18, 2021
1 parent 2745bbc commit 4d2a764
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions packages/fiori/src/ShellBar.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -155,20 +155,7 @@
></ui5-button>

{{#if hasProfile}}
<ui5-button
profile-btn
id="{{this._id}}-item-3"
@click={{_handleProfilePress}}
style="{{styles.items.profile}}"
title="{{_profileText}}"
._buttonAccInfo="{{accInfo.profile}}"
class="ui5-shellbar-button ui5-shellbar-image-button"
data-ui5-stable="profile"
>
<slot
name="profile"
></slot>
</ui5-button>
{{> profileButton}}
{{/if}}

{{#if showProductSwitch}}
Expand All @@ -188,6 +175,21 @@
</div>
</div>

{{#*inline "profileButton"}}
<ui5-button
profile-btn
id="{{this._id}}-item-3"
@click={{_handleProfilePress}}
style="{{styles.items.profile}}"
title="{{_profileText}}"
._buttonAccInfo="{{accInfo.profile}}"
class="ui5-shellbar-button ui5-shellbar-image-button"
data-ui5-stable="profile"
>
<slot name="profile"></slot>
</ui5-button>
{{/inline}}

{{#*inline "coPilot"}}
<svg @click="{{_coPilotClick}}" focusable="false" width="44" role="presentation" aria-hidden="true" height="44" viewBox="-150 -150 300 300" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" class="ui5-shellbar-coPilot">
<defs>
Expand Down

0 comments on commit 4d2a764

Please sign in to comment.