<%= @asset.name %>

<%= t("admin.columns.actions") %>
<%= link_to edit_asset_path(@asset), class: 'action_button' do %> <%= icon("edit", library: "tabler", "aria-hidden": true) %> <%= t("admin.common.edit") %> <% end %>
<%= link_to admin_log_path(:asset_id => @asset.id), :class => "action_button" do %> <%= icon("history", library: "tabler", "aria-hidden": true) %> <%= t("node_actions.asset_history") %> <% end %>
<% if @asset.attached_nodes.any? %> <%= icon("trash", library: "tabler", "aria-hidden": true) %> <%= t("admin.common.destroy") %> <%= t(".destroy_blocked") %> <% else %> <%= button_to asset_path(@asset), method: :delete, form: { data: { confirm: t("admin.common.confirm_sure") }, class: 'button_to destructive' } do %> <%= icon("trash", library: "tabler", "aria-hidden": true) %> <%= t("admin.common.destroy") %> <% end %> <% end %>
<%= link_to t("admin.common.back"), assets_path %>
<% if @asset.has_variant?(:medium) %>
<%= t(".thumbnail") %>
<%= image_tag @asset.upload.url(:medium), style: "max-width: 300px; max-height: 300px;" %>
<% end %>
<%= t(".attached_to") %>
<% nodes = @asset.attached_nodes %> <% if nodes.any? %>
    <% nodes.each do |node| %>
  • <%= link_to node.title, node_path(node) %> <% if node.editable_page&.headline_asset == @asset %> <%= icon("star", library: "tabler", "aria-hidden": true) %> <% end %> <% unless node.head && node.head.related_assets.exists?(:asset_id => @asset.id) %> <%= t(".pending_only") %> <% end %>
  • <% end %>
<% else %> <%= t(".not_attached") %> <% end %>
<%= t("assets.form.attach_to_page") %>
<%= form_tag attach_to_node_asset_path(@asset), :class => "asset_attach_form" do %>
<%= text_field_tag :asset_node_search_term, nil, :placeholder => t("assets.form.attach_search_placeholder"), :autocomplete => "off" %>
<%= button_tag :type => "submit", :class => "action_button" do %> <%= icon("paperclip", library: "tabler", "aria-hidden": true) %> <%= t(".attach_button") %> <% end %> <%= t(".attach_hint") %> <% end %>
<%= t(".new_page") %>
<%= link_to new_node_path(:asset_id => @asset.id), :class => "action_button" do %> <%= icon("file-plus", library: "tabler", "aria-hidden": true) %> <%= t(".new_page_with_attachment") %> <% end %>
<%= t(".public_path") %>
<% public_path = @asset.upload.url.sub(/\?\d+$/, "") %> <%= link_to public_path, public_path, target: "_blank", rel: "noopener" %>
<%= t(".creator") %>
<%= @asset.creator.presence || "—" %>
<%= t(".source") %>
<% if @asset.source_url.present? %> <%= link_to @asset.source_url, @asset.source_url %> <% else %> — <% end %>
<%= t(".license") %>
<% if (license = AssetLicense.find(@asset.license_key)) %> <%= t("asset_licenses.#{license.key}") %> <% else %> — <% end %>
<%= t(".content_type") %>
<%= @asset.upload.content_type %>
<%= t(".size") %>
<%= "#{@asset.upload.size/1024} KB" %>