Module: BootstrapPagedown::FormBuilder
- Defined in:
- lib/bootstrap_pagedown/form_builder.rb
Instance Method Summary collapse
- #pagedown_custom_attributes(options) ⇒ Object
- #pagedown_default_values(options) ⇒ Object
- #pagedown_editor(method, options = {}) ⇒ Object
Instance Method Details
#pagedown_custom_attributes(options) ⇒ Object
28 29 30 |
# File 'lib/bootstrap_pagedown/form_builder.rb', line 28 def pagedown_custom_attributes( ) .except :skip_preview, :panel_class, :panel_id, :button_bar_id, :button_bar_class, :editor_id, :editor_class, :preview_id, :preview_class end |
#pagedown_default_values(options) ⇒ Object
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/bootstrap_pagedown/form_builder.rb', line 17 def pagedown_default_values( ) [:skip_preview] ||= false [:panel_class] ||= 'wmd-panel' [:button_bar_id] ||= 'wmd-button-bar' [:editor_id] ||= 'wmd-input' [:editor_class] ||= 'wmd-input' [:preview_id] ||= 'wmd-preview' end |
#pagedown_editor(method, options = {}) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/bootstrap_pagedown/form_builder.rb', line 3 def pagedown_editor(method, ={}) = pagedown_default_values = pagedown_custom_attributes @template.content_tag( :div, id: [:panel_id], class: [:panel_class] ) do @template.content_tag( :div, nil, id: [:button_bar_id], class: [:button_bar_class] ) + @template.text_area( @object_name, method, ( ).merge( id: [:editor_id], class: [:editor_class] ) ) + unless [:skip_preview] @template.content_tag :div, nil, id: [:preview_id], class: [:preview_class] end end end |