Module: BootstrapLeather::AlertsHelper

Included in:
ApplicationHelper
Defined in:
app/helpers/bootstrap_leather/alerts_helper.rb

Overview

Alerts, i.e. messages at the top of the page, usually from flash or form errors

Instance Method Summary collapse

Instance Method Details

#alert(css_class, title, message = nil) ⇒ Object



18
19
20
21
22
23
24
25
26
27
# File 'app/helpers/bootstrap_leather/alerts_helper.rb', line 18

def alert(css_class, title, message = nil)
  render(
    partial: 'bootstrap_leather/alerts/alert',
    locals: {
      css_class: css_class,
      title: title,
      message: message
    }
  )
end

#alert_flash_messages(html_options = {}) ⇒ Object



29
30
31
32
33
34
# File 'app/helpers/bootstrap_leather/alerts_helper.rb', line 29

def alert_flash_messages(html_options = {})
  render(
    partial: 'bootstrap_leather/alerts/alert_flash_messages',
    locals: { html_options: html_options }
  )
end

#flash_class(level) ⇒ Object



7
8
9
10
11
12
13
14
15
16
# File 'app/helpers/bootstrap_leather/alerts_helper.rb', line 7

def flash_class(level)
  case level
  when :notice then
    'info'
  when :error then
    'danger'
  when :alert then
    'warning'
  end
end