Module: Card::Set::All::Editor::HtmlFormat

Extended by:
Card::Set::AbstractFormat
Defined in:
platypus/tmp/set/gem-defaults/mod011-edit/all/editor.rb

Instance Method Summary collapse

Instance Method Details

#default_input_typeObject



45
46
47
# File 'platypus/tmp/set/gem-defaults/mod011-edit/all/editor.rb', line 45

def default_input_type
  :rich_text
end

#hidden_inputObject



62
63
64
# File 'platypus/tmp/set/gem-defaults/mod011-edit/all/editor.rb', line 62

def hidden_input
  hidden_field :content, class: classy("d0-card-content")
end

#input_defined_by_cardObject

core view of card is input



25
26
27
28
29
# File 'platypus/tmp/set/gem-defaults/mod011-edit/all/editor.rb', line 25

def input_defined_by_card
  with_card input_type do |input_card|
    nest input_card, view: :core
  end
end

#input_method(input_type) ⇒ Object



20
21
22
# File 'platypus/tmp/set/gem-defaults/mod011-edit/all/editor.rb', line 20

def input_method input_type
  "#{input_type}_input"
end

#input_typeObject



12
13
14
# File 'platypus/tmp/set/gem-defaults/mod011-edit/all/editor.rb', line 12

def input_type
  voo.input_type.present? ? voo.input_type : input_type_from_rule
end

#input_type_from_ruleObject



16
17
18
# File 'platypus/tmp/set/gem-defaults/mod011-edit/all/editor.rb', line 16

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

#placeholder_textObject

for override (placeholder for placeholders)



67
68
69
# File 'platypus/tmp/set/gem-defaults/mod011-edit/all/editor.rb', line 67

def placeholder_text
  ""
end

#rich_text_inputObject



49
50
51
# File 'platypus/tmp/set/gem-defaults/mod011-edit/all/editor.rb', line 49

def rich_text_input
  send "#{Cardio.config.rich_text_editor || :text_area}_editor_input"
end

#text_area_inputObject



53
54
55
56
# File 'platypus/tmp/set/gem-defaults/mod011-edit/all/editor.rb', line 53

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

#text_field_inputObject



58
59
60
# File 'platypus/tmp/set/gem-defaults/mod011-edit/all/editor.rb', line 58

def text_field_input
  text_field :content, class: classy("d0-card-content"), placeholder: placeholder_text
end

#view: inputObject



39
40
41
42
43
# File 'platypus/tmp/set/gem-defaults/mod011-edit/all/editor.rb', line 39

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

#with_card(mark) ⇒ Object

move somewhere more accessible?



32
33
34
35
36
37
# File 'platypus/tmp/set/gem-defaults/mod011-edit/all/editor.rb', line 32

def with_card mark
  card = Card[mark]
  yield card if card
rescue Card::Error::CodenameNotFound
  nil
end