Class: Sufia::GenericFilePresenter

Inherits:
Object
  • Object
show all
Includes:
Hydra::Presenter
Defined in:
app/presenters/sufia/generic_file_presenter.rb

Direct Known Subclasses

Forms::GenericFileEditForm

Instance Method Summary collapse

Instance Method Details

#itemtypeObject

Add a schema.org itemtype



23
24
25
26
27
28
# File 'app/presenters/sufia/generic_file_presenter.rb', line 23

def itemtype
  # Look up the first non-empty resource type value in a hash from the config
  Sufia.config.resource_types_to_schema[resource_type.to_a.reject(&:empty?).first] || 'http://schema.org/CreativeWork'
rescue
  'http://schema.org/CreativeWork'
end

#tweeterObject



13
14
15
16
17
18
19
20
# File 'app/presenters/sufia/generic_file_presenter.rb', line 13

def tweeter
  user = ::User.find_by_user_key(model.depositor)
  if user.try(:twitter_handle).present?
    "@#{user.twitter_handle}"
  else
    I18n.translate('sufia.product_twitter_handle')
  end
end