Sha256: 2a3499b1afdc6c3c235092120ce814ff050fc3e7914ed04e1cc3e30a21e1fbf7

Contents?: true

Size: 937 Bytes

Versions: 15

Compression:

Stored size: 937 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: variant)
    end

    private

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

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
decidim-conferences-0.26.10 app/presenters/decidim/conference_speaker_presenter.rb
decidim-conferences-0.26.9 app/presenters/decidim/conference_speaker_presenter.rb
decidim-conferences-0.26.8 app/presenters/decidim/conference_speaker_presenter.rb
decidim-conferences-0.26.7 app/presenters/decidim/conference_speaker_presenter.rb
decidim-conferences-0.26.5 app/presenters/decidim/conference_speaker_presenter.rb
decidim-conferences-0.26.4 app/presenters/decidim/conference_speaker_presenter.rb
decidim-conferences-0.26.3 app/presenters/decidim/conference_speaker_presenter.rb
decidim-conferences-0.26.2 app/presenters/decidim/conference_speaker_presenter.rb
decidim-conferences-0.26.1 app/presenters/decidim/conference_speaker_presenter.rb
decidim-conferences-0.26.0 app/presenters/decidim/conference_speaker_presenter.rb
decidim-conferences-0.26.0.rc2 app/presenters/decidim/conference_speaker_presenter.rb
decidim-conferences-0.26.0.rc1 app/presenters/decidim/conference_speaker_presenter.rb
decidim-conferences-0.25.2 app/presenters/decidim/conference_speaker_presenter.rb
decidim-conferences-0.25.1 app/presenters/decidim/conference_speaker_presenter.rb
decidim-conferences-0.25.0 app/presenters/decidim/conference_speaker_presenter.rb