AlchemyCMS/alchemy_cms

View on GitHub
app/views/alchemy/admin/attachments/show.html.erb

Summary

Maintainability
Test Coverage
<div class="resource_info">
  <div class="value">
    <label>
      <%= render_icon @attachment.icon_css_class %>
    </label>
    <p><%= @attachment.file_name %></p>
  </div>
  <div class="value with-icon">
    <label><%= Alchemy::Attachment.human_attribute_name(:url) %></label>
    <p><%= @attachment.url %></p>
    <alchemy-clipboard-button
      content="<%= @attachment.url %>"
      success-text="<%= Alchemy.t("Copied to clipboard") %>"
      class="icon_button--right"
    ></alchemy-clipboard-button>
  </div>
  <div class="value with-icon">
    <label><%= Alchemy::Attachment.human_attribute_name(:download_url) %></label>
    <p><%= @attachment.url(download: true) %></p>
    <alchemy-clipboard-button
      content="<%= @attachment.url(download: true) %>"
      success-text="<%= Alchemy.t("Copied to clipboard") %>"
      class="icon_button--right"
    ></alchemy-clipboard-button>
  </div>
</div>

<% case @attachment.file_mime_type %>
<% when *Alchemy::Filetypes::IMAGE_FILE_TYPES %>
<div class="attachment_preview_container image-preview">
  <%= image_tag(@attachment.url, class: "full_width") %>
</div>
<% when *Alchemy::Filetypes::AUDIO_FILE_TYPES %>
<div class="attachment_preview_container player-preview">
  <%= audio_tag(@attachment.url, preload: "none", controls: true, class: "full_width") %>
</div>
<% when *Alchemy::Filetypes::VIDEO_FILE_TYPES %>
<div class="attachment_preview_container player-preview">
  <%= video_tag(@attachment.url, preload: "metadata", controls: true, class: "full_width") %>
</div>
<% when "application/pdf" %>
<iframe src="<%= @attachment.url %>" frameborder=0 class="full-iframe">
  Your browser does not support frames.
</iframe>
<% end %>