Refactor diary entry forms to use a custom form builder

This commit is contained in:
Andy Allan 2020-12-24 13:31:04 +00:00
parent 170ea3399b
commit 547459314b
9 changed files with 92 additions and 49 deletions

View file

@ -0,0 +1,15 @@
class RichtextFormBuilder < BootstrapForm::FormBuilder
def richtext_field(attribute, options = {})
id = "#{@object_name}_#{attribute}"
type = options.delete(:format) || "markdown"
@template.render(:partial => "shared/richtext_field",
:locals => { :object => @object,
:attribute => attribute,
:object_name => @object_name,
:id => id,
:type => type,
:options => options,
:builder => self })
end
end