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

Extended by:
Card::Set::AbstractFormat
Defined in:
card/tmpsets/set/mod012-card-mod-edit/all/editor.rb,
card/tmpsets/set/mod011-card-mod-edit/all/editor.rb

Instance Method Summary collapse

Instance Method Details

#default_input_typeObject



47
48
49
# File 'card/tmpsets/set/mod012-card-mod-edit/all/editor.rb', line 47

def default_input_type
  :rich_text
end

#input_defined_by_cardObject

core view of card is input



26
27
28
29
30
# File 'card/tmpsets/set/mod012-card-mod-edit/all/editor.rb', line 26

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

#input_method(input_type) ⇒ Object



21
22
23
# File 'card/tmpsets/set/mod012-card-mod-edit/all/editor.rb', line 21

def input_method input_type
  "#{input_type}_input"
end

#input_typeObject



13
14
15
# File 'card/tmpsets/set/mod012-card-mod-edit/all/editor.rb', line 13

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

#input_type_from_ruleObject



17
18
19
# File 'card/tmpsets/set/mod012-card-mod-edit/all/editor.rb', line 17

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

#rich_text_inputObject



51
52
53
# File 'card/tmpsets/set/mod012-card-mod-edit/all/editor.rb', line 51

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

#text_area_inputObject



55
56
57
58
# File 'card/tmpsets/set/mod012-card-mod-edit/all/editor.rb', line 55

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

#text_field_inputObject



60
61
62
# File 'card/tmpsets/set/mod012-card-mod-edit/all/editor.rb', line 60

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

#view: inputObject



41
42
43
44
45
# File 'card/tmpsets/set/mod012-card-mod-edit/all/editor.rb', line 41

view :input, unknown: true 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?



33
34
35
36
37
38
39
# File 'card/tmpsets/set/mod012-card-mod-edit/all/editor.rb', line 33

def with_card mark
  return nil unless (card = Card[mark])

  yield card
rescue Card::Error::CodenameNotFound
  nil
end