Class: DesignSystem::Generic::Builders::FixedElements

Inherits:
Base
  • Object
show all
Includes:
Elements::Backlink, Elements::Breadcrumbs, Elements::Form, Elements::Headings, Elements::LeadParagraph
Defined in:
lib/design_system/generic/builders/fixed_elements.rb

Overview

This class is used to provide the generic fixed elements builder.

Instance Method Summary collapse

Methods included from Elements::LeadParagraph

#lead_paragraph

Methods included from Elements::Headings

#main_heading

Methods included from Elements::Form

#form

Methods included from Elements::Breadcrumbs

#breadcrumb

Methods included from Elements::Backlink

#backlink

Methods inherited from Base

#initialize

Methods included from Helpers::CssHelper

#css_class_options_merge

Methods included from Concerns::BrandDerivable

#brand

Constructor Details

This class inherits a constructor from DesignSystem::Generic::Builders::Base

Instance Method Details

#renderObject

Raises:

  • (ArgumentError)


14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/design_system/generic/builders/fixed_elements.rb', line 14

def render
  raise ArgumentError, 'Cannot use both backlink and breadcrumbs' if @backlink && @breadcrumbs.present?

  content_for_breadcrumbs if @breadcrumbs.present?
  content_for_backlink if @backlink.present?

  render_main_container do
    safe_buffer = ActiveSupport::SafeBuffer.new

    safe_buffer.concat(render_main_heading) if @main_heading
    safe_buffer.concat(render_lead_paragraph) if @lead_paragraph
    safe_buffer.concat(render_form) if @form_object

    safe_buffer
  end
end