Module: Card::Set::Type::Set::HtmlViews::RuleLists::HtmlFormat

Extended by:
AbstractFormat
Defined in:
card/tmpsets/set/mod036-card-mod-rules/type/set/html_views/rule_lists.rb,
card/tmpsets/set/mod037-card-mod-rules/type/set/html_views/rule_lists.rb

Instance Method Summary collapse

Instance Method Details

#bar_rule_list(settings) ⇒ Object



33
34
35
36
37
# File 'card/tmpsets/set/mod036-card-mod-rules/type/set/html_views/rule_lists.rb', line 33

def bar_rule_list settings
  list_items =
    settings.map { |setting| rule_list_item setting, :bar, hide: :full_name }
  list_items.join("\n").html_safe
end

#pill_rule_list(settings) ⇒ Object



27
28
29
30
31
# File 'card/tmpsets/set/mod036-card-mod-rules/type/set/html_views/rule_lists.rb', line 27

def pill_rule_list settings
  list_items =
    settings.map { |setting| rule_list_item setting, :rule_bridge_link }
  bridge_pills list_items
end

#quick_edit_rule_list(settings) ⇒ Object



21
22
23
24
25
# File 'card/tmpsets/set/mod036-card-mod-rules/type/set/html_views/rule_lists.rb', line 21

def quick_edit_rule_list settings
  list_tag class: "nav nav-pills flex-column bridge-pills" do
    settings.map { |setting| rule_list_item setting, :quick_edit }
  end
end

#rule_list_item(setting, view, opts = {}) ⇒ Object



39
40
41
42
43
44
# File 'card/tmpsets/set/mod036-card-mod-rules/type/set/html_views/rule_lists.rb', line 39

def rule_list_item setting, view, opts={}
  return "" unless show_view? setting

  rule_card = card.fetch setting, new: {}
  nest(rule_card, opts.merge(view: view)).html_safe
end

#setting_list_from_params(default = :common) ⇒ Object



46
47
48
# File 'card/tmpsets/set/mod036-card-mod-rules/type/set/html_views/rule_lists.rb', line 46

def setting_list_from_params default=:common
  setting_list setting_group(default)
end

#view: bar_rule_listObject



13
14
15
# File 'card/tmpsets/set/mod036-card-mod-rules/type/set/html_views/rule_lists.rb', line 13

view :bar_rule_list, cache: :never, wrap: { slot: { class: "rule-list" } } do
  bar_rule_list setting_list_from_params
end

#view: pill_rule_listObject



17
18
19
# File 'card/tmpsets/set/mod036-card-mod-rules/type/set/html_views/rule_lists.rb', line 17

view :pill_rule_list, cache: :never, wrap: { slot: { class: "rule-list" } } do
  pill_rule_list setting_list_from_params
end

#view: quick_edit_rule_listObject



9
10
11
# File 'card/tmpsets/set/mod036-card-mod-rules/type/set/html_views/rule_lists.rb', line 9

view :quick_edit_rule_list, cache: :never, wrap: { slot: { class: "rule-list" } } do
  quick_edit_rule_list setting_list_from_params(:field_related)
end