Skip to content

Commit

Permalink
override friendly
Browse files Browse the repository at this point in the history
  • Loading branch information
vitiko committed Sep 30, 2016
1 parent 5219cbf commit f0bb677
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 60 deletions.
74 changes: 74 additions & 0 deletions Resources/views/Form/fields-base.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
{% block iphp_file_widget %}


<div {{ block('widget_container_attributes') }}>

{% if form.file is defined %}
{{ form_widget(form.file) }}
{% endif %}

{# if was upload error value is uploadedFile and originalName no exists#}
{% if file_data and file_data.originalName is defined %}
{% set fileUrl = file_data.path %}

{% if show_preview and file_data.width is defined %}
{% block iphp_file_widget_image_preview %}

<div style="float: left" class="iphp_file_widget_image_preview">
<a href="{{ fileUrl }}" target="_blank"><img
src="{{ fileUrl }}"
width="{{ file_data .width > 200 ? 200 : file_data.width }}" border="0"></a>
</div>

<div>{{ file_data.width ~ 'x' ~ file_data.height }} </div>
{% endblock iphp_file_widget_image_preview %}
{% endif %}



{% block iphp_file_widget_file_info %}
<div>

{% block iphp_file_widget_file_link %}
<div>
<a href="{{ fileUrl }}" target="_blank" class="full-img-link">{{ file_data.fileName }}</a>
</div>
{% endblock iphp_file_widget_file_link %}

{% block iphp_file_widget_file_attrs %}
<div>{{ file_data.size /1000 }} Kb</div>

{% if file_data.originalName != file_data.fileName %}
<div>
{% trans %}Original file name{% endtrans %}:
<strong>{{ file_data.originalName }}</strong>
</div>
{% endif %}
{% endblock iphp_file_widget_file_attrs %}


{% if form.delete is defined %}
{% block iphp_file_widget_file_delete %}
<div>
{{ form_row (form.delete, {'label_attr' : { 'style' :'width:auto;padding-right:10px' }}) }}
</div>
{% endblock iphp_file_widget_file_delete %}
{% endif %}

</div>
{% endblock iphp_file_widget_file_info %}




{% endif %}


{% block iphp_file_widget_end %}
<div style="clear: both"></div>
{% endblock iphp_file_widget_end %}

</div>


{% endblock iphp_file_widget %}
61 changes: 1 addition & 60 deletions Resources/views/Form/fields.html.twig
Original file line number Diff line number Diff line change
@@ -1,60 +1 @@
{% block iphp_file_widget %}


<div {{ block('widget_container_attributes') }}>

{% if form.file is defined %}
{{ form_widget(form.file) }}
{% endif %}

{# if was upload error value is uploadedFile and originalName no exists#}
{% if file_data and file_data.originalName is defined %}
{% set fileUrl = file_data.path %}
{# |url_encode() #}



{% block iphp_file_info %}
<table>
<tr>

{% if show_preview %}
{% if file_data.width is defined %}
<td><a href="{{ fileUrl }}" target="_blank" class="full-img-link"><img
src="{{ fileUrl }}"
width="{{ file_data .width > 200 ? 200 : file_data.width }}" border="0"></a>
</td>
<td>&nbsp;&nbsp;&nbsp;</td>
{% endif %}
{% endif %}

<td style="vertical-align: top;">

<a href="{{ fileUrl }}" target="_blank" class="full-img-link">{{ file_data.fileName }}</a>
<br>{{ file_data.size /1000 }} Kb
{{ file_data.width is defined ? ', ' ~ file_data.width ~ 'x' ~ file_data.height : "" }}

{% if file_data.originalName != file_data.fileName %}
<br>{% trans %}Original file name{% endtrans %}: <b>{{ file_data.originalName }}</b>
{% endif %}



{% if form.delete is defined %}
<br><br>
{{ form_row (form.delete, {'label_attr' : { 'style' :'width:auto;padding-right:10px' }})}}
{% endif %}

</td>

</tr>
</table>
{% endblock iphp_file_info %}


{% endif %}

</div>


{% endblock iphp_file_widget %}
{% extends 'IphpFileStoreBundle:Form:fields-base.html.twig' %}

0 comments on commit f0bb677

Please sign in to comment.