Class: AgileFormFields::HtmlField
- Inherits:
-
AgileFormField
- Object
- AgileFormField
- AgileFormFields::HtmlField
- Defined in:
- app/models/agile_form_fields/html_field.rb
Overview
Implementation of html_field AgileRails form field.
HtmlField class only implements code for calling actual html edit field code. This is by default agile_rails_html_editor gem which uses CK editor javascript plugin or any other plugin. Which plugin will be used as html editor is defined by ar_site.settings html_editor setting.
Example of ar_site.setting used for agile_rails_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 AgileFormField
Instance Method Summary collapse
-
#render ⇒ Object
Render html_field AgileRails form field code.
Methods inherited from AgileFormField
get_data, #hash_to_options, #html, #initialize, #options_to_hash, #record_text_for, #ro_standard, #set_css_code, #set_default_value, #set_initial_value, #set_style, #t
Constructor Details
This class inherits a constructor from AgileFormFields::AgileFormField
Instance Method Details
#render ⇒ Object
Render html_field AgileRails form field code
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'app/models/agile_form_fields/html_field.rb', line 51 def render # html editor is defined on site params editor_string = @env.agile_get_site.params['html_editor'] if @env.agile_get_site editor_string ||= 'ckeditor' klas_string = editor_string.camelize if AgileFormFields.const_defined?(klas_string) klas = AgileFormFields::const_get(klas_string) o = klas.new(@env, @record, @yaml).render @js += o.js @html += o.html else @html += 'HTML editor not defined. Check site.settings or include agile_rails_html_editor gem.' end self end |