Skip to content

Commit

Permalink
-
Browse files Browse the repository at this point in the history
  • Loading branch information
javiereguiluz committed Dec 15, 2024
1 parent 1c9d979 commit 5857825
Show file tree
Hide file tree
Showing 9 changed files with 53 additions and 79 deletions.
3 changes: 3 additions & 0 deletions assets/css/easyadmin-theme/base.css
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,9 @@ a.user-menu-wrapper .user-details:hover {
inline-size: 2em;
text-align: center;
}
.user-menu-wrapper .user-avatar .icon {
display: block;
}

.user-menu-wrapper .dropdown-menu {
min-inline-size: 200px;
Expand Down
22 changes: 0 additions & 22 deletions public/app.055a0b6d.css

This file was deleted.

2 changes: 1 addition & 1 deletion public/entrypoints.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"entrypoints": {
"app": {
"css": [
"/app.055a0b6d.css"
"/app.4db32b24.css"
],
"js": [
"/app.1ecd6d7a.js"
Expand Down
2 changes: 1 addition & 1 deletion public/manifest.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"app.css": "app.055a0b6d.css",
"app.css": "app.4db32b24.css",
"app.js": "app.1ecd6d7a.js",
"form.js": "form.bcec6c2a.js",
"page-layout.js": "page-layout.3347892e.js",
Expand Down
4 changes: 3 additions & 1 deletion templates/components/ActionMenu/ActionList.html.twig
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
<twig:block name="content"></twig:block>
<ul {{ attributes.defaults({class: 'dropdown-menu dropdown-menu-end'}) }}>
<twig:block name="content"></twig:block>
</ul>
3 changes: 3 additions & 0 deletions templates/components/ActionMenu/ActionList/Content.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<li {{ attributes }}>
<twig:block name="content"></twig:block>
</li>
2 changes: 1 addition & 1 deletion templates/components/ActionMenu/Overlay.html.twig
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<div class="dropdown-menu dropdown-menu-end">
<div {{ attributes.defaults({class: 'dropdown-overlay'}) }}>
<twig:block name="content"></twig:block>
</div>
6 changes: 3 additions & 3 deletions templates/crud/index.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,9 @@
<twig:ea:ActionMenu:ActionList>
{% for action in entity.actions %}
<twig:ea:ActionMenu:ActionList:Item
:class="action.cssClass" :url="action.linkUrl"
:icon="action.icon" icon:class="action-icon"
:label="action.label|trans" label:class="action-label" renderLabelRaw />
class="{{ action.cssClass }}" url="{{ action.linkUrl }}"
icon="{{ action.icon }}" icon:class="action-icon"
label="{{ action.label|trans }}" label:class="action-label" renderLabelRaw />
{% endfor %}
</twig:ea:ActionMenu:ActionList>
</twig:ea:ActionMenu:Overlay>
Expand Down
88 changes: 38 additions & 50 deletions templates/layout.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -81,38 +81,37 @@
{% endif %}
{% endset %}



{% set impersonator_permission = constant('Symfony\\Component\\Security\\Core\\Authorization\\Voter\\AuthenticatedVoter::IS_IMPERSONATOR') is defined ? 'IS_IMPERSONATOR' : 'ROLE_PREVIOUS_ADMIN' %}

{% set user_menu_dropdown %}
<ul class="dropdown-menu dropdown-menu-end">
<li class="dropdown-user-details">
<twig:ea:ActionMenu:ActionList>
<twig:ea:ActionMenu:ActionList:Content class="dropdown-user-details">
<div>{{ user_menu_avatar }}</div>
<div>
<span class="user-label">{{ 'user.logged_in_as'|trans(domain = 'EasyAdminBundle') }}</span>
<span class="user-name">{{ ea.user is null ? 'user.anonymous'|trans(domain = 'EasyAdminBundle') : ea.userMenu.name }}</span>
</div>
</li>

{% block user_menu %}
{% if ea.userMenu.items|length > 0 %}
<li><hr class="dropdown-divider"></li>
{% for item in ea.userMenu.items %}
<li>
{% if item.isMenuSection and not loop.first %}
<hr class="dropdown-divider">
{% elseif not item.isMenuSection %}
<a href="{{ item.linkUrl }}" class="dropdown-item user-action {{ item.cssClass }}"
target="{{ item.linkTarget }}" rel="{{ item.linkRel }}"
referrerpolicy="origin-when-cross-origin">
{% if item.icon is not empty %}<twig:ea:Icon name="{{ item.icon }}" />{% endif %}
{{ item.label|trans }}
</a>
{% endif %}
</li>
{% endfor %}
{% endif %}
{% endblock user_menu %}
</ul>
</twig:ea:ActionMenu:ActionList:Content>

{% if ea.userMenu.items|length > 0 %}
<twig:ea:ActionMenu:ActionList:Divider/>

{% for item in ea.userMenu.items %}
{% if item.isMenuSection and not loop.first %}
<twig:ea:ActionMenu:ActionList:Divider/>
{% else %}
<twig:ea:ActionMenu:ActionList:Item
label="{{ item.label|trans }}"
class="user-action {{ item.cssClass }}" icon="{{ item.icon }}"
url="{{ item.linkUrl }}" target="{{ item.linkTarget }}" rel="{{ item.linkRel }}"
referrerpolicy="origin-when-cross-origin"
/>
{% endif %}
{% endfor %}
{% endif %}
</twig:ea:ActionMenu:ActionList>
{% endset %}

{% set settings_dropdown %}
Expand All @@ -130,9 +129,9 @@

{% for localeDto in ea.dashboardLocales %}
<twig:ea:ActionMenu:ActionList:Item
:class="app.request.locale == localeDto.locale ? 'active'"
:url="ea_url().set('_locale', localeDto.locale)"
:icon="localeDto.icon" :label="localeDto.name" />
class="{{ app.request.locale == localeDto.locale ? 'active' }}"
url="{{ ea_url().set('_locale', localeDto.locale) }}"
icon="{{ localeDto.icon }}" label="{{ localeDto.name }}" />
{% endfor %}

{% if ea.dashboardHasDarkModeEnabled %}
Expand All @@ -147,15 +146,15 @@
<twig:ea:ActionMenu:ActionList:Item
class="dropdown-appearance-item"
url="#" icon="internal:sun" data-ea-color-scheme="light"
:label="'settings.appearance.light'|trans(domain = 'EasyAdminBundle')" />
label="{{ 'settings.appearance.light'|trans(domain = 'EasyAdminBundle') }}" />
<twig:ea:ActionMenu:ActionList:Item
class="dropdown-appearance-item"
url="#" icon="internal:moon" data-ea-color-scheme="dark"
:label="'settings.appearance.dark'|trans(domain = 'EasyAdminBundle')" />
label="{{ 'settings.appearance.dark'|trans(domain = 'EasyAdminBundle') }}" />
<twig:ea:ActionMenu:ActionList:Item
class="dropdown-appearance-item active"
url="#" icon="internal:desktop" data-ea-color-scheme="auto"
:label="'settings.appearance.auto'|trans(domain = 'EasyAdminBundle')" />
label="{{ 'settings.appearance.auto'|trans(domain = 'EasyAdminBundle') }}" />
{% endif %}
</twig:ea:ActionMenu:ActionList>
</twig:ea:ActionMenu:Overlay>
Expand All @@ -179,20 +178,7 @@
{% endblock responsive_header_logo %}
</div>

<div class="dropdown user-menu-wrapper {{ is_granted(impersonator_permission) ? 'user-is-impersonated' }} ms-auto">
<a class="user-details" type="button" data-bs-toggle="dropdown" data-bs-offset="0,5" aria-expanded="false">
{# to make the site design consistent, always display the user avatar in responsive header
and hide the user name (because there's no space left) regardless of the user config #}
{% if ea.userMenu.avatarDisplayed %}
{{ user_menu_avatar }}
{% else %}
<twig:ea:Icon class="user-avatar" name="{{ ea.user is not null ? 'internal:user' : 'internal:user-xmark' }}" />
{% endif %}
</a>

{{ user_menu_dropdown }}
</div>

{{ user_menu_dropdown }}
{{ settings_dropdown }}
{% endblock responsive_header %}
</div>
Expand Down Expand Up @@ -301,16 +287,17 @@
{% block header_custom_menu_wrapper %}
<div class="navbar-custom-menu">
{% block header_custom_menu %}
<div class="dropdown user-menu-wrapper {{ is_granted(impersonator_permission) ? 'user-is-impersonated' }}">
<a class="user-details" type="button" data-bs-toggle="dropdown" data-bs-offset="0,5" aria-expanded="false">
<twig:ea:ActionMenu class="user-menu-wrapper {{ is_granted(impersonator_permission) ? 'user-is-impersonated' }}">
<twig:ea:ActionMenu:Button class="user-details" withoutDropdownToggleMarker>
{{ user_menu_avatar }}
{% if ea.userMenu.isNameDisplayed %}
<span class="user-name">{{ ea.userMenu.name }}</span>
{% endif %}
</a>

{{ user_menu_dropdown }}
</div>
</twig:ea:ActionMenu:Button>
<twig:ea:ActionMenu:Overlay>
{{ user_menu_dropdown }}
</twig:ea:ActionMenu:Overlay>
</twig:ea:ActionMenu>
{% endblock header_custom_menu %}
</div>
{% endblock header_custom_menu_wrapper %}
Expand Down Expand Up @@ -369,6 +356,7 @@
</section>
{% endblock wrapper %}
</div>
</div>
{% endblock wrapper_wrapper %}

{% block body_javascript %}{% endblock body_javascript %}
Expand Down

0 comments on commit 5857825

Please sign in to comment.