Sha256: 2d9a3ed38969ca22111a2060fae782ae02342eb2e97765b207ae9b4eae2f2aa1

Contents?: true

Size: 539 Bytes

Versions: 4

Compression:

Stored size: 539 Bytes

Contents

# frozen_string_literal: true

module Archangel
  ##
  # Flash message helpers
  #
  module FlashHelper
    ##
    # Converts Rails flash message type to Bootstrap flash message type
    #
    # @param flash_type [String,Symbol] the flash message type
    # @return [String] flash message type
    #
    def flash_class_for(flash_type)
      flash_type = flash_type.to_s.downcase.parameterize

      {
        success: "success", error: "danger", alert: "warning", notice: "info"
      }[flash_type.to_sym] || flash_type
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
archangel-0.0.5 app/helpers/archangel/flash_helper.rb
archangel-0.0.4 app/helpers/archangel/flash_helper.rb
archangel-0.0.3 app/helpers/archangel/flash_helper.rb
archangel-0.0.2 app/helpers/archangel/flash_helper.rb