Skip to content

Commit

Permalink
Added allowed mime types info to drop zone
Browse files Browse the repository at this point in the history
  • Loading branch information
ciastektk committed Dec 8, 2023
1 parent 5c56638 commit d9ccf3e
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
color: $ibexa-color-dark-300;
}

&--mime-types,
&--filesize {
color: $ibexa-color-dark-300;
font-size: $ibexa-text-font-size-small;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,11 @@
<target state="new">Max file size: %size%</target>
<note>key: fieldtype.binary_base.max_file_size</note>
</trans-unit>
<trans-unit id="b19a26b0ded06a8d2bfc9490e2645ba682c8ca30" resname="fieldtype.binary_base.mime_types">
<source>Allowed mime types: %mime_types%</source>
<target state="new">Allowed mime types: %mime_types%</target>
<note>key: fieldtype.binary_base.mime_types</note>
</trans-unit>
<trans-unit id="763e9b64f4f0024e90753727ccc212a3596bfccd" resname="fieldtype.binary_base.upload_file">
<source>Upload file</source>
<target state="new">Upload file</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@
<div class="ibexa-data-source__message--filesize">{{ 'fieldtype.binary_base.max_file_size'|trans({'%size%': max_file_size|default(0)|ibexa_file_size(2)})|desc('Max file size: %size%') }}</div>
{% endif %}

{% if mime_types is defined %}
<div class="ibexa-data-source__message--mime-types">
{{ 'fieldtype.binary_base.mime_types'|trans({'%mime_types%': mime_types|join(',')})|desc('Allowed mime types: %mime_types%') }}
</div>
{% endif %}

{% set attr = attr|merge({ hidden: 'hidden' }) %}

{{- form_widget(form.file, {'attr': attr}) -}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
{%- block ezplatform_fieldtype_ezimage_row -%}
{% set preview_block_name = 'ezimage_preview' %}
{% set max_file_size = min(form.parent.vars.value.fieldDefinition.validatorConfiguration.FileSizeValidator.maxFileSize * 1024 * 1024, max_upload_size|round) %}

{% if mime_types is defined %}
{% set attr = attr|merge({'data-allowed-file-types': mime_types|join(',') }) %}
{% else %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@
</div>
{% endif %}

{% if mime_types is defined %}
<div class="ibexa-data-source__message--mime-types">
{{ 'fieldtype.binary_base.mime_types'|trans({'%mime_types%': mime_types|join(',')})|desc('Allowed mime types: %mime_types%') }}
</div>
{% endif %}

{% set attr = attr|merge({ hidden: 'hidden' }) %}

{{- form_widget(form.file, {'attr': attr}) -}}
Expand Down

0 comments on commit d9ccf3e

Please sign in to comment.