From 61caba0486c0e011b922b6e8d1da63d4ccb0c2b1 Mon Sep 17 00:00:00 2001 From: Vincent Langlet Date: Sun, 22 Nov 2020 20:26:16 +0100 Subject: [PATCH] Avoid to translate an empty admin label --- .../views/Block/block_admin_list.html.twig | 26 ++++++++++--------- .../views/Block/block_search_result.html.twig | 4 ++- .../Association/edit_many_script.html.twig | 13 +++++++--- src/Resources/views/Core/add_block.html.twig | 10 +++++-- 4 files changed, 34 insertions(+), 19 deletions(-) diff --git a/src/Resources/views/Block/block_admin_list.html.twig b/src/Resources/views/Block/block_admin_list.html.twig index f10ed521f1..2f32221724 100644 --- a/src/Resources/views/Block/block_admin_list.html.twig +++ b/src/Resources/views/Block/block_admin_list.html.twig @@ -25,18 +25,20 @@ file that was distributed with this source code. {% for admin in group.items %} {% if admin.dashboardActions|length > 0 %} - - - {{ admin.label|trans({}, admin.translationdomain) }} - - -
- {% for action in admin.dashboardActions %} - {% include action.template|default('@SonataAdmin/CRUD/dashboard__action.html.twig') with {'action': action} %} - {% endfor %} -
- - + + + {% if admin.label is not empty %} + {{ admin.label|trans({}, admin.translationdomain) }} + {% endif %} + + +
+ {% for action in admin.dashboardActions %} + {% include action.template|default('@SonataAdmin/CRUD/dashboard__action.html.twig') with {'action': action} %} + {% endfor %} +
+ + {% endif %} {% endfor %} diff --git a/src/Resources/views/Block/block_search_result.html.twig b/src/Resources/views/Block/block_search_result.html.twig index a80b3f9899..ce82728b36 100644 --- a/src/Resources/views/Block/block_search_result.html.twig +++ b/src/Resources/views/Block/block_search_result.html.twig @@ -25,7 +25,9 @@ file that was distributed with this source code. {% set icon = settings.icon|default('') %} {{ icon|raw }}

- {{ admin.label|trans({}, admin.translationdomain) }} + {% if admin.label is not empty %} + {{ admin.label|trans({}, admin.translationdomain) }} + {% endif %}

diff --git a/src/Resources/views/CRUD/Association/edit_many_script.html.twig b/src/Resources/views/CRUD/Association/edit_many_script.html.twig index aa8bf065a9..b33525ae05 100644 --- a/src/Resources/views/CRUD/Association/edit_many_script.html.twig +++ b/src/Resources/views/CRUD/Association/edit_many_script.html.twig @@ -131,8 +131,9 @@ This code manages the many-to-[one|many] association field popup // populate the popup container field_dialog_content_{{ id }}.html(html); - - field_dialog_title_{{ id }}.html("{{ associationadmin.label|trans({}, associationadmin.translationdomain) }}"); + {% if admin.label is not empty %} + field_dialog_title_{{ id }}.html("{{ associationadmin.label|trans({}, associationadmin.translationdomain) }}"); + {% endif %} Admin.shared_setup(field_dialog_{{ id }}); @@ -169,7 +170,9 @@ This code manages the many-to-[one|many] association field popup // populate the popup container field_dialog_content_{{ id }}.html(html); - field_dialog_title_{{ id }}.html("{{ associationadmin.label|trans({}, associationadmin.translationdomain) }}"); + {% if admin.label is not empty %} + field_dialog_title_{{ id }}.html("{{ associationadmin.label|trans({}, associationadmin.translationdomain) }}"); + {% endif %} Admin.shared_setup(field_dialog_{{ id }}); @@ -209,7 +212,9 @@ This code manages the many-to-[one|many] association field popup // populate the popup container field_dialog_content_{{ id }}.html(html); - field_dialog_title_{{ id }}.html("{{ associationadmin.label|trans({}, associationadmin.translationdomain) }}"); + {% if admin.label is not empty %} + field_dialog_title_{{ id }}.html("{{ associationadmin.label|trans({}, associationadmin.translationdomain) }}"); + {% endif %} Admin.shared_setup(field_dialog_{{ id }}); diff --git a/src/Resources/views/Core/add_block.html.twig b/src/Resources/views/Core/add_block.html.twig index 27f9b80cfa..4477e6999c 100644 --- a/src/Resources/views/Core/add_block.html.twig +++ b/src/Resources/views/Core/add_block.html.twig @@ -38,12 +38,18 @@ {% if admin.hasRoute('create') and admin.hasAccess('create') %} {% if admin.subClasses is empty %}
  • - {{ admin.label|trans({}, admin.translationdomain) }} + + {% if admin.label is not empty %} + {{ admin.label|trans({}, admin.translationdomain) }} + {% endif %} +
  • {% else %} {% for subclass in admin.subclasses|keys %}
  • - {{ subclass|trans({}, admin.translationdomain) }} + + {{ subclass|trans({}, admin.translationdomain) }} +
  • {% endfor %} {% endif %}