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) ⇒ 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) ⇒ Footer
Returns a new instance of Footer.
40 41 42 43 44 45 46 47 48 |
# File 'lib/ccs/components/govuk/footer.rb', line 40 def initialize(navigation: nil, meta: nil, **) super(**) @options[:copyright] ||= '© Crown copyright' @logo = Logo.new(use_logotype: false, classes: 'govuk-footer__crown', context: @context) @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
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/ccs/components/govuk/footer.rb', line 56 def render tag.div(**[:attributes]) do tag.div(class: "govuk-width-container #{[:container_classes]}".rstrip) do concat(logo.render) if logo 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 unless .key?(:content_licence) && [:content_licence].nil? concat() concat() end end) concat() end) end end end |