Sha256: be6943f4940d031d3b2c4e9490d4e87df4641b638572da79e70ce6886913c012

Contents?: true

Size: 488 Bytes

Versions: 1

Compression:

Stored size: 488 Bytes

Contents

module Samurai
  module ApplicationHelper
    FLASH_CLASSES = {
      notice: "alert alert-info",
      success: "alert alert-success",
      alert: "alert alert-danger",
      error: "alert alert-danger"
    }

    def active(path, comparator = :absolute)
      if comparator == :inclusion
        /^#{path}/ =~ request.path ? 'active' : ''
      else
        current_page?(path) ? 'active' : ''
      end
    end

    def flash_class(level)
      FLASH_CLASSES[level]
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
samurai_core-1.0.0 app/helpers/samurai/application_helper.rb