Sha256: aef4b565fb3875c68c39c7799061b89b62a90db176d24ee9a4182d5b0c025659

Contents?: true

Size: 599 Bytes

Versions: 48

Compression:

Stored size: 599 Bytes

Contents

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

48 entries across 48 versions & 1 rubygems

Version Path
hyrax-2.9.6 app/presenters/hyrax/twitter_presenter.rb
hyrax-2.9.5 app/presenters/hyrax/twitter_presenter.rb
hyrax-2.9.4 app/presenters/hyrax/twitter_presenter.rb
hyrax-2.9.3 app/presenters/hyrax/twitter_presenter.rb
hyrax-2.9.2 app/presenters/hyrax/twitter_presenter.rb
hyrax-2.9.1 app/presenters/hyrax/twitter_presenter.rb
hyrax-2.9.0 app/presenters/hyrax/twitter_presenter.rb
hyrax-2.8.0 app/presenters/hyrax/twitter_presenter.rb
hyrax-2.7.2 app/presenters/hyrax/twitter_presenter.rb
hyrax-2.7.1 app/presenters/hyrax/twitter_presenter.rb
hyrax-2.7.0 app/presenters/hyrax/twitter_presenter.rb
hyrax-2.6.0 app/presenters/hyrax/twitter_presenter.rb
hyrax-3.0.0.pre.rc1 app/presenters/hyrax/twitter_presenter.rb
hyrax-3.0.0.pre.beta3 app/presenters/hyrax/twitter_presenter.rb
hyrax-2.5.1 app/presenters/hyrax/twitter_presenter.rb
hyrax-2.5.0 app/presenters/hyrax/twitter_presenter.rb
hyrax-3.0.0.pre.beta2 app/presenters/hyrax/twitter_presenter.rb
hyrax-2.4.1 app/presenters/hyrax/twitter_presenter.rb
hyrax-3.0.0.pre.beta1 app/presenters/hyrax/twitter_presenter.rb
hyrax-2.4.0 app/presenters/hyrax/twitter_presenter.rb