Class: Effective::FormInputs::CkEditor
Constant Summary
Effective::FormInput::BLANK, Effective::FormInput::EXCLUSIVE_CLASS_PREFIXES, Effective::FormInput::EXCLUSIVE_CLASS_SUFFIXES
Instance Attribute Summary
#name, #options
Instance Method Summary
collapse
#feedback_options, #hint_options, #initialize, #input_group_options, #label_options, #to_html, #wrapper_options
Instance Method Details
5
6
7
8
|
# File 'app/models/effective/form_inputs/ck_editor.rb', line 5
def build_input(&block)
content = value.presence || (capture(&block) if block_given?)
@builder.super_text_area(name, (options[:input] || {}).merge(autocomplete: 'off'))
end
|
#contentsCss ⇒ Object
25
26
27
28
29
30
31
32
|
# File 'app/models/effective/form_inputs/ck_editor.rb', line 25
def contentsCss
@contents_css ||= case (obj = options.delete(:contentsCss))
when :bootstrap
'https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css'
when false then nil
else obj || asset_path('application.css')
end
end
|
#height ⇒ Object
38
39
40
|
# File 'app/models/effective/form_inputs/ck_editor.rb', line 38
def height
@height ||= options.delete(:height)
end
|
10
11
12
|
# File 'app/models/effective/form_inputs/ck_editor.rb', line 10
def input_html_options
{ class: 'effective_ck_editor form-control', id: unique_id }
end
|
14
15
16
17
18
19
20
21
22
23
|
# File 'app/models/effective/form_inputs/ck_editor.rb', line 14
def input_js_options
{
effective_ckeditor_js_path: asset_path('effective_ckeditor.js'),
effective_ckeditor_css_path: asset_path('effective_ckeditor.css'),
contentsCss: contentsCss,
toolbar: toolbar,
height: height,
width: width
}.compact
end
|
34
35
36
|
# File 'app/models/effective/form_inputs/ck_editor.rb', line 34
def toolbar
@toolbar ||= (options.delete(:toolbar) || :full)
end
|
#width ⇒ Object
42
43
44
|
# File 'app/models/effective/form_inputs/ck_editor.rb', line 42
def width
@width ||= options.delete(:width)
end
|