class Ffp::Presenter

Constants

ALERT_TYPES

Public Class Methods

new(flash) click to toggle source
# File lib/ffp/presenter.rb, line 7
def initialize(flash)
  @flash = flash
end

Public Instance Methods

for_foundation() click to toggle source
# File lib/ffp/presenter.rb, line 12
def for_foundation
  flash_messages = Array.new

  @flash.each do |type, message|
    next if message.blank?

    type = "success" if type == "notice"
    type = "alert" if type == "error"

    next unless ALERT_TYPES.include?(type)

    Array(message).each do |msg|
      flash_messages << content_tag(
        :div,
        msg.html_safe + content_tag(:a, raw("&times;"), :class => 'close'),
        :class => css_classes_for_type(type),
        :'data-alert' => true
      )
    end
  end

  flash_messages.join("\n").html_safe
end

Private Instance Methods

css_classes_for_type(type) click to toggle source
# File lib/ffp/presenter.rb, line 39
def css_classes_for_type(type)
  ks = []
  ks << 'alert-box'
  ks << 'radius'
  ks << type

  ks.join(" ")
end