<%- @page_title = "GBL♦Admin - Document - Distributions" %>

Document · Distributions <% if params[:document_id] %> <%= link_to '+ Import CSV', import_admin_document_document_distributions_path(@document), { class: 'btn btn-primary float-right' } %> <%= link_to '+ New Distribution', new_admin_document_document_distribution_path(@document), { class: 'btn btn-primary float-right mr-2' } %> <% else %> <%= link_to '- Delete CSV', destroy_all_admin_document_distributions_path, { class: 'btn btn-danger float-right' } %> <%= link_to '+ Import CSV', import_admin_document_distributions_path, { class: 'btn btn-primary float-right mr-4' } %> <% end %>

<% if params[:document_id] %>

<%= link_to(@document.title, admin_document_path(@document)) %> · <%= @document_distributions.count %> distributions

<% else %>

Distributions

<% end %>

<% if @pagy %>
<%== pagy_info(@pagy) %> <%== pagy_bootstrap_nav(@pagy) %>
<% end %> <% if @document %>

External – Document Distributions

<% end %> <% @document_distributions.each do |document_distribution| %> <% end %>
Layer Slug Type URI Value Label Actions
<%= link_to document_distribution.friendlier_id, admin_document_path(document_distribution.document) %> <%= document_distribution.reference_type.reference_type %> <%= document_distribution.reference_type.reference_uri %> <%= link_to document_distribution.url, document_distribution.url, target: '_blank' %> <%= document_distribution.label %> <%= link_to 'Edit', edit_admin_document_document_distribution_path(document_distribution.document, document_distribution) %> <%= link_to 'Destroy', admin_document_document_distribution_path(document_distribution.document, document_distribution), method: :delete, data: { confirm: 'Are you sure?' } %>
<% if @pagy %>
<%== pagy_info(@pagy) %> <%== pagy_bootstrap_nav(@pagy) %>
<% end %> <% if @document && @document.distributable_assets.any? %>

Internal – Distributable Assets

<%= render partial: 'admin/document_assets/assets_table', locals: { document_assets: @document.document_assets } %> <% end %>
<% if params[:document_id] %>

Ruby Hash

<%= ap(@document.distributions).html_safe %>

JSON

<%= ap(@document.distributions.to_json).html_safe %>

<% @document.distributions_csv.each do |row| %> <% row.each do |value| %> <% end %> <% end %>
Layer Slug Type Value Label
<%= value %>
<% end %>