Sha256: 46e9ff3c794c1a50ed703f85e5fa7935eb99f62c6973a8422c29a592ec46deee

Contents?: true

Size: 543 Bytes

Versions: 5

Compression:

Stored size: 543 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"
      }.fetch(flash_type.to_sym, flash_type)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
archangel-0.4.0 app/helpers/archangel/flash_helper.rb
archangel-0.3.0 app/helpers/archangel/flash_helper.rb
archangel-0.0.8 app/helpers/archangel/flash_helper.rb
archangel-0.0.7 app/helpers/archangel/flash_helper.rb
archangel-0.0.6 app/helpers/archangel/flash_helper.rb