Class: Decidim::Notify::ParticipantCell

Inherits:
ViewModel
  • Object
show all
Defined in:
app/cells/decidim/notify/participant_cell.rb

Overview

This cell renders the card for an instance of a Notify Participant

Instance Method Summary collapse

Instance Method Details

#avatar_urlObject



17
18
19
20
# File 'app/cells/decidim/notify/participant_cell.rb', line 17

def avatar_url
  path = model.attached_uploader(:avatar).path(variant: :profile) if model.respond_to?(:attached_uploader)
  path.presence || ActionController::Base.helpers.asset_pack_path("media/images/default-avatar.svg")
end

#codeObject



7
8
9
10
11
# File 'app/cells/decidim/notify/participant_cell.rb', line 7

def code
  return model.code if model.is_a? Author

  Author.find_by(user: model, component: current_component)&.code if model
end

#current_componentObject



22
23
24
# File 'app/cells/decidim/notify/participant_cell.rb', line 22

def current_component
  context&.dig(:current_component) || controller&.current_component
end

#nameObject



13
14
15
# File 'app/cells/decidim/notify/participant_cell.rb', line 13

def name
  model&.name
end