18F/identity-dashboard

View on GitHub
app/helpers/service_config_wizard_helper.rb

Summary

Maintainability
A
0 mins
Test Coverage
module ServiceConfigWizardHelper
  def wizard_form(&block)
    simple_form_for(@model, url: service_config_wizard_path, method: :put, html: {
      autocomplete: 'off',
      class: 'service-provider-form',
    }) do |form|
      block.call(form)
    end
  end

  def parsed_help_text
    text_params = params.has_key?(@model) ? wizard_step_params[:help_text] : nil
    @parsed_help_text ||= HelpText.lookup(
      params: text_params,
      service_provider: @service_provider || draft_service_provider,
    )
  end

  def first_step?
    step.eql? wizard_steps.first
  end

  def last_step?
    step.eql? wizard_steps.last
  end

  def last_step_message
    i18n_key = 'save_new'
    t("service_provider_form.#{i18n_key}")
  end

  def show_cancel?
    IdentityConfig.store.service_config_wizard_enabled && current_user.admin?
  end
end