Sha256: bd4cf3c5539786dba6c69d2c1035c7566a9fe1aa5f6a88022c2670b75f1b3024

Contents?: true

Size: 921 Bytes

Versions: 13

Compression:

Stored size: 921 Bytes

Contents

# frozen_string_literal: true

module Decidim
  #
  # Decorator for conference speakers
  #
  class ConferenceSpeakerPresenter < SimpleDelegator
    include Decidim::ResourceHelper

    delegate :profile_path, to: :user, allow_nil: true

    def name
      user ? user.name : full_name
    end

    def nickname
      user.nickname if user
    end

    def deleted?
      user ? user.deleted? : false
    end

    def badge
      user ? user.badge : false
    end

    def can_be_contacted?
      user ? true : false
    end

    def has_tooltip?
      false
    end

    def avatar
      attached_uploader(:avatar)
    end

    def avatar_url(variant = nil)
      return avatar.default_url unless avatar.attached?

      avatar.path(variant:)
    end

    private

    def user
      @user ||= if (user = __getobj__.user.presence)
                  Decidim::UserPresenter.new(user)
                end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
decidim-conferences-0.29.1 app/presenters/decidim/conference_speaker_presenter.rb
decidim-conferences-0.28.4 app/presenters/decidim/conference_speaker_presenter.rb
decidim-conferences-0.29.0 app/presenters/decidim/conference_speaker_presenter.rb
decidim-conferences-0.28.3 app/presenters/decidim/conference_speaker_presenter.rb
decidim-conferences-0.29.0.rc4 app/presenters/decidim/conference_speaker_presenter.rb
decidim-conferences-0.29.0.rc3 app/presenters/decidim/conference_speaker_presenter.rb
decidim-conferences-0.29.0.rc2 app/presenters/decidim/conference_speaker_presenter.rb
decidim-conferences-0.29.0.rc1 app/presenters/decidim/conference_speaker_presenter.rb
decidim-conferences-0.28.2 app/presenters/decidim/conference_speaker_presenter.rb
decidim-conferences-0.28.1 app/presenters/decidim/conference_speaker_presenter.rb
decidim-conferences-0.28.0 app/presenters/decidim/conference_speaker_presenter.rb
decidim-conferences-0.28.0.rc5 app/presenters/decidim/conference_speaker_presenter.rb
decidim-conferences-0.28.0.rc4 app/presenters/decidim/conference_speaker_presenter.rb