<% attachments.each do |attachment| %>
<% next if attachment.is_a? Array %>
<% if has_title? %>
<%= title_for(attachment) %> (<%= truncated_file_name_for(attachment) %>)
<%= form.hidden_field attribute, multiple: true, value: attachment.id, id: attachment.id %>
<% else %>
<% if blob(attachment).image? %>
<%= truncated_file_name_for(attachment, 15) %>
<% else %>
<%= link_to truncated_file_name_for(attachment), file_attachment_path(attachment) %>
<% end %>
<% end %>
<% end %>
<%= tag.button button_label,
id: button_id,
name: attribute,
class: button_class,
type: "button",
data: {
open: modal_id,
upload: {
add_attribute: add_attribute,
resource_name: resource_name,
resource_class: resource_class,
required: required?,
optional: optional,
max_file_size: max_file_size,
multiple: multiple,
titled: has_title?,
form_object_class: form_object_class
}.transform_keys { |key| key.to_s.camelize(:lower) }
} %>
<%= input_validation_field unless optional %>
<% if !has_title? && file_attachment_path(attachments.first) && blob(attachments.first).image? %>