-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #67 from smartbooster/add_vich_uploader_helper
Add vich_uploader helper
- Loading branch information
Showing
13 changed files
with
144 additions
and
2 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
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,3 @@ | ||
# Required for the QA lint-twig to work | ||
vich_uploader: | ||
db_driver: orm |
Empty file.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,16 @@ | ||
{% extends '@SonataAdmin/CRUD/base_list_field.html.twig' %} | ||
|
||
{% block field %} | ||
{% set fileNameValue = attribute(object, field_description.fieldName ~ 'Name') %} | ||
{% if fileNameValue is null %} | ||
{% set url = asset('bundles/smartsonata/images/placeholders/128x128.png') %} | ||
{% set alt = 'logo' %} | ||
{% else %} | ||
{% set url = vich_uploader_asset(object, field_description.fieldName ~ 'File') %} | ||
{% set alt = attribute(object, field_description.fieldName ~ 'OriginalName') %} | ||
{% endif %} | ||
|
||
<div class="user-block pull-left"> | ||
<img class="img-circle img-bordered-sm" src="{{ url }}" alt="{{ alt }}"/> | ||
</div> | ||
{% endblock %} |
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,16 @@ | ||
{# MDT Use this template if you want to display image from Smart\CoreBundle\Entity\EmbeddedFile #} | ||
|
||
{% extends '@SonataAdmin/CRUD/base_show_field.html.twig' %} | ||
|
||
{% block field %} | ||
{% set fileNameValue = value.name %} | ||
{% if fileNameValue is null %} | ||
{% set url = asset('bundles/smartsonata/images/placeholders/128x128.png') %} | ||
{% set alt = 'logo' %} | ||
{% else %} | ||
{% set url = vich_uploader_asset(object.files, field_description.fieldName ~ 'File') %} | ||
{% set alt = value.originalName %} | ||
{% endif %} | ||
|
||
<img class="img-bordered-sm" src="{{ url }}" alt="{{ alt }}"/> | ||
{% endblock %} |
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,14 @@ | ||
{% extends '@SonataAdmin/CRUD/base_show_field.html.twig' %} | ||
|
||
{% block field %} | ||
{% set fileNameValue = attribute(object, field_description.fieldName ~ 'Name') %} | ||
{% if fileNameValue is null %} | ||
{% set url = asset('bundles/smartsonata/images/placeholders/128x128.png') %} | ||
{% set alt = 'logo' %} | ||
{% else %} | ||
{% set url = vich_uploader_asset(object, field_description.fieldName ~ 'File') %} | ||
{% set alt = attribute(object, field_description.fieldName ~ 'OriginalName') %} | ||
{% endif %} | ||
|
||
<img class="img-bordered-sm" src="{{ url }}" alt="{{ alt }}" width="100"/> | ||
{% endblock %} |
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,8 @@ | ||
{% extends '@SonataAdmin/CRUD/base_show_field.html.twig' %} | ||
|
||
{% block field %} | ||
{% set fileNameValue = attribute(object, field_description.fieldName ~ 'Name') %} | ||
{% if fileNameValue is not null %} | ||
<a href="{{ vich_uploader_asset(object, field_description.fieldName ~ 'File') }}">{{ 'vich_uploader.link.download'|trans }}</a> | ||
{% endif %} | ||
{% endblock %} |
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,17 @@ | ||
{% trans_default_domain 'admin' %} | ||
|
||
{% macro crud_action(object, action, icon) %} | ||
{% set url = admin.generateObjectUrl(action, object) %} | ||
{% set label = ('action.' ~ action|u.snake)|trans %} | ||
{% if admin.isCurrentRoute('list') %} | ||
<a href="{{ url }}" class="btn btn-xs btn-default" title="{{ label }}"> | ||
<i class="{{ icon }}"></i> | ||
</a> | ||
{% else %} | ||
<li> | ||
<a class="sonata-action-element" href="{{ url }}"> | ||
<i class="{{ icon }}"></i> {{ label }} | ||
</a> | ||
</li> | ||
{% endif %} | ||
{% endmacro %} |
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