Class: CCS::Components::GovUK::Footer
- Defined in:
- lib/ccs/components/govuk/footer.rb,
lib/ccs/components/govuk/footer/link.rb,
lib/ccs/components/govuk/footer/meta.rb,
lib/ccs/components/govuk/footer/navigation.rb
Overview
GOV.UK Footer
This is used to generate the footer component from the GDS - Components - Footer
Defined Under Namespace
Classes: Link, Meta, Navigation
Constant Summary collapse
- DEFAULT_ATTRIBUTES =
The default attributes for the breadcrumbs
{ class: 'govuk-footer' }.freeze
Instance Method Summary collapse
-
#initialize(navigation: nil, meta: nil, **options) ⇒ Footer
constructor
A new instance of Footer.
-
#render ⇒ ActiveSupport::SafeBuffer
Generates the HTML for the GOV.UK Footer component.
Constructor Details
#initialize(navigation: nil, meta: nil, **options) ⇒ Footer
Returns a new instance of Footer.
37 38 39 40 41 42 43 44 |
# File 'lib/ccs/components/govuk/footer.rb', line 37 def initialize(navigation: nil, meta: nil, **) super(**) @options[:copyright] ||= '© Crown copyright' @navigation = &.map { || Navigation.new(context: @context, **) } @meta = Meta.new(context: @context, **) if end |
Instance Method Details
#render ⇒ ActiveSupport::SafeBuffer
Generates the HTML for the GOV.UK Footer component
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/ccs/components/govuk/footer.rb', line 52 def render tag.(**[:attributes]) do tag.div(class: "govuk-width-container #{[:container_classes]}".rstrip) do if .present? concat(tag.div(class: 'govuk-footer__navigation') do .each { || concat(.render) } end) concat(tag.hr(class: 'govuk-footer__section-break')) end concat(tag.div(class: 'govuk-footer__meta') do concat(tag.div(class: 'govuk-footer__meta-item govuk-footer__meta-item--grow') do concat(.render) if concat() concat() end) concat() end) end end end |