Module: Card::Set::Rule::BarView::HtmlFormat

Extended by:
AbstractFormat
Defined in:
card/tmpsets/set/mod036-card-mod-rules/rule/bar_view.rb,
card/tmpsets/set/mod037-card-mod-rules/rule/bar_view.rb

Instance Method Summary collapse

Instance Method Details

#bar_titleObject



68
69
70
71
72
# File 'card/tmpsets/set/mod036-card-mod-rules/rule/bar_view.rb', line 68

def bar_title
  return super() if voo.show? :full_name

  linking_to_existing_rule { card.rule_setting_title }
end

#existing_rule_cardObject



12
13
14
# File 'card/tmpsets/set/mod036-card-mod-rules/rule/bar_view.rb', line 12

def existing_rule_card
  @existing_rule_card ||= find_existing_rule_card
end

#rule_infoObject

LOCALIZE



75
76
77
78
79
80
81
# File 'card/tmpsets/set/mod036-card-mod-rules/rule/bar_view.rb', line 75

def rule_info
  return wrap_with(:em, "no existing #{setting_link} rule") unless existing_rule_card

  wrap_with :span,
            "#{rule_setting_link} rule that applies to "\
            "#{rule_set_link existing_rule_card}"
end


87
88
89
90
# File 'card/tmpsets/set/mod036-card-mod-rules/rule/bar_view.rb', line 87

def rule_set_link existing_rule
  count = link_to_card [card.rule_set, :by_name], card.rule_set.count
  "#{link_to_card card.rule_set, existing_rule.trunk&.label&.downcase} (#{count})"
end


83
84
85
# File 'card/tmpsets/set/mod036-card-mod-rules/rule/bar_view.rb', line 83

def rule_setting_link
  link_to_card card.rule_setting, card.rule_setting_name
end

#rule_short_contentObject



61
62
63
64
65
66
# File 'card/tmpsets/set/mod036-card-mod-rules/rule/bar_view.rb', line 61

def rule_short_content
  return "" unless existing_rule_card

  nest existing_rule_card, { view: :one_line_content },
       set_context: card.name.trunk_name
end

#view: barObject



16
17
18
19
# File 'card/tmpsets/set/mod036-card-mod-rules/rule/bar_view.rb', line 16

view :bar, unknown: true do
  voo.hide :bar_nav unless existing_rule_card
  super()
end

#view: bar_bottomObject



41
42
43
44
45
46
47
# File 'card/tmpsets/set/mod036-card-mod-rules/rule/bar_view.rb', line 41

view :bar_bottom, unknown: true do
  if nest_mode == :edit
    current_rule_form
  else
    nest existing_rule_card, view: :core
  end
end

#view: bar_leftObject



53
54
55
# File 'card/tmpsets/set/mod036-card-mod-rules/rule/bar_view.rb', line 53

view :bar_left, unknown: true do
  super()
end

#view: bar_middleObject



49
50
51
# File 'card/tmpsets/set/mod036-card-mod-rules/rule/bar_view.rb', line 49

view :bar_middle, unknown: true do
  rule_info
end

#view: bar_rightObject



57
58
59
# File 'card/tmpsets/set/mod036-card-mod-rules/rule/bar_view.rb', line 57

view :bar_right, unknown: true do
  voo.show?(:bar_bottom) ? rule_info : rule_short_content
end

#view: expanded_barObject



21
22
23
# File 'card/tmpsets/set/mod036-card-mod-rules/rule/bar_view.rb', line 21

view :expanded_bar, unknown: true do
  super()
end

#view: one_line_contentObject



25
26
27
28
29
30
31
32
# File 'card/tmpsets/set/mod036-card-mod-rules/rule/bar_view.rb', line 25

view :one_line_content,
     wrap: { div: { class: "text-muted one-line" } }, unknown: true do
  return render_mini_unknown unless existing_rule_card

  with_nest_mode :compact do
    one_line_content
  end
end

#view: raw_one_line_contentObject



34
35
36
37
38
39
# File 'card/tmpsets/set/mod036-card-mod-rules/rule/bar_view.rb', line 34

view :raw_one_line_content,
     wrap: { div: { class: "text-muted one-line" } }, unknown: true do
  return render_mini_unknown unless existing_rule_card

  raw_one_line_content
end