Sha256: f1116ecd53086b707210be9520018c6da7875b9960ec23af1f489ac32204b4a3

Contents?: true

Size: 1.29 KB

Versions: 7

Compression:

Stored size: 1.29 KB

Contents

<%= f.fields_for :sidecar, document.sidecar(current_exhibit) do |c| %>
  <%= c.fields_for :data do |d| %>
    <% if document.uploaded_resource? %>
      <%= d.fields_for :configured_fields do |e| %>
        <% Spotlight::Resources::Upload.fields(current_exhibit).each do |config| %>
          <%= e.send(config.form_field_type, config.field_name, value: (document.sidecar(current_exhibit).data["configured_fields"] || {})[config.field_name.to_s], label: uploaded_field_label(config)) %>
        <% end %>
      <% end %>
    <% end %>

    <%# Using `includes(:exhibit)` to ensure all fields are using the same exhibit object to take advantage of memoization %>
    <% current_exhibit.custom_fields.includes(:exhibit).each do |field| %>
      <% data = document.sidecar(current_exhibit).data %>
      <%= render partial: "spotlight/custom_fields/form_group/#{field.field_type}", locals: { f: d, field: field, value: data[field.slug.to_s] || data[field.field.to_s] }  %>

      <% unless field.configured_to_display? %>
        <p class="bg-warning help-block">
          <%= t(:'.blank_field_warning_html',
                link: link_to(t(:'spotlight.configuration.sidebar.metadata'), spotlight.edit_exhibit_metadata_configuration_path(current_exhibit))) %>
        </p>
      <% end %>
    <% end %>
  <% end %>
<% end %>

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
blacklight-spotlight-2.13.0 app/views/spotlight/catalog/_edit_sidecar.html.erb
blacklight-spotlight-2.12.1 app/views/spotlight/catalog/_edit_sidecar.html.erb
blacklight-spotlight-2.12.0 app/views/spotlight/catalog/_edit_sidecar.html.erb
blacklight-spotlight-2.11.0 app/views/spotlight/catalog/_edit_sidecar.html.erb
blacklight-spotlight-2.10.0 app/views/spotlight/catalog/_edit_sidecar.html.erb
blacklight-spotlight-2.9.0 app/views/spotlight/catalog/_edit_sidecar.html.erb
blacklight-spotlight-2.8.0 app/views/spotlight/catalog/_edit_sidecar.html.erb