Sha256: 6ecbe15d26c2aab2455df8dd6b2fa7116ef9f747fa2bcbc4b9285fbbfbff2cea

Contents?: true

Size: 1.72 KB

Versions: 10

Compression:

Stored size: 1.72 KB

Contents

<%
  # headmin/forms/redactorx
  #
  # ==== Options
  # * <tt>form<tt> - Form object
  # * <tt>attribute<tt> - Name of the attribute of the form model
  # * <tt>label<tt> - Text to show as label. Label will be hidden if value is false
  # * <tt>addbar<tt> - Items to show in the addbar
  # * <tt>topbar<tt> - Items to show in the topbar
  # * <tt>plugins<tt> - Plugin items to work with
  #
  # ==== Examples
  #   Basic version
  #   <%= render 'headmin/forms/textarea', form: form, attribute: :title %#>

  class_names = local_assigns.has_key?(:class) ? local_assigns[:class] : false
  data = local_assigns.has_key?(:data) ? data : {}
  disabled = local_assigns.has_key?(:disabled) ? disabled : false
  label = local_assigns.has_key?(:label) ? label : nil
  readonly = local_assigns.has_key?(:readonly) ? readonly : false
  required = local_assigns.has_key?(:required) ? required : false
  addbar = local_assigns.has_key?(:addbar) ? addbar : ['paragraph', 'image', 'embed', 'table', 'quote', 'pre', 'line']
  plugins = local_assigns.has_key?(:plugins) ? plugins : ['shortcut']
  topbar = local_assigns.has_key?(:topbar) ? topbar : []

  data = data.merge(
    'redactor-options': {
      buttons: {
        addbar: addbar,
        plugins: plugins,
        topbar: topbar,
      }
    }
  )

  options = {
    'aria-describedby': form_field_validation_id(form, attribute),
    class: "form-control redactorx #{form_field_validation_class(form, attribute)} #{class_names}",
    data: data,
    disabled: disabled,
    placeholder: attribute,
    readonly: readonly,
    required: required,
  }
%>

<%= render 'headmin/forms/base', form: form, attribute: attribute, label: label, required: required do |form| %>
  <%= form.text_area(attribute, options) %>
<% end %>

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
headmin-0.2.9 app/views/headmin/forms/_redactorx.html.erb
headmin-0.2.8 app/views/headmin/forms/_redactorx.html.erb
headmin-0.2.7 app/views/headmin/forms/_redactorx.html.erb
headmin-0.2.6 app/views/headmin/forms/_redactorx.html.erb
headmin-0.2.5 app/views/headmin/forms/_redactorx.html.erb
headmin-0.2.4 app/views/headmin/forms/_redactorx.html.erb
headmin-0.2.3 app/views/headmin/forms/_redactorx.html.erb
headmin-0.2.2 app/views/headmin/forms/_redactorx.html.erb
headmin-0.2.1 app/views/headmin/forms/_redactorx.html.erb
headmin-0.2.0 app/views/headmin/forms/_redactorx.html.erb