Method: Tolaria::FormBuildable#image_field
- Defined in:
- lib/tolaria/form_buildable.rb
#image_field(method, options = {}) ⇒ Object
Returns an image upload field with a more pleasant interface than browser
file inputs. Changes messaging if the method
already exists.
Special Options
:preview_url
If the file already exists, provide a URL to a 42×42px version of the image, and it will be displayed to the user in a preview box to better communicate which file they are replacing.
Other options are forwarded to the hidden file_field
.
81 82 83 84 85 86 87 88 |
# File 'lib/tolaria/form_buildable.rb', line 81 def image_field(method, = {}) render(partial:"admin/shared/forms/image_field", locals: { f: self, method: method, options: , preview_url: [:preview_url] }) end |