Sha256: 0fe2450d4120610ec24f7b44a8954c363cf7b290b8c953bea943312873675065

Contents?: true

Size: 1.39 KB

Versions: 17

Compression:

Stored size: 1.39 KB

Contents

/ Example:
/   = wcms_component "forms/redactor_editor",
/     form: f,
/     attribute: :body,
/     add_buttons: ['link']
/


ruby:
  # Default Parameters
  form ||= nil
  attribute ||= nil  # attribute name that the editor should be attached to
  add_class ||= ""   # string of additional classes that get appended to class
  input_class ||= "form-control redactor #{add_class}"
  value ||= nil     # only used if form is nil
  allow_divs ||= nil

  # Configure buttons
  buttons ||= BiolaWcmsComponents.config.default_redactor_buttons
  add_buttons ||= []      # adds to defaults
  remove_buttons ||= []   # removes from default
  buttons = Array(buttons) + Array(add_buttons) - Array(remove_buttons)
  buttons << 'html' if current_user.try(:admin?) || current_user.try(:developer?) || current_user.try(:designer?)
  buttons << 'fullscreen'

  formatting ||= []
  buttons.unshift 'formatting' if formatting.length > 0


  # Turn buttons and formatting into a string and remove duplicates
  buttons = buttons.uniq.join(' ')
  formatting = formatting.uniq.join(' ')

= wcms_component "shared/embedded_image_uploader"

- if form
  = form.text_area attribute, class: input_class, 'data-buttons' => buttons, 'data-formatting' => formatting, 'data-allow-divs' => allow_divs
- else
  = text_area_tag attribute, value, class: input_class, 'data-buttons' => buttons, 'data-formatting' => formatting, 'data-allow-divs' => allow_divs

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
biola_wcms_components-0.22.0 app/views/wcms_components/forms/_redactor_editor.html.slim
biola_wcms_components-0.21.0 app/views/wcms_components/forms/_redactor_editor.html.slim
biola_wcms_components-0.20.0 app/views/wcms_components/forms/_redactor_editor.html.slim
biola_wcms_components-0.19.0 app/views/wcms_components/forms/_redactor_editor.html.slim
biola_wcms_components-0.18.1 app/views/wcms_components/forms/_redactor_editor.html.slim
biola_wcms_components-0.18.0 app/views/wcms_components/forms/_redactor_editor.html.slim
biola_wcms_components-0.17.0 app/views/wcms_components/forms/_redactor_editor.html.slim
biola_wcms_components-0.16.0 app/views/wcms_components/forms/_redactor_editor.html.slim
biola_wcms_components-0.15.3 app/views/wcms_components/forms/_redactor_editor.html.slim
biola_wcms_components-0.15.2 app/views/wcms_components/forms/_redactor_editor.html.slim
biola_wcms_components-0.15.1 app/views/wcms_components/forms/_redactor_editor.html.slim
biola_wcms_components-0.15.0 app/views/wcms_components/forms/_redactor_editor.html.slim
biola_wcms_components-0.14.0 app/views/wcms_components/forms/_redactor_editor.html.slim
biola_wcms_components-0.13.0 app/views/wcms_components/forms/_redactor_editor.html.slim
biola_wcms_components-0.12.0 app/views/wcms_components/forms/_redactor_editor.html.slim
biola_wcms_components-0.11.0 app/views/wcms_components/forms/_redactor_editor.html.slim
biola_wcms_components-0.10.0 app/views/wcms_components/forms/_redactor_editor.html.slim