Sha256: 68acf92d98e3d56dc221b6a6f4e97e56b2986106eca35049b88e7a4fb00edb67

Contents?: true

Size: 1.61 KB

Versions: 2

Compression:

Stored size: 1.61 KB

Contents

# -*- encoding : utf-8 -*-
class Card; module Set; class All
# Set: All cards (Editor)
#
module Editor;
extend Card::Set
def self.source_location; "/Users/ethan/dev/decko/gem/card-mod-edit/set/all/editor.rb"; end
Self::InputOptions.add_to_basket :options, "text area"
Self::InputOptions.add_to_basket :options, "text field"

module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
  def input_type
    voo.input_type.present? ? voo.input_type : input_type_from_rule
  end

  def input_type_from_rule
    card.rule(:input_type)&.gsub(/[\[\]]/, "")&.tr(" ", "_")
  end

  def input_method input_type
    "#{input_type}_input"
  end

  # core view of card is input
  def input_defined_by_card
    with_card input_type do |input_card|
      nest input_card, view: :core
    end
  end

  # move somewhere more accessible?
  def with_card mark
    card = Card[mark]
    yield card if card
  rescue Card::Error::CodenameNotFound
    nil
  end

  view :input, unknown: true do
    try(input_method(input_type)) ||
      input_defined_by_card ||
      send(input_method(default_input_type))
  end

  def default_input_type
    :rich_text
  end

  def rich_text_input
    send "#{Cardio.config.rich_text_editor || :text_area}_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: classy("d0-card-content")
  end
end
end;end;end;end;
# ~~ generated from /Users/ethan/dev/decko/gem/card-mod-edit/set/all/editor.rb ~~

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
card-1.101.7 tmpsets/set/mod011-card-mod-edit/all/editor.rb
card-1.101.6 tmpsets/set/mod011-card-mod-edit/all/editor.rb