Module: Card::Set::All::Guide::HtmlFormat

Extended by:
Card::Set::AbstractFormat
Defined in:
card/tmpsets/set/mod027-card-mod-help/all/guide.rb,
card/tmpsets/set/mod028-card-mod-help/all/guide.rb

Instance Method Summary collapse

Instance Method Details

#alert_guideObject



32
33
34
35
36
37
# File 'card/tmpsets/set/mod027-card-mod-help/all/guide.rb', line 32

def alert_guide
  guide_text = guide
  return "" unless guide_text.present?

  alert(:secondary, true, false, class: "guide") { guide_text }
end

#guideObject



21
22
23
24
25
26
27
28
29
30
# File 'card/tmpsets/set/mod027-card-mod-help/all/guide.rb', line 21

def guide
  guide_text = rule_based_guide
  return "" unless guide_text.present?

  if (rule_card = card.help_rule_card)
    edit_link = with_nest_mode(:normal) { nest(rule_card, view: :edit_link) }
    guide_text = "<span class='d-none'>#{edit_link}</span>#{guide_text}"
  end
  wrap_with :div, guide_text, class: classy("guide-text")
end

#raw_guide_textObject



39
40
41
# File 'card/tmpsets/set/mod027-card-mod-help/all/guide.rb', line 39

def raw_guide_text
  false
end

#rule_based_guideObject



43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'card/tmpsets/set/mod027-card-mod-help/all/guide.rb', line 43

def rule_based_guide
  if raw_guide_text
    with_nest_mode :normal do
      process_content raw_guide_text, chunk_list: :references
      # render guide text with current card's format
      # so current card's context is used in guide card nests
    end
  elsif card.guide_card
    with_nest_mode :normal do
      nest card.guide_card, view: :core
    end
  else
    ""
  end
end

#view: guideObject



17
18
19
# File 'card/tmpsets/set/mod027-card-mod-help/all/guide.rb', line 17

view :guide, unknown: true, cache: :never, wrap: :slot do
  guide
end