Sha256: fe41c59da5f7957e33c341635df058e69fabe2b0c69b0a3eb81599b9e4046a8f

Contents?: true

Size: 1.72 KB

Versions: 20

Compression:

Stored size: 1.72 KB

Contents

<div class="relative min-h-full max-w-full flex-1 space-y-3">
  <% if @file.present? %>
    <% if @file.representable? && @is_image %>
      <%= image_tag helpers.main_app.url_for(@file), class: 'rounded-lg max-h-168 max-w-full' %>
    <% elsif @is_audio %>
      <%= audio_tag(helpers.main_app.url_for(@file), controls: true, preload: false, class: 'w-full')%>
    <% else %>
      <div class="relative flex flex-col justify-evenly items-center px-2 rounded-lg border bg-white border-gray-500 min-h-48">
        <div class="flex flex-col justify-center items-center w-full">
          <%= helpers.svg 'document-text', class: 'h-12 text-gray-800 mb-2' %>
          <div class="block w-full truncate text-center text-sm">
            <%= @file.filename %>
          </div>
        </div>
      </div>
    <% end %>

    <div class="flex justify-between">
      <div>
        <% if @resource.authorization.authorize_action(:download_attachments?, raise_exception: false) %>
          <%= a_link helpers.main_app.url_for(@file), color: 'indigo', download: true, class: '', size: :md do %>
            <%= helpers.svg 'download' %> <%= t('avo.download_file') %>
          <% end %>
        <% end %>
      </div>
      <div>
        <% if @resource.authorization.authorize_action(:delete_attachments?, raise_exception: false) %>
          <%= a_link "#{@resource.record_path}/active_storage_attachments/#{@id}/#{@file.blob_id}", color: :red, variant: :outlined, size: :md, class: '', 'data-turbo-frame': 'destroy_attachment_form', data: { confirm: t('avo.are_you_sure')} do %>
            <%= helpers.svg 'trash' %> <%= t 'avo.delete_file', item: @file.filename %>
          <% end %>
        <% end %>
      </div>
    </div>
  <% else %>
    –
  <% end %>
</div>

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
avo-1.25.2 app/components/avo/fields/common/single_file_viewer_component.html.erb
avo-1.25.1 app/components/avo/fields/common/single_file_viewer_component.html.erb
avo-1.25.0 app/components/avo/fields/common/single_file_viewer_component.html.erb
avo-1.24.2 app/components/avo/fields/common/single_file_viewer_component.html.erb
avo-1.24.1 app/components/avo/fields/common/single_file_viewer_component.html.erb
avo-1.24.0 app/components/avo/fields/common/single_file_viewer_component.html.erb
avo-1.23.0 app/components/avo/fields/common/single_file_viewer_component.html.erb
avo-1.22.4 app/components/avo/fields/common/single_file_viewer_component.html.erb
avo-1.22.3 app/components/avo/fields/common/single_file_viewer_component.html.erb
avo-1.22.2 app/components/avo/fields/common/single_file_viewer_component.html.erb
avo-1.22.1 app/components/avo/fields/common/single_file_viewer_component.html.erb
avo-1.22.1.pre.2 app/components/avo/fields/common/single_file_viewer_component.html.erb
avo-1.22.1.pre.1 app/components/avo/fields/common/single_file_viewer_component.html.erb
avo-1.22.0 app/components/avo/fields/common/single_file_viewer_component.html.erb
avo-1.22.0.pre.1 app/components/avo/fields/common/single_file_viewer_component.html.erb
avo-1.21.1.pre.1 app/components/avo/fields/common/single_file_viewer_component.html.erb
avo-1.21.0 app/components/avo/fields/common/single_file_viewer_component.html.erb
avo-1.20.2.pre.2 app/components/avo/fields/common/single_file_viewer_component.html.erb
avo-1.20.2.pre.1 app/components/avo/fields/common/single_file_viewer_component.html.erb
avo-1.21.0.pre.1 app/components/avo/fields/common/single_file_viewer_component.html.erb