CMSgov/dpc-app

View on GitHub
dpc-web/app/helpers/devise_helper.rb

Summary

Maintainability
A
0 mins
Test Coverage
# frozen_string_literal: true

module DeviseHelper
  def devise_error_messages!
    return if (flash.notice.blank? && flash.alert.blank?) || flash.notice =~ /signed out/i

    return alert_msg.html_safe if flash.alert

    notice_msg.html_safe if flash.notice
  end

  def alert_msg
    <<-HTML
    <div class="ds-c-alert ds-c-alert--error">
      <div class="ds-c-alert__body">
        <h3 class="ds-c-alert__heading">#{flash.alert}</h3>
      </div>
    </div>
    HTML
  end

  def notice_msg
    <<-HTML
      <div class="ds-c-alert ds-u-margin-bottom--5">
        <div class="ds-c-alert__body">
          <h3 class="ds-c-alert__heading">#{flash.notice}</h3>
        </div>
      </div>
    HTML
  end
end