-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow using custom action templates. (#197)
Before this change, using [custom template for actions](https://symfony.com/doc/2.x/bundles/EasyAdminBundle/tutorials/custom-actions.html#custom-templates-for-actions) wasn't possible, as well as [collapsing actions](https://symfony.com/doc/2.x/bundles/EasyAdminBundle/book/configuration-reference.html#collapse-actions). This PR makes it possible while keeping the [confirmation modal](https://symfony.com/doc/2.x/bundles/EasyAdminBundle/book/configuration-reference.html#collapse-actions). It introduces a new `action.html.twig` template, which keeps the confirmation behavior. This is the new template to use when creating a custom template. This PR also changes the `_actions_template` template selection, giving us the ability to use the collapsed version of actions. Side note: the new action template differs slightly from the original one in the way it deals with translation and doesn't use the same CSS classes for the action icon. This was left unchanged.
- Loading branch information
Showing
5 changed files
with
37 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<a name="{{ action.name }}" class="{{ action.css_class|default('') }}" title="{{ action.title|default('') is empty ? '' : action.title|trans(trans_parameters, translation_domain) }}" {% if not confirm %}href="{{ action_href }}" target="{{ action.target }}"{% else %}href="#" data-href="{{ action_href }}" data-confirm="{{ confirm }}"{% endif %}> | ||
{%- if action.icon %}<i class="fa fa-{{ action.icon }}"></i> {% endif -%} | ||
{%- if action.label is defined and not action.label is empty -%} | ||
{{ action.label|trans(trans_parameters|merge({ '%entity_id%': item_id }), translation_domain) }} | ||
{%- endif -%} | ||
</a> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters