Module: Card::Set::All::Help::HtmlFormat

Extended by:
Card::Set::AbstractFormat
Defined in:
platypus/tmp/set/gem-defaults/mod008-help/all/help.rb

Instance Method Summary collapse

Instance Method Details

#help_textObject



39
40
41
# File 'platypus/tmp/set/gem-defaults/mod008-help/all/help.rb', line 39

def help_text
  voo.help || rule_based_help
end

#raw_help_textObject



43
44
45
# File 'platypus/tmp/set/gem-defaults/mod008-help/all/help.rb', line 43

def raw_help_text
  card.try(:raw_help_text) || card.help_rule_card&.content
end

#rule_based_helpObject



47
48
49
50
51
52
53
54
55
# File 'platypus/tmp/set/gem-defaults/mod008-help/all/help.rb', line 47

def rule_based_help
  return "" unless (help_text = raw_help_text)

  with_nest_mode :normal do
    process_content help_text, chunk_list: :references
    # render help card with current card's format
    # so current card's context is used in help card nests
  end
end

#view: helpObject



14
15
16
17
18
19
# File 'platypus/tmp/set/gem-defaults/mod008-help/all/help.rb', line 14

view :help, unknown: true, cache: :never, wrap: :slot do
  help = help_text
  return "" unless help.present?

  wrap_with :div, wrap_help_text(help), class: classy("help-text")
end

#view: help_textObject



21
22
23
# File 'platypus/tmp/set/gem-defaults/mod008-help/all/help.rb', line 21

view :help_text, unknown: true, cache: :never do
  wrap_help_text help_text
end

#view: leadObject



34
35
36
37
# File 'platypus/tmp/set/gem-defaults/mod008-help/all/help.rb', line 34

view :lead do
  class_up "card-slot", "lead"
  _view_content
end

#wrap_help_text(text) ⇒ Object



25
26
27
28
29
30
31
32
# File 'platypus/tmp/set/gem-defaults/mod008-help/all/help.rb', line 25

def wrap_help_text text
  help = text
  if (rule_card = card.help_rule_card)
    edit_link = with_nest_mode(:normal) { nest(rule_card, view: :edit_link) }
    help = "<span class='d-none'>#{edit_link}</span>#{text}"
  end
  help
end