Refactor diary entry forms to use a custom form builder
This commit is contained in:
parent
170ea3399b
commit
547459314b
9 changed files with 92 additions and 49 deletions
15
lib/richtext_form_builder.rb
Normal file
15
lib/richtext_form_builder.rb
Normal 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
|
Loading…
Add table
Add a link
Reference in a new issue