Sha256: 088bfc2cba29dae979923624599a9af967d12dea1d9d77fff9209ad7dfaf1264

Contents?: true

Size: 582 Bytes

Versions: 2

Compression:

Stored size: 582 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Notify
    # This cell renders the card for an instance of a Notify Participant
    class ParticipantCell < Decidim::ViewModel
      def code
        return model.code if model.is_a? Author

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

      def name
        model&.name
      end

      def avatar_url
        model&.avatar_url(:profile)
      end

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
decidim-notify-0.4 app/cells/decidim/notify/participant_cell.rb
decidim-notify-0.3 app/cells/decidim/notify/participant_cell.rb