I use CMS for refineries with refinierycms-blog and refinerycms -pages-images , and I would like to add a new custom field to each image (there is a header field by default).
I started the database migration, so there is a field on refinery_image_pages to store the value and edited refinery / admin / pages / tabs / _image_field.html.erb to show this field:
<%= text_field_tag "#{f.object_name.demodulize}[images_attributes][#{index}][image_margin_top]",
( image_margin_topis my custom field.)
My question consists of two partners:
How can I get the image_margin_top value to save in db when submitting the blog editing form? I assume that I may have to edit one of the main models?
How can I display image_margin_top value in admin form? The default header field uses the utility method in _image_field.html.erb-
f.object.caption_for_image_index(index)
I would like to create a method image_margin_top_for_image_index(), but I donβt know where to do it.
Many thanks
source
share