Sha256: df0704a6692948e9a98f3f7f84b08097f1199ed7af9c81be944c4ceb4f5ca767

Contents?: true

Size: 576 Bytes

Versions: 24

Compression:

Stored size: 576 Bytes

Contents

module SemanticFlashHelper
  ALERT_TYPES = %i[error info success warning].freeze

  def semantic_flash
    output = ''
    flash.each do |type, message|
      next if message.blank?

      type = :success if type.to_sym == :notice
      type = :error   if type.to_sym == :alert
      next unless ALERT_TYPES.include?(type.to_sym)

      output += flash_container(type, message)
    end

    raw(output)
  end

  def flash_container(type, message)
    content_tag(:div, class: "ui #{type} message") do
      content_tag(:i, '', class: 'close icon') + message
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
fomantic-ui-sass-2.9.3 app/helpers/semantic_flash_helper.rb
fomantic-ui-sass-2.9.2 app/helpers/semantic_flash_helper.rb
fomantic-ui-sass-2.9.1 app/helpers/semantic_flash_helper.rb
fomantic-ui-sass-2.9.0 app/helpers/semantic_flash_helper.rb
fomantic-ui-sass-2.8.8.1 app/helpers/semantic_flash_helper.rb
fomantic-ui-sass-2.8.8 app/helpers/semantic_flash_helper.rb
fomantic-ui-sass-2.8.7.1 app/helpers/semantic_flash_helper.rb
fomantic-ui-sass-2.8.7 app/helpers/semantic_flash_helper.rb
fomantic-ui-sass-2.8.6 app/helpers/semantic_flash_helper.rb
fomantic-ui-sass-2.8.5 app/helpers/semantic_flash_helper.rb
fomantic-ui-sass-2.8.4 app/helpers/semantic_flash_helper.rb
fomantic-ui-sass-2.8.3 app/helpers/semantic_flash_helper.rb
fomantic-ui-sass-2.8.2 app/helpers/semantic_flash_helper.rb
fomantic-ui-sass-2.8.1.1 app/helpers/semantic_flash_helper.rb
fomantic-ui-sass-2.8.1 app/helpers/semantic_flash_helper.rb
fomantic-ui-sass-2.7.8 app/helpers/semantic_flash_helper.rb
fomantic-ui-sass-2.7.7 app/helpers/semantic_flash_helper.rb
fomantic-ui-sass-2.7.6 app/helpers/semantic_flash_helper.rb
fomantic-ui-sass-2.7.5 app/helpers/semantic_flash_helper.rb
fomantic-ui-sass-2.7.4 app/helpers/semantic_flash_helper.rb