%= form_for(@image, :as => :image,
:url => (@image.new_record? ? main_app.images_path : main_app.image_path),
:method => (@image.new_record? ? :post : :put),
:html => {:id=>"form_image", :class=>"mb-0 form-horizontal", :multipart => true, :target => "iframe_image"}) do |f| %>
<%# if @current_user.has_role?("Technical Admin") %>
<% unless @image.new_record? %>
Download
<% @image.image.versions.each do |k, v| %>
<% next unless @image.image %>
<%= link_to @image.image.versions[k].url, target: "_blank" do %>
<%= display_image(@image, "image.#{k}.url", width: "auto", height: "60px", style: "display:block; margin-left:auto; margin-right:auto;") %>
<%= k.to_s.titleize %>
<% end %>
<% end %>
<% end %>
<%# end %>
<%= @form_sub_title %>
<% @form_instructions.each do |i| %>
- <%= raw i %>
<% end %>
<%= @image.errors[:base].to_sentence %>
<% if @image.errors.any? && @current_user && @current_user.super_admin? %>
<% @image.errors.full_messages.each do |i| %>
- <%= raw i %>
<% end %>
<% end %>
<%= hidden_field_tag :faction, @image.new_record? ? main_app.images_path : main_app.image_path(@image) %>
<%= hidden_field_tag :fmethod, @image.new_record? ? "POST" : "PUT" %>
<%= hidden_field_tag :imageable_id, params[:imageable_id] %>
<%= hidden_field_tag :imageable_type, params[:imageable_type] %>
<%= hidden_field_tag :redirect_url, params[:redirect_url] %>
<%= hidden_field_tag :image_type, params[:image_type] %>
<%= hidden_field_tag :multiple, params[:multiple] %>
<%= theme_form_field(@image, :image, html_options: {type: 'file'}, label: @form_upload_image_label, param_name: "image") %>