Class: AmaLayout::NotificationDecorator

Inherits:
Object
  • Object
show all
Includes:
DraperReplacement
Defined in:
lib/ama_layout/decorators/notification_decorator.rb

Constant Summary collapse

ICONS =
{
  notice: {
    icon_class: 'fa-info',
    colour_class: 'right-sidebar__content-icon--blue' # currently not in use
  },
  warning: {
    icon_class: 'fa-exclamation',
    colour_class: 'right-sidebar__content-icon--orange'
  },
  alert: {
    icon_class: 'fa-exclamation-triangle',
    colour_class: 'right-sidebar__content-icon--red'
  }
}.freeze

Instance Method Summary collapse

Instance Method Details

#active_classObject



31
32
33
# File 'lib/ama_layout/decorators/notification_decorator.rb', line 31

def active_class
  active? ? 'right-sidebar__content--active' : 'right-sidebar__content--inactive'
end

#created_atObject



20
21
22
# File 'lib/ama_layout/decorators/notification_decorator.rb', line 20

def created_at
  "#{time_elapsed} ago".humanize
end

#iconObject



24
25
26
27
28
29
# File 'lib/ama_layout/decorators/notification_decorator.rb', line 24

def icon
  h. :div, class: icon_data.fetch(:colour_class) do
    klass = icon_data.fetch(:icon_class)
    h. :i, nil, class: "fa #{klass} right-sidebar__notice-icon"
  end
end