Module: Headmin::NotificationHelper

Included in:
AdminHelper
Defined in:
app/helpers/headmin/notification_helper.rb

Instance Method Summary collapse

Instance Method Details

#notification_color(name) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'app/helpers/headmin/notification_helper.rb', line 3

def notification_color(name)
  color = {
    notice: {
      background: "bg-success",
      text: "text-white"
    },
    error: {
      text: "text-dark",
      background: "bg-danger"
    },
    alert: {
      text: "text-dark",
      background: "bg-warning"
    },
    timedout: {
      text: "text-dark",
      background: "bg-warning"
    },
    fallback: {
      text: "text-light",
      background: "bg-info"
    }
  }

  name = name.to_sym
  color.key?(name) ? color[name] : color[:fallback]
end