Class: DesignSystem::Generic::Builders::Details
- Defined in:
- lib/design_system/generic/builders/details.rb
Overview
This builds a generic details component with brand-specific classes
Direct Known Subclasses
DesignSystem::Govuk::Builders::Details, Nhsuk::Builders::Details
Instance Method Summary collapse
Methods inherited from Base
Methods included from Helpers::CssHelper
Methods included from Concerns::BrandDerivable
Constructor Details
This class inherits a constructor from DesignSystem::Generic::Builders::Base
Instance Method Details
#render_details(summary_text) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/design_system/generic/builders/details.rb', line 8 def render_details(summary_text) content = capture { yield if block_given? } content_tag(:details, class: "#{brand}-details") do safe_buffer = ActiveSupport::SafeBuffer.new safe_buffer.concat( content_tag(:summary, class: "#{brand}-details__summary") do content_tag(:span, summary_text, class: "#{brand}-details__summary-text") end ) safe_buffer.concat( content_tag(:div, content, class: "#{brand}-details__text") ) safe_buffer end end |