thumb fix 2
This commit is contained in:
@@ -54,15 +54,14 @@ ActiveAdmin.register Software do
|
||||
|
||||
f.inputs "Images" do
|
||||
f.has_many :software_images, allow_destroy: true, new_record: true do |si|
|
||||
if si.object.image_id.present? && si.object.image && File.exist?(si.object.image.file_path)
|
||||
si.template.content_tag(:div, style: "margin-bottom:10px;padding:8px;background:#f5f5f5;border-radius:4px;text-align:center;") do
|
||||
si.template.image_tag("/api/image/#{si.object.image_id}", style: "max-height:80px;max-width:160px;object-fit:contain;")
|
||||
end
|
||||
img_hint = if si.object.image_id.present?
|
||||
si.template.image_tag("/api/image/#{si.object.image_id}", style: "max-height:80px;max-width:160px;object-fit:contain;margin-top:6px;").html_safe
|
||||
end
|
||||
si.input :file_upload, as: :file, label: "Upload new image", hint: "Or select existing below"
|
||||
si.input :image_id, as: :select, label: "Existing image",
|
||||
si.input :image_id, as: :select, label: "Image",
|
||||
collection: Image.order(:original_filename).map { |img| [img.original_filename, img.id] },
|
||||
include_blank: "— select —"
|
||||
include_blank: "— select —",
|
||||
hint: img_hint
|
||||
si.input :file_upload, as: :file, label: "Upload new image"
|
||||
si.input :is_default, as: :boolean
|
||||
si.input :position, as: :number, input_html: { min: 0 }
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user