class AmaLayout::NotificationDecorator

Constants

ICONS

Public Instance Methods

active_class() click to toggle source
# File lib/ama_layout/decorators/notification_decorator.rb, line 31
def active_class
  active? ? 'right-sidebar__content--active' : 'right-sidebar__content--inactive'
end
created_at() click to toggle source
# File lib/ama_layout/decorators/notification_decorator.rb, line 20
def created_at
  "#{time_elapsed} ago".humanize
end
icon() click to toggle source
# File lib/ama_layout/decorators/notification_decorator.rb, line 24
def icon
  h.content_tag :div, class: icon_data.fetch(:colour_class) do
    klass = icon_data.fetch(:icon_class)
    h.content_tag :i, nil, class: "fa #{klass} right-sidebar__notice-icon"
  end
end

Private Instance Methods

icon_data() click to toggle source
# File lib/ama_layout/decorators/notification_decorator.rb, line 37
def icon_data
  @icon_data ||= ICONS.fetch(type)
end
time_elapsed() click to toggle source
# File lib/ama_layout/decorators/notification_decorator.rb, line 41
def time_elapsed
  h.time_ago_in_words(object.created_at, include_seconds: true)
end