src/Cms/FileBundle/Resources/views/Modal/includes/items/ImageFile.html.twig line 1

Open in your IDE?
  1. {% set file = _args.file %}
  2. {% embed '@CmsFile/Modal/includes/item.html.twig' with {
  3.     type: 'image',
  4.     title: file.filename,
  5.     timestamp: file.timestampedAt
  6. } %}
  7.     {% block preview %}
  8.         <a
  9.             href="#"
  10.             {% if modal.mode is same as('folder') %}
  11.                 {# noop #}
  12.             {% elseif modal.mode is same as('id') %}
  13.                 data-campussuite-modals-action-save="{{- file.id|json_encode|escape('html_attr') -}}"
  14.             {% elseif modal.mode is same as('attachments') %}
  15.                 data-campussuite-modals-action-save="{{- {
  16.                     id: file.id,
  17.                     name: file.filename,
  18.                     url: cms_entityUrl(file, '/file/%s'|format(file.filename)),
  19.                     icon: ui_file_icon(file.filename),
  20.                 }|json_encode|escape('html_attr') -}}"
  21.             {% elseif modal.mode is same as('smm') %}
  22.                 data-campussuite-modals-action-save="{{- cms_friendly_url(
  23.                     cms_friendly_file_path(file),
  24.                     file.container,
  25.                     modal.entity,
  26.                     (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'))
  27.                 )|json_encode|escape('html_attr') -}}"
  28.             {% else %}
  29.                 data-campussuite-modals-action-save=""
  30.             {% endif %}
  31.         >
  32.             <img
  33.                 alt=""
  34.                 src="{{ cms_files_imageopt(file, 'MASKS__RECTANGLE__XXXSMALL') }}"
  35.                 onerror="(function(elem){jQuery(function() {window.csimgloader(elem);});})(this);"
  36.             />
  37.         </a>
  38.     {% endblock %}
  39.     {% block info %}
  40.         <p class="media__total">{{ file.size|bytes }}</p>
  41.     {% endblock %}
  42.     {% block actions %}
  43.         {% if modal.mode is not same as('folder') %}
  44.             <li class="actions-li">
  45.                 {% if modal.mode is same as('id') %}
  46.                     <a
  47.                         class="actions-li__link actions-li__link--select"
  48.                         title="select"
  49.                         href="#"
  50.                         data-campussuite-modals-action-save="{{- file.id|json_encode|escape('html_attr') -}}"
  51.                     >Select</a>
  52.                 {% elseif modal.mode is same as('attachments') %}
  53.                     <a
  54.                         class="actions-li__link actions-li__link--select"
  55.                         title="select"
  56.                         href="#"
  57.                         data-campussuite-modals-action-save="{{- {
  58.                             id: file.id,
  59.                             name: file.filename,
  60.                             url: cms_entityUrl(file, '/file/%s'|format(file.filename)),
  61.                             icon: ui_file_icon(file.filename),
  62.                         }|json_encode|escape('html_attr') -}}"
  63.                     >Select</a>
  64.                 {% elseif modal.mode is same as('smm') %}
  65.                     <a
  66.                         class="actions-li__link actions-li__link--select"
  67.                         title="select"
  68.                         href="#"
  69.                         data-campussuite-modals-action-save="{{- cms_friendly_url(
  70.                             cms_friendly_file_path(file),
  71.                             file.container,
  72.                             modal.entity,
  73.                             (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'))
  74.                         )|json_encode|escape('html_attr') -}}"
  75.                     >Select</a>
  76.                 {% else %}
  77.                     <a class="actions-li__link actions-li__link--select actions-li__link--dd" href="#" data-toggle="dropdown" aria-expanded="true">Select size</a>
  78.                     <ul class="dropdown-menu" role="menu" aria-labelledby="export">
  79.                         {% for mask,size in cms_sizesGeneric() %}
  80.                             <li role="presentation" class="text-default">
  81.                                 <a
  82.                                     role="menuitem"
  83.                                     tabindex="-1"
  84.                                     href="#"
  85.                                     data-campussuite-modals-action-save="{{- cms_friendly_url(
  86.                                         {
  87.                                             path: cms_friendly_file_path(file),
  88.                                             query: {
  89.                                             mask: mask
  90.                                         }
  91.                                         },
  92.                                         file.container,
  93.                                         null,
  94.                                         (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'))
  95.                                     )|json_encode|escape('html_attr') -}}"
  96.                                 >{{- (size is same as('0x0')) ? 'Full (Optimized)' : size|replace({
  97.                                     'x0': 'px width'
  98.                                 }) -}}</a>
  99.                             </li>
  100.                         {% endfor %}
  101.                         <li role="presentation" class="text-default">
  102.                             <a
  103.                                 role="menuitem"
  104.                                 tabindex="-1"
  105.                                 href="#"
  106.                                 data-campussuite-modals-action-save="{{- cms_friendly_url(
  107.                                     cms_friendly_file_path(file),
  108.                                     file.container,
  109.                                     null,
  110.                                     (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'))
  111.                                 )|json_encode|escape('html_attr') -}}"
  112.                             >Original (Unoptimized)</a>
  113.                         </li>
  114.                     </ul>
  115.                 {% endif %}
  116.             </li>
  117.         {% endif %}
  118.         <li class="actions-li">
  119.             <a class="actions-li__link" href="#" data-toggle="dropdown" aria-expanded="true">
  120.                 <em class="icon icon-solid-ellipsis-vert"></em>
  121.             </a>
  122.             <ul class="dropdown-menu" role="menu" aria-labelledby="export">
  123.                 <li role="presentation" class="text-default">
  124.                     <a role="menuitem" tabindex="-1" href="{{- cms_entityUrl(
  125.                         file,
  126.                         '/file/' ~ file.filename
  127.                     ) -}}" target="_blank">Download</a>
  128.                 </li>
  129.                 {% if is_granted('campussuite.cms.file.manage', container) %}
  130.                     <li role="presentation" class="text-default">
  131.                         <a role="menuitem" tabindex="-1" href="{{- path(
  132.                             routes.crop,
  133.                             {
  134.                                 containerId: file.container.id,
  135.                                 nodeId: file.id
  136.                             }
  137.                         ) -}}">Crop</a>
  138.                     </li>
  139.                 {% endif %}
  140.             </ul>
  141.         </li>
  142.     {% endblock %}
  143. {% endembed %}