Sha256: bf7894c8eb78a22f016274b17b87dd30dc768dfb3ea43f5b60e353519d9c069e

Contents?: true

Size: 691 Bytes

Versions: 1

Compression:

Stored size: 691 Bytes

Contents

module Bigmouth
  module ApplicationHelper
    # Returns Bootstrap friendly type
    def alert_class_for(flash_type)
      {
        success: 'alert-success',
        error: 'alert-danger',
        danger: 'alert-danger',
        alert: 'alert-warning',
        notice: 'alert-info'
      }[flash_type.to_sym] || flash_type.to_s
    end

    def author(article)
      if article.user.present?
        article.user[Bigmouth.config.username_key.to_sym] || "Guest"
      else
        "Guest"
      end
    end

    def summary(article)
      truncate_html sanitize(article.text),
                    length: Bigmouth.config.summary_length,
                    omission: "..."
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bigmouth-0.0.2 app/helpers/bigmouth/application_helper.rb