Sha256: 470eae496f97e7dfd4f216f5378070195b3807b50b637417c29e8abd0a483fe1

Contents?: true

Size: 629 Bytes

Versions: 28

Compression:

Stored size: 629 Bytes

Contents

# frozen_string_literal: true
module Hyrax
  # Repeatable logic for presenting twitter handles.
  #
  # @note The duplication of code was found via the flay gem
  module TwitterPresenter
    # @api public
    # @param [String] user_key for which we will find the appropriate twitter handle
    # @return [String] the twitter handle appropriate for the given user key
    def self.twitter_handle_for(user_key:)
      user = ::User.find_by_user_key(user_key)
      if user.try(:twitter_handle).present?
        "@#{user.twitter_handle}"
      else
        I18n.translate('hyrax.product_twitter_handle')
      end
    end
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
hyrax-5.0.4 app/presenters/hyrax/twitter_presenter.rb
hyrax-5.0.3 app/presenters/hyrax/twitter_presenter.rb
hyrax-5.0.2 app/presenters/hyrax/twitter_presenter.rb
hyrax-5.0.1 app/presenters/hyrax/twitter_presenter.rb
hyrax-5.0.0 app/presenters/hyrax/twitter_presenter.rb
hyrax-5.0.0.rc3 app/presenters/hyrax/twitter_presenter.rb
hyrax-5.0.0.rc2 app/presenters/hyrax/twitter_presenter.rb
hyrax-5.0.0.rc1 app/presenters/hyrax/twitter_presenter.rb
hyrax-3.6.0 app/presenters/hyrax/twitter_presenter.rb
hyrax-4.0.0 app/presenters/hyrax/twitter_presenter.rb
hyrax-4.0.0.rc3 app/presenters/hyrax/twitter_presenter.rb
hyrax-4.0.0.rc2 app/presenters/hyrax/twitter_presenter.rb
hyrax-4.0.0.rc1 app/presenters/hyrax/twitter_presenter.rb
hyrax-3.5.0 app/presenters/hyrax/twitter_presenter.rb
hyrax-4.0.0.beta2 app/presenters/hyrax/twitter_presenter.rb
hyrax-3.4.2 app/presenters/hyrax/twitter_presenter.rb
hyrax-4.0.0.beta1 app/presenters/hyrax/twitter_presenter.rb
hyrax-3.4.1 app/presenters/hyrax/twitter_presenter.rb
hyrax-3.4.0 app/presenters/hyrax/twitter_presenter.rb
hyrax-3.3.0 app/presenters/hyrax/twitter_presenter.rb