Module: Decidim::FeedsUi::ApplicationHelper

Defined in:
app/helpers/decidim/feeds_ui/application_helper.rb

Overview

Custom helpers, scoped to the feeds_ui engine.

Instance Method Summary collapse

Instance Method Details

#avatar_url(user) ⇒ Object



12
13
14
15
16
17
18
# File 'app/helpers/decidim/feeds_ui/application_helper.rb', line 12

def avatar_url(user)
  if user.avatar.attached?
    user.attached_uploader(:avatar).path(variant: :thumb)
  else
    ActionController::Base.helpers.asset_pack_path("media/images/default-avatar.svg")
  end
end

#text_initials(name) ⇒ Object



8
9
10
# File 'app/helpers/decidim/feeds_ui/application_helper.rb', line 8

def text_initials(name)
  name.split(/[\s.]+/).map(&:chr).slice(0, 2).join.upcase
end