Class: Effective::FormInputs::CkEditor
Constant Summary
Effective::FormInput::BLANK, Effective::FormInput::DEFAULT_FEEDBACK_OPTIONS, Effective::FormInput::DEFAULT_INPUT_GROUP_OPTIONS, Effective::FormInput::EMPTY_HASH, Effective::FormInput::EXCLUSIVE_CLASS_PREFIXES, Effective::FormInput::EXCLUSIVE_CLASS_SUFFIXES, Effective::FormInput::HORIZONTAL_LABEL_OPTIONS, Effective::FormInput::HORIZONTAL_WRAPPER_OPTIONS, Effective::FormInput::INLINE_LABEL_OPTIONS, Effective::FormInput::VERTICAL_WRAPPER_OPTIONS
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
7
8
9
10
|
# File 'app/models/effective/form_inputs/ck_editor.rb', line 7
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
27
28
29
30
31
32
33
34
|
# File 'app/models/effective/form_inputs/ck_editor.rb', line 27
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
40
41
42
|
# File 'app/models/effective/form_inputs/ck_editor.rb', line 40
def height
@height ||= options.delete(:height)
end
|
12
13
14
|
# File 'app/models/effective/form_inputs/ck_editor.rb', line 12
def input_html_options
{ class: 'effective_ck_editor form-control', id: unique_id }
end
|
16
17
18
19
20
21
22
23
24
25
|
# File 'app/models/effective/form_inputs/ck_editor.rb', line 16
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
|
36
37
38
|
# File 'app/models/effective/form_inputs/ck_editor.rb', line 36
def toolbar
@toolbar ||= (options.delete(:toolbar) || :full)
end
|
#width ⇒ Object
44
45
46
|
# File 'app/models/effective/form_inputs/ck_editor.rb', line 44
def width
@width ||= options.delete(:width)
end
|