{% set file = _args.file %}
{% embed '@CmsFile/Modal/includes/item.html.twig' with {
type: 'image',
title: file.filename,
timestamp: file.timestampedAt
} %}
{% block preview %}
<a
href="#"
{% if modal.mode is same as('folder') %}
{# noop #}
{% elseif modal.mode is same as('id') %}
data-campussuite-modals-action-save="{{- file.id|json_encode|escape('html_attr') -}}"
{% elseif modal.mode is same as('attachments') %}
data-campussuite-modals-action-save="{{- {
id: file.id,
name: file.filename,
url: cms_entityUrl(file, '/file/%s'|format(file.filename)),
icon: ui_file_icon(file.filename),
}|json_encode|escape('html_attr') -}}"
{% elseif modal.mode is same as('smm') %}
data-campussuite-modals-action-save="{{- cms_friendly_url(
cms_friendly_file_path(file),
file.container,
modal.entity,
(file.container.root is same as(modal.entity.root)) ? constant('Cms\\CoreBundle\\Model\\Url::FLAGS__FORCE_ROOT') : (constant('Cms\\CoreBundle\\Model\\Url::FLAGS__FORCE_ABSOLUTE') b-or constant('Cms\\CoreBundle\\Model\\Url::FLAGS__FORCE_HTTP'))
)|json_encode|escape('html_attr') -}}"
{% else %}
data-campussuite-modals-action-save=""
{% endif %}
>
<img
alt=""
src="{{ cms_files_imageopt(file, 'MASKS__RECTANGLE__XXXSMALL') }}"
onerror="(function(elem){jQuery(function() {window.csimgloader(elem);});})(this);"
/>
</a>
{% endblock %}
{% block info %}
<p class="media__total">{{ file.size|bytes }}</p>
{% endblock %}
{% block actions %}
{% if modal.mode is not same as('folder') %}
<li class="actions-li">
{% if modal.mode is same as('id') %}
<a
class="actions-li__link actions-li__link--select"
title="select"
href="#"
data-campussuite-modals-action-save="{{- file.id|json_encode|escape('html_attr') -}}"
>Select</a>
{% elseif modal.mode is same as('attachments') %}
<a
class="actions-li__link actions-li__link--select"
title="select"
href="#"
data-campussuite-modals-action-save="{{- {
id: file.id,
name: file.filename,
url: cms_entityUrl(file, '/file/%s'|format(file.filename)),
icon: ui_file_icon(file.filename),
}|json_encode|escape('html_attr') -}}"
>Select</a>
{% elseif modal.mode is same as('smm') %}
<a
class="actions-li__link actions-li__link--select"
title="select"
href="#"
data-campussuite-modals-action-save="{{- cms_friendly_url(
cms_friendly_file_path(file),
file.container,
modal.entity,
(file.container.root is same as(modal.entity.root)) ? constant('Cms\\CoreBundle\\Model\\Url::FLAGS__FORCE_ROOT') : (constant('Cms\\CoreBundle\\Model\\Url::FLAGS__FORCE_ABSOLUTE') b-or constant('Cms\\CoreBundle\\Model\\Url::FLAGS__FORCE_HTTP'))
)|json_encode|escape('html_attr') -}}"
>Select</a>
{% else %}
<a class="actions-li__link actions-li__link--select actions-li__link--dd" href="#" data-toggle="dropdown" aria-expanded="true">Select size</a>
<ul class="dropdown-menu" role="menu" aria-labelledby="export">
{% for mask,size in cms_sizesGeneric() %}
<li role="presentation" class="text-default">
<a
role="menuitem"
tabindex="-1"
href="#"
data-campussuite-modals-action-save="{{- cms_friendly_url(
{
path: cms_friendly_file_path(file),
query: {
mask: mask
}
},
file.container,
null,
(modal.mode is not same as('absolute')) ? constant('Cms\\CoreBundle\\Model\\Url::FLAGS__FORCE_ROOT') : (constant('Cms\\CoreBundle\\Model\\Url::FLAGS__FORCE_ABSOLUTE') b-or constant('Cms\\CoreBundle\\Model\\Url::FLAGS__FORCE_HTTP'))
)|json_encode|escape('html_attr') -}}"
>{{- (size is same as('0x0')) ? 'Full (Optimized)' : size|replace({
'x0': 'px width'
}) -}}</a>
</li>
{% endfor %}
<li role="presentation" class="text-default">
<a
role="menuitem"
tabindex="-1"
href="#"
data-campussuite-modals-action-save="{{- cms_friendly_url(
cms_friendly_file_path(file),
file.container,
null,
(modal.mode is not same as('absolute')) ? constant('Cms\\CoreBundle\\Model\\Url::FLAGS__FORCE_ROOT') : (constant('Cms\\CoreBundle\\Model\\Url::FLAGS__FORCE_ABSOLUTE') b-or constant('Cms\\CoreBundle\\Model\\Url::FLAGS__FORCE_HTTP'))
)|json_encode|escape('html_attr') -}}"
>Original (Unoptimized)</a>
</li>
</ul>
{% endif %}
</li>
{% endif %}
<li class="actions-li">
<a class="actions-li__link" href="#" data-toggle="dropdown" aria-expanded="true">
<em class="icon icon-solid-ellipsis-vert"></em>
</a>
<ul class="dropdown-menu" role="menu" aria-labelledby="export">
<li role="presentation" class="text-default">
<a role="menuitem" tabindex="-1" href="{{- cms_entityUrl(
file,
'/file/' ~ file.filename
) -}}" target="_blank">Download</a>
</li>
{% if is_granted('campussuite.cms.file.manage', container) %}
<li role="presentation" class="text-default">
<a role="menuitem" tabindex="-1" href="{{- path(
routes.crop,
{
containerId: file.container.id,
nodeId: file.id
}
) -}}">Crop</a>
</li>
{% endif %}
</ul>
</li>
{% endblock %}
{% endembed %}