Accept only image files

Leaving the more specific validation in the Rails model (rather than try to duplicate it).
This commit is contained in:
David Cook
2024-01-12 14:11:15 +11:00
parent 88c840b3ee
commit 471dadeaec

View File

@@ -13,4 +13,4 @@
%input{ class: "secondary", type: 'button', value: t('.close'), "data-action": "click->modal#close" }
-# label.button provides a handy shortcut to open the file selector on click. Unfortunately this trick isn't keyboard accessible though..
= f.label :attachment, t(".upload"), class: "button primary icon-upload-alt"
= f.file_field :attachment, style: "display: none", "data-action": "change->form#submit"
= f.file_field :attachment, accept: "image/*", style: "display: none", "data-action": "change->form#submit"