Class: GovukPublishingComponents::Presenters::LayoutFooterHelper
- Inherits:
-
Object
- Object
- GovukPublishingComponents::Presenters::LayoutFooterHelper
- Defined in:
- lib/govuk_publishing_components/presenters/layout_footer_helper.rb
Instance Attribute Summary collapse
-
#ga4_copyright_link_index_section ⇒ Object
readonly
Returns the value of attribute ga4_copyright_link_index_section.
-
#ga4_index_section_count ⇒ Object
readonly
Returns the value of attribute ga4_index_section_count.
-
#ga4_ogl_link_index_section ⇒ Object
readonly
Returns the value of attribute ga4_ogl_link_index_section.
Instance Method Summary collapse
- #generate_ga4_link_attribute(index_link, index_section, section, index_total) ⇒ Object
-
#initialize(footer_navigation_section, footer_meta_section) ⇒ LayoutFooterHelper
constructor
A new instance of LayoutFooterHelper.
Constructor Details
#initialize(footer_navigation_section, footer_meta_section) ⇒ LayoutFooterHelper
Returns a new instance of LayoutFooterHelper.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/govuk_publishing_components/presenters/layout_footer_helper.rb', line 6 def initialize(, ) @ga4_index_section_count = .length @amount_of_meta_sections = 0 if .any? @amount_of_meta_sections = 1 @ga4_index_section_count += 1 end # For our GOVUK footer links, we need to add 2 to the index_section_count. This is due to the "Open Government License" and "Crown Copyright" links being defined separately to the rest of our footer links. @ga4_index_section_count += 2 @ga4_ogl_link_index_section = .length + @amount_of_meta_sections + 1 @ga4_copyright_link_index_section = @ga4_ogl_link_index_section + 1 end |
Instance Attribute Details
#ga4_copyright_link_index_section ⇒ Object (readonly)
Returns the value of attribute ga4_copyright_link_index_section.
4 5 6 |
# File 'lib/govuk_publishing_components/presenters/layout_footer_helper.rb', line 4 def ga4_copyright_link_index_section @ga4_copyright_link_index_section end |
#ga4_index_section_count ⇒ Object (readonly)
Returns the value of attribute ga4_index_section_count.
4 5 6 |
# File 'lib/govuk_publishing_components/presenters/layout_footer_helper.rb', line 4 def ga4_index_section_count @ga4_index_section_count end |
#ga4_ogl_link_index_section ⇒ Object (readonly)
Returns the value of attribute ga4_ogl_link_index_section.
4 5 6 |
# File 'lib/govuk_publishing_components/presenters/layout_footer_helper.rb', line 4 def ga4_ogl_link_index_section @ga4_ogl_link_index_section end |
Instance Method Details
#generate_ga4_link_attribute(index_link, index_section, section, index_total) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/govuk_publishing_components/presenters/layout_footer_helper.rb', line 22 def generate_ga4_link_attribute(index_link, index_section, section, index_total) { "event_name": "navigation", "type": "footer", "index_link": (index_link + 1).to_s, "index_section": (index_section + 1).to_s, "index_section_count": @ga4_index_section_count.to_s, "index_total": index_total.to_s, "section": section, } end |