<% if multiple_files %>
<% f.object.send(a).each_with_index do |file, i| %>
<% extension = file.try(:extension).try(:downcase) || file.try(:format).try(:downcase) || file.try(:file).try(:extension) %>
<% if extension.present? %>
<% if %w{jpg png jpeg gif bmp}.include?(extension) %>
<% if file.try(:url).present? %>
<% else %>
<%= file.url %>
<% end %>
<% end %>
<% else %>
<%= t('slash_admin.view.no_image') %>
<% end %>
<% end %>
<% else %>
<% extension = f.object.send(a).file.try(:extension).try(:downcase) || f.object.send(a).file.try(:format).try(:downcase) || f.object.send(a).file.try(:file).try(:extension) %>
<% if extension.present? %>
<% if %w{jpg png jpeg gif bmp}.include?(extension) %>
<% if f.object.send(a).try(:url).present? %>
<% end %>
<% else %>
<%= f.object.send(a) %>
<% end %>
<% else %>
<%= t('slash_admin.view.no_image') %>
<% end %>
<% end %>
<%= f.hidden_field (a.to_s + '_cache').to_sym %>
<%= f.file_field a, multiple: multiple_files %>