ministryofjustice/Claim-for-Crown-Court-Defence

View on GitHub
app/views/external_users/certifications/new.html.haml

Summary

Maintainability
Test Coverage
= content_for :page_title, flush: true do
  = t(".page_title.#{present(@claim).type_identifier}")

= render partial: 'layouts/header', locals: { page_heading: t('.page_heading') }

.govuk-grid-row
  .govuk-grid-column-two-thirds
    = form_with model: @certification, url: external_users_claim_certification_path(@claim) do |f|
      = f.govuk_error_summary

      - if @claim.agfs?
        = t('.agfs_claim_collection_html')

        = f.govuk_radio_buttons_fieldset :certification_type_id,
          legend: { text: t('.certification_type_post_may_2015'), size: 's' } do
          - CertificationType.post_may_2015.agfs.each_with_index do |certification_type, index|
            = f.govuk_radio_button :certification_type_id, certification_type.id, label: { text: certification_type.name }, link_errors: index.zero?

        = f.govuk_radio_buttons_fieldset :certification_type_id,
          legend: { text: t('.certification_type_pre_may_2015_hint'), size: 's' } do
          - CertificationType.pre_may_2015.agfs.each_with_index do |certification_type, index|
            = f.govuk_radio_button :certification_type_id, certification_type.id, label: { text: certification_type.name }

        = t('.agfs_claim_confirmation_info_html')

      - elsif @claim.is_a? Claim::LitigatorClaim
        = t('.lgfs_claim_html')

      - else
        = t('.other_claim_html')

      = f.govuk_text_field :certified_by,
        label: { text: t('.certified_by') },
        hint: { text: t('.certified_by_prompt_text') }

      = f.govuk_date_field :certification_date,
        maxlength_enabled: true,
        legend: { text: t('.date'), size: 's' },
        form_group: { id: 'certification_date' }
      .govuk-button-group
        = f.govuk_submit t('.submit')
        = govuk_link_button_secondary t('.return'), edit_polymorphic_path(@claim)