Module: Samurai::ApplicationHelper

Defined in:
app/helpers/samurai/application_helper.rb

Constant Summary collapse

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

Instance Method Summary collapse

Instance Method Details

#active(path, comparator = :absolute) ⇒ Object



10
11
12
13
14
15
16
# File 'app/helpers/samurai/application_helper.rb', line 10

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

#flash_class(level) ⇒ Object



18
19
20
# File 'app/helpers/samurai/application_helper.rb', line 18

def flash_class(level)
  FLASH_CLASSES[level]
end