Skip to content

Commit

Permalink
Add preview column in media management list
Browse files Browse the repository at this point in the history
  • Loading branch information
liszkapawel committed Sep 28, 2022
1 parent d094beb commit 3b7b39e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Resources/config/grids/admin/media.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ sylius_grid:
code: asc
limits: [10, 25, 50]
fields:
media_file:
type: twig
label: bitbag_sylius_cms_plugin.ui.preview
path: .
options:
template: "@BitBagSyliusCmsPlugin/Grid/Field/image_preview.html.twig"
name:
type: string
label: bitbag_sylius_cms_plugin.ui.name
Expand Down
5 changes: 5 additions & 0 deletions src/Resources/views/Grid/Field/image_preview.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{% if 'image' in data.mimeType %}
<img src="{{ data.path|imagine_filter(filter|default('sylius_admin_product_thumbnail')) }}" class="ui bordered image"/>
{% else %}
<p>{{ data.mimeType }}</p>
{% endif %}

0 comments on commit 3b7b39e

Please sign in to comment.