% options = local_assigns.fetch(:options, {}) %>
<%= content_tag :div,
class: picture_editor.css_classes,
data: picture_editor.data_attributes do %>
<%= element_form.fields_for(:ingredients, picture_editor.ingredient) do |f| %>
<%= ingredient_label(picture_editor, :picture_id, for: nil) %>
<%= content_tag :div,
data: {
target_size: picture_editor.settings[:size] || [
picture_editor.image_file_width.to_i,
picture_editor.image_file_height.to_i
].join("x"),
image_cropper: picture_editor.thumbnail_url_options[:crop],
},
class: "picture_thumbnail" do %>
<%= render_icon(:times) %>
<%- if picture_editor.picture -%>
<%= image_tag(
picture_editor.thumbnail_url,
alt: picture_editor.picture.name,
class: "img_paddingtop",
title: Alchemy.t(:image_name, name: picture_editor.picture.name),
) %>
<% else %>
<%= render_icon(:image, style: "regular") %>
<% end %>
<%- if picture_editor.css_class.present? -%>
<%= Alchemy.t("alchemy.picture_ingredients.css_classes.#{picture_editor.css_class}",
default: picture_editor.css_class.camelcase) %>
<%- end -%>
<%= render "alchemy/ingredients/shared/picture_tools", {
picture_editor: picture_editor
} %>
<% end %>
<%= f.hidden_field :picture_id, value: picture_editor.picture&.id,
id: picture_editor.form_field_id(:picture_id),
data: {
picture_id: true,
image_file_width: picture_editor.image_file_width,
image_file_height: picture_editor.image_file_height
} %>
<%= f.hidden_field :link, data: { link_value: true }, id: nil %>
<%= f.hidden_field :link_title, data: { link_title: true }, id: nil %>
<%= f.hidden_field :link_class_name, data: { link_class: true }, id: nil %>
<%= f.hidden_field :link_target, data: { link_target: true }, id: nil %>
<%= f.hidden_field :crop_from, data: { crop_from: true }, id: picture_editor.form_field_id(:crop_from) %>
<%= f.hidden_field :crop_size, data: { crop_size: true }, id: picture_editor.form_field_id(:crop_size) %>
<% end %>
<% end %>