Module: Card::Set::All::Admin::HtmlFormat

Extended by:
Card::Set::AbstractFormat
Defined in:
platypus/tmp/set/gem-card/mod001-core/all/admin.rb

Instance Method Summary collapse

Instance Method Details

#accordion_sections(grouped_items) ⇒ Object



96
97
98
99
100
101
102
103
104
105
106
# File 'platypus/tmp/set/gem-card/mod001-core/all/admin.rb', line 96

def accordion_sections grouped_items
  return unless grouped_items.present?

  grouped_items.map do |title, codenames|
    accordion_item(title,
                   subheader: nil,
                   body: list_section_content(codenames),
                   open: false,
                   context: title.hash)
  end.join " "
end

#list_section(title, items, item_view = :bar) ⇒ Object



83
84
85
86
87
# File 'platypus/tmp/set/gem-card/mod001-core/all/admin.rb', line 83

def list_section title, items, item_view=:bar
  return unless items.present?

  section title, list_section_content(items, item_view)
end

#list_section_content(items, item_view = :bar) ⇒ Object



108
109
110
111
112
# File 'platypus/tmp/set/gem-card/mod001-core/all/admin.rb', line 108

def list_section_content items, item_view=:bar
  items&.map do |card|
    nest card, view: item_view
  end&.join(" ")
end

#nested_list_section(title, grouped_items) ⇒ Object



89
90
91
92
93
94
# File 'platypus/tmp/set/gem-card/mod001-core/all/admin.rb', line 89

def nested_list_section title, grouped_items
  output [
    section_title(title),
    wrap_with(:div, accordion_sections(grouped_items), class: "accordion")
  ]
end

#section(title, content) ⇒ Object



75
76
77
# File 'platypus/tmp/set/gem-card/mod001-core/all/admin.rb', line 75

def section title, content
  "<p>#{section_title(title)}#{content}</p>"
end

#section_title(title) ⇒ Object



79
80
81
# File 'platypus/tmp/set/gem-card/mod001-core/all/admin.rb', line 79

def section_title title
  "<h3>#{title}</h3>"
end