Class: DrgcmsFormFields::HtmlField
- Inherits:
-
DrgcmsField
- Object
- DrgcmsField
- DrgcmsFormFields::HtmlField
- Defined in:
- app/models/drgcms_form_fields.rb
Overview
Implementation of html_field DRG CMS form field.
HtmlField class only implements code for calling actual html edit field code. This is by default drg_default_html_editor gem which uses CK editor javascript plugin or any other plugin. Which plugin will be used as html editor is defined by dc_site.settings html_editor setting.
Example of dc_site.setting used for drg_default_html_editor gem.
html_editor: ckeditor
ck_editor:
config_file: /files/ck_config.js
css_file: /files/ck_css.css
file_select: elfinder
Form example:
10:
name: body
type: html_field
options: "height: 500, width: 550, toolbar: 'basic'"
Instance Attribute Summary
Attributes inherited from DrgcmsField
Instance Method Summary collapse
-
#render ⇒ Object
Render html_field field html code.
Methods inherited from DrgcmsField
get_data, #hash_to_options, #initialize, #record_text_for, #ro_standard, #set_initial_value, #set_style, #t
Constructor Details
This class inherits a constructor from DrgcmsFormFields::DrgcmsField
Instance Method Details
#render ⇒ Object
Render html_field field html code
1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 |
# File 'app/models/drgcms_form_fields.rb', line 1542 def render return ro_standard if @readonly # retrieve html editor from page settings editor_string = @parent.dc_get_site.params['html_editor'] if @parent.dc_get_site editor_string ||= 'ckeditor' # klas_string = editor_string.camelize if DrgcmsFormFields.const_defined?(klas_string) klas = DrgcmsFormFields::const_get(klas_string) o = klas.new(@parent, @record, @yaml).render @js << o.js @html << o.html else @html << "HTML editor not defined. Check site.settings or include drgcms_default_html_editor gem." end self end |