Sha256: fea1623ac322ba16394920b67d0a5b20555b8d390396dd667f5af893a7464313

Contents?: true

Size: 1.2 KB

Versions: 13

Compression:

Stored size: 1.2 KB

Contents

include_set Abstract::ProsemirrorEditor
include_set Abstract::TinymceEditor
include_set Abstract::AceEditor

Self::InputOptions.add_to_basket :options, "text area"
Self::InputOptions.add_to_basket :options, "text field"
Self::InputOptions.add_to_basket :options, "calendar"

format :html do
  def editor
    (c = card.rule(:input)) && c.gsub(/[\[\]]/, "").tr(" ", "_")
  end

  def editor_method editor_type
    "#{editor_type}_input"
  end

  def editor_defined_by_card
    return unless (editor_card = Card[editor])
    nest editor_card, view: :core
  end

  view :editor do
    try(editor_method(editor)) ||
      editor_defined_by_card ||
      send(editor_method(default_editor))
  end

  def default_editor
    :rich_text
  end

  # overridden by mods that provide rich text editors
  def rich_text_input
    default_editor = Cardio.config.rich_text_editor || :tinymce
    send "#{default_editor}_editor_input"
  end

  def text_area_input
    text_area :content, rows: 5, class: "d0-card-content",
                        "data-card-type-code" => card.type_code
  end

  def text_field_input
    text_field :content, class: "d0-card-content"
  end

  def calendar_input
    text_field :content, class: "date-editor"
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
card-1.94.1 mod/standard/set/all/rich_html/editor.rb
card-1.94.0 mod/standard/set/all/rich_html/editor.rb
card-1.93.13 mod/standard/set/all/rich_html/editor.rb
card-1.93.12 mod/standard/set/all/rich_html/editor.rb
card-1.93.11 mod/standard/set/all/rich_html/editor.rb
card-1.93.10 mod/standard/set/all/rich_html/editor.rb
card-1.93.9 mod/standard/set/all/rich_html/editor.rb
card-1.93.8 mod/standard/set/all/rich_html/editor.rb
card-1.93.7 mod/standard/set/all/rich_html/editor.rb
card-1.93.6 mod/standard/set/all/rich_html/editor.rb
card-1.93.5 mod/standard/set/all/rich_html/editor.rb
card-1.93.4 mod/standard/set/all/rich_html/editor.rb
card-1.93.3 mod/standard/set/all/rich_html/editor.rb