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



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

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



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

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



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

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



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

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



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

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

#section_title(title) ⇒ Object



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

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