Sha256: c687043065f8fda5f5cadb1873c5e5873e8935a72065b3ba2db49347dc43c611
Contents?: true
Size: 1.11 KB
Versions: 2
Compression:
Stored size: 1.11 KB
Contents
module Effective module FormInputs class Editor < Effective::FormInput def build_input(&block) content = value.presence || (capture(&block) if block_given?) @builder.super_text_field(name, options[:input]) + content_tag(:div, '', class: 'ql-effective', id: unique_id + '_editor') end def input_html_options { class: 'effective_editor form-control', id: unique_id } end def input_js_options { modules: { toolbar: toolbar }, theme: 'snow', placeholder: "Add #{name.to_s.pluralize}...", delta: delta? } end def toolbar [ [{'header': [1, 2, 3, 4, false] }], ['bold', 'italic', 'underline'], ['link', 'image', 'video', 'code-block'], [{'list': 'ordered'}, { 'list': 'bullet' }], [{'align': [] }, 'clean'], ] end def delta? # default false return @delta unless @delta.nil? if options.key?(:html) @delta = (options.delete(:html) == false) else @delta = (options.delete(:delta) || false) end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
effective_bootstrap-0.0.29 | app/models/effective/form_inputs/editor.rb |
effective_bootstrap-0.0.28 | app/models/effective/form_inputs/editor.rb |