Class: Forma::ImageField
- Inherits:
-
SimpleField
- Object
- Field
- SimpleField
- Forma::ImageField
- Defined in:
- lib/forma/field.rb
Overview
Image upload field.
Instance Attribute Summary
Attributes inherited from Field
#actions, #after, #autofocus, #before, #child_model_name, #height, #hint, #i18n, #icon, #label, #model, #model_name, #name, #parent, #readonly, #required, #tag, #url, #value, #width
Instance Method Summary collapse
Methods inherited from SimpleField
#errors, #has_errors?, #initialize, #value
Methods inherited from Field
#action, #id, #initialize, #localization_key, #localized_hint, #localized_label, #name_as_chain, #parameter_name, #to_html
Methods included from Html
Methods included from Utils
extract_value, #simple_value, singular_name
Constructor Details
This class inherits a constructor from Forma::SimpleField
Instance Method Details
#edit_element(val) ⇒ Object
376 377 378 379 380 381 |
# File 'lib/forma/field.rb', line 376 def edit_element(val) el('input', attrs: { name: parameter_name, type: 'file', }) end |
#view_element(val) ⇒ Object
372 373 374 |
# File 'lib/forma/field.rb', line 372 def view_element(val) el('img', attrs: { src: val.url } ) end |