Sha256: c2033b8e6ce34ed0875fceae868802bccc9f733889947bfa9985c37901a52565

Contents?: true

Size: 550 Bytes

Versions: 35

Compression:

Stored size: 550 Bytes

Contents

module SemanticFlashHelper
  ALERT_TYPES = [:error, :info, :success, :warning]

  def semantic_flash
    output = ''
    flash.each do |type, message|
      next if message.blank?
      type = :success if type == :notice
      type = :error   if type == :alert
      next unless ALERT_TYPES.include?(type)
      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

35 entries across 35 versions & 1 rubygems

Version Path
semantic-ui-sass-0.19.3.0 app/helpers/semantic_flash_helper.rb
semantic-ui-sass-0.16.1.0 app/helpers/semantic_flash_helper.rb
semantic-ui-sass-0.15.5.0 app/helpers/semantic_flash_helper.rb
semantic-ui-sass-0.15.4.2 app/helpers/semantic_flash_helper.rb
semantic-ui-sass-0.15.4.0 app/helpers/semantic_flash_helper.rb
semantic-ui-sass-0.15.2.0 app/helpers/semantic_flash_helper.rb
semantic-ui-sass-0.15.1.0 app/helpers/semantic_flash_helper.rb
semantic-ui-sass-0.14.0.0 app/helpers/semantic_flash_helper.rb
semantic-ui-sass-0.13.1.0 app/helpers/semantic_flash_helper.rb
semantic-ui-sass-0.13.0.0 app/helpers/semantic_flash_helper.rb
semantic-ui-sass-0.12.5.0 app/helpers/semantic_flash_helper.rb
semantic-ui-sass-0.12.4.0 app/helpers/semantic_flash_helper.rb
semantic-ui-sass-0.12.3.0 app/helpers/semantic_flash_helper.rb
semantic-ui-sass-0.12.2.0 app/helpers/semantic_flash_helper.rb
semantic-ui-sass-0.12.1.0 app/helpers/semantic_flash_helper.rb
semantic-ui-sass-0.12.0.0 app/helpers/semantic_flash_helper.rb
semantic-ui-sass-0.11.0.0 app/helpers/semantic_flash_helper.rb
semantic-ui-sass-0.10.3.0 app/helpers/semantic_flash_helper.rb
semantic-ui-sass-0.10.2.0 app/helpers/semantic_flash_helper.rb
semantic-ui-sass-0.10.1.0 app/helpers/semantic_flash_helper.rb