format :html do def accordion_group list, collapse_id=nil, args={} collapse_id ||= card.name.safe_key accordions = "" index = 1 case list when Array then accordions = list.join when String then accordions = list else list.each_pair do |title, content| accordions << accordion(title, content, "#{collapse_id}-#{index}") index += 1 end end add_class args, "act-accordion-group w-100" wrap_with :div, class: args[:class], id: "accordion-#{collapse_id}", role: "tablist", "aria-multiselectable" => "true" do accordions end end def accordion title, content, collapse_id=card.name.safe_key accordion_content = case content when Hash then accordion_group(content, collapse_id) when Array then content.present? && list_group(content) when String then content end <<-HTML.html_safe