EasyCorp / EasyCorp/EasyAdminBundle
Block ea_fileupload_widget improvements
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 4.3k
- Forks
- 1.1k
- Avg merge
- 8d 2h
- Merged PRs (30d)
- 11
Description
Describe the bug
The block ea_fileupload_widget should get some improvements to comply with some field configuration:
Comply with field enable/disable status:
<button type="button" class="btn btn-secondary btn-sm ea-fileupload-add-btn {{ not showAddButton ? 'd-none' }}" data-ea-fileupload-add{{ disabled ? ' disabled' }}>
{{ fileUrl }} should be configurable, especially for the thumbnail.
Currently the thumbnail load images of original size which is not optimized, I'd like to passe a custom thumbnail URL that could point out to LiipImagineBundle or anything else.
In my opinion the following piece of code should be a dedicated twig block allowing configurable thumbnail:
<div class="ea-fileupload-card-preview">
{% if isImage and fileUrl %}
<img src="{{ fileUrl }}" alt="{{ fileName }}" class="ea-fileupload-card-thumbnail" />
{% else %}
<twig:ea:Icon name="filetypes:{{ filetypeIcon }}" class="ea-fileupload-card-icon" />
{% endif %}
</div>
The same would apply for <div class="ea-fileupload-card-actions"> that is currently opening a new tab, a custom block would allow targeted override instead of extending the whole ea_fileupload_widget block.
I can make a PR if you're okay with the suggestion Javier ?
To Reproduce
Steps to reproduce this error and also, the EasyAdmin version used.
(OPTIONAL) Additional context
If they are useful, include logs, code samples, screenshots, etc.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the ea_fileupload_widget Twig block shown in the issue and trace how field enable/disable state and fileUrl reach the widget. Done means the add control respects disabled fields, thumbnails can use a configurable URL, and the preview and actions areas can be overridden without extending the whole widget; add or update coverage if the project has tests for this block.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100