]> git.openstreetmap.org Git - rails.git/blob - lib/richtext_form_builder.rb
Refactor diary entry forms to use a custom form builder
[rails.git] / lib / richtext_form_builder.rb
1 class RichtextFormBuilder < BootstrapForm::FormBuilder
2   def richtext_field(attribute, options = {})
3     id = "#{@object_name}_#{attribute}"
4     type = options.delete(:format) || "markdown"
5
6     @template.render(:partial => "shared/richtext_field",
7                      :locals => { :object => @object,
8                                   :attribute => attribute,
9                                   :object_name => @object_name,
10                                   :id => id,
11                                   :type => type,
12                                   :options => options,
13                                   :builder => self })
14   end
15 end