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

Extended by:
AbstractFormat
Defined in:
tmpsets/set/mod022-rules/type/set/html_views.rb

Instance Method Summary collapse

Instance Method Details

#rule_table_row(setting) ⇒ Object



59
60
61
62
63
64
65
66
67
# File 'tmpsets/set/mod022-rules/type/set/html_views.rb', line 59

def rule_table_row setting
  return "" unless show_view? setting

  rule_card = card.fetch trait: setting, new: {}
  row_view, optional_content =
    voo.hide?(:content) ? %i[rule_link hide] : %i[rule_row show]

  nest(rule_card, view: row_view, optional_content => :content).html_safe
end

#rules_table(settings) ⇒ Object



51
52
53
54
55
56
57
# File 'tmpsets/set/mod022-rules/type/set/html_views.rb', line 51

def rules_table settings
  class_up "card-slot", "rules-table"
  wrap do
    haml :rules_table, settings: settings,
                       item_view: voo.show?(:content) ? :closed_rule : :rule_link
  end
end

#setting_groupObject



35
36
37
# File 'tmpsets/set/mod022-rules/type/set/html_views.rb', line 35

def setting_group
  voo&.filter&.to_sym || params[:group]&.to_sym || :common
end

#table_rules_filterObject



21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'tmpsets/set/mod022-rules/type/set/html_views.rb', line 21

def table_rules_filter
  form_tag path(view: :rules_table, slot: { show: :content }),
           remote: true, method: "get", role: "filter",
           "data-slot-selector": ".card-slot.rules-table",
           class: classy("nodblclick slotter form-inline slim-select2 m-2") do
    output [
      label_tag(:view, icon_tag("filter_list"), class: "mr-2"),
      setting_select,
      (:span, "rules that apply to #{_render_set_label}".html_safe,
                  class: "mx-2 small")
    ]
  end
end