Module: Livechat::InboxHelper
- Defined in:
- app/helpers/livechat/inbox_helper.rb
Constant Summary collapse
- AVATAR_COLORS =
Agents have no avatar images (no FK to host users) — initials in a deterministically colored circle do the job: same label, same color, every page load. Full label rides the title tooltip.
6
Instance Method Summary collapse
Instance Method Details
#livechat_agent_avatar(label) ⇒ Object
10 11 12 13 14 15 16 |
# File 'app/helpers/livechat/inbox_helper.rb', line 10 def livechat_agent_avatar(label) initials = label.to_s.split.first(2).map { |word| word[0] }.join.upcase initials = label.to_s.first(2).upcase if initials.blank? color = label.to_s.each_byte.sum % AVATAR_COLORS tag.span(initials, class: "avatar color-#{color}", title: label) end |