app/presenters/hyrax/file_set_presenter.rb in hyrax-1.1.1 vs app/presenters/hyrax/file_set_presenter.rb in hyrax-2.0.0.beta1
- old
+ new
@@ -23,11 +23,11 @@
# Methods used by blacklight helpers
delegate :has?, :first, :fetch, to: :solr_document
# Metadata Methods
delegate :title, :label, :description, :creator, :contributor, :subject,
- :publisher, :language, :date_uploaded, :rights,
+ :publisher, :language, :date_uploaded,
:embargo_release_date, :lease_expiration_date,
:depositor, :keyword, :title_or_label, :keyword,
:date_created, :date_modified, :itemtype,
to: :solr_document
@@ -53,21 +53,16 @@
def editor?
current_ability.can?(:edit, solr_document)
end
def tweeter
- user = ::User.find_by_user_key(depositor)
- if user.try(:twitter_handle).present?
- "@#{user.twitter_handle}"
- else
- I18n.translate('hyrax.product_twitter_handle')
- end
+ TwitterPresenter.twitter_handle_for(user_key: depositor)
end
- def rights
- return if solr_document.rights.nil?
- solr_document.rights.first
+ def license
+ return if solr_document.license.nil?
+ solr_document.license.first
end
def stats_path
Hyrax::Engine.routes.url_helpers.stats_file_path(self)
end
@@ -79,24 +74,24 @@
# This overrides the method in WithEvents
def event_class
solr_document.to_model.model_name.name
end
- def audit_status
- audit_service.logged_audit_status
+ def fixity_check_status
+ Hyrax::FixityStatusPresenter.new(id).render_file_set_status
end
def parent
ids = ActiveFedora::SolrService.query("{!field f=member_ids_ssim}#{id}",
fl: ActiveFedora.id_field)
.map { |x| x.fetch(ActiveFedora.id_field) }
- @parent_presenter ||= Hyrax::PresenterFactory.build_presenters(ids,
- WorkShowPresenter,
- current_ability).first
+ @parent_presenter ||= Hyrax::PresenterFactory.build_for(ids: ids,
+ presenter_class: WorkShowPresenter,
+ presenter_args: current_ability).first
end
- def audit_service
- @audit_service ||= Hyrax::FileSetAuditService.new(id)
+ def fixity_check_service
+ @fixity_check_service ||= Hyrax::FileSetFixityCheckService.new(id)
end
private
def link_presenter_class