image tumb in sw edit

This commit is contained in:
2026-07-27 11:28:34 +02:00
parent 2071bedde8
commit e37f6175fc
+5
View File
@@ -52,6 +52,11 @@ 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
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",
collection: Image.order(:original_filename).map { |img| [img.original_filename, img.id] },