ministryofjustice/atet

View on GitHub
app/views/layouts/application.html.slim

Summary

Maintainability
Test Coverage
- content_for :head do
  = render "shared/google_tag_manager_head", account: Rails.application.config.google_tag_manager_account
  = csrf_meta_tag

- content_for :javascripts do
  - if ENV.has_key?('GOOGLE_ANALYTICS_ID') && ENV["GOOGLE_ANALYTICS_ID"].present? && cookie_settings['usage']
    javascript:
      gaTracker.init('#{ENV.fetch("GOOGLE_ANALYTICS_ID")}');
  - if start_session_timer?
    javascript:
      Et.components.SessionPrompt.init();


// @TODO Check on removed content here
- content_for :after_header do
  = render "shared/google_tag_manager_body", account: Rails.application.config.google_tag_manager_account

- content_for :body_classes, "#{Rails.configuration.phase.to_s.downcase} #{Rails.configuration.product_type.to_s.downcase} #{controller.controller_name} #{controller.action_name}"

- content_for :footer_support_links do
  li.govuk-footer__inline-list-item= link_to "Guide", guide_path, class: 'govuk-footer__link'
  li.govuk-footer__inline-list-item= link_to "Terms and Conditions", terms_path, class: 'govuk-footer__link'
  li.govuk-footer__inline-list-item= link_to "Cookies", edit_cookies_path, class: 'govuk-footer__link'
  li.govuk-footer__inline-list-item= link_to "Contact us", 'http://www.justice.gov.uk/contacts/hmcts/tribunals/employment', class: 'govuk-footer__link'
- unless content_for?(:before_alerts)
  - content_for :before_alerts do
    = render partial: 'shared/feedback_link'
    = render "shared/maintenance_notice" if ENV['SHOW_DOWNTIME_BANNER'].present?

- content_for :content_override do
  .govuk-width-container
    main#main-content(role="main")
      .container
        = content_for(:before_alerts)
        - %w<info notice alert>.each do |type|
          - next unless flash[type].present?
          = render partial: 'shared/flash_message', locals: { type: type }
        = render partial: 'shared/session_prompt'
        = yield

- content_for :cookie_message do
  - unless cookie_settings['seen']
    = form_for cookie_form, as: :cookie, url: cookies_path, method: :post, builder: EtGdsDesignSystem.form_builder_class do |f|
      = f.hidden_field :return_path, value: path_only(request.url)
      .govuk-cookie-banner aria-label= t('cookies.edit.cookie_aria_label') role="region" data-nosnippet= true
        .govuk-cookie-banner__message.govuk-width-container
          .govuk-grid-row
            .govuk-grid-column-two-thirds
              h2.govuk-cookie-banner__heading.govuk-heading-m= t('banner.title')
              .govuk-cookie-banner__content
                p.govuk-body= t('banner.first_line')
                p.govuk-body= t('banner.second_line')
          .govuk-button-group
            button.govuk-button.button data-module="govuk-button" value= "true" name= "cookie[usage]" type= "submit"
              = t('banner.accept_analytics')
            button.govuk-button.button data-module="govuk-button" value= "false" name= "cookie[usage]" type= "submit"
              = t('banner.reject_analytics')
            = link_to t('banner.cookie_link'), edit_cookies_path, class: 'govuk-link'
  - if flash[:cookie_banner_confirmation].present?
    .govuk-cookie-banner.confirmation aria-label= t('cookies.edit.cookie_aria_label') role="region"
      .govuk-cookie-banner__message.govuk-width-container role="alert"
        .govuk-grid-row
          .govuk-grid-column-two-thirds
            .govuk-cookie-banner__content
              p= flash[:cookie_banner_confirmation].html_safe
        .govuk-button-group
          form action=(request.url) method="get"
            button.govuk-button.button data-module="govuk-button"
              = t('cookie_banner.confirmation_message.hide_button')

= render template: "layouts/moj_template"