require 'partials/viewable_idp_partial_controller'

class SelectDocumentsVariantController < ApplicationController
  include ViewableIdpPartialController

  def index
    @form = SelectDocumentsForm.new({})
    render :index
  end

  def select_documents
    @form = SelectDocumentsForm.new(params['select_documents_form'] || {})
    if @form.valid?
      selected_answer_store.store_selected_answers('documents', @form.selected_answers)
      redirect_to @form.further_id_information_required? ? other_identity_documents_path : choose_a_certified_company_path
    else
      flash.now[:errors] = @form.errors.full_messages.join(', ')
      render :index
    end
  end

  def no_documents
    report_to_analytics('Select No Documents Link Next')
    selected_answer_store.store_selected_answers('documents', 'passport' => false, 'driving_licence' => false, 'ni_driving_licence' => false)
    redirect_to other_identity_documents_path
  end
end

require 'partials/viewable_idp_partial_controller'

class SelectDocumentsVariantController < ApplicationController
  include ViewableIdpPartialController

  def index
    @form = SelectDocumentsForm.new({})
    render 'select_documents/index'
  end

  def select_documents
    @form = SelectDocumentsForm.new(params['select_documents_form'] || {})
    if @form.valid?
      selected_answer_store.store_selected_answers('documents', @form.selected_answers)
      redirect_to @form.further_id_information_required? ? other_identity_documents_path : choose_a_certified_company_path
    else
      flash.now[:errors] = @form.errors.full_messages.join(', ')
      render 'select_documents/index'
    end
  end

  def no_documents
    report_to_analytics('Select No Documents Link Next')
    selected_answer_store.store_selected_answers('documents', 'passport' => false, 'driving_licence' => false, 'ni_driving_licence' => false)
    redirect_to other_identity_documents_path
  end
end

Fix for incorrect view rendering
ZD-56753: Fix for incorrect view rendering

When a user is on variant, has a JS disabled and submits invalid form,
the select_documents_variant controller tries to re-render the page with
the error messages. However, we don't use that view and so it isn't present.
The fix is to render the control views (insteading of adding the variant view)

Solo: da39a3ee5e6b4b0d3255bfef95601890afd80709@jakubmiarka
