Sha256: ff48e4a8d674ee36570bb9ef2ad2ae6f9358fea35f34bdd83f26a8e0899beb43

Contents?: true

Size: 586 Bytes

Versions: 21

Compression:

Stored size: 586 Bytes

Contents

module Hyrax
  class AdminSetPresenter < CollectionPresenter
    def total_items
      ActiveFedora::SolrService.count("{!field f=isPartOf_ssim}#{id}")
    end

    # AdminSet cannot be deleted if default set or non-empty
    def disable_delete?
      AdminSet.default_set?(id) || total_items > 0
    end

    # Message to display if deletion is disabled
    def disabled_message
      return I18n.t('hyrax.admin.admin_sets.delete.error_default_set') if AdminSet.default_set?(id)
      return I18n.t('hyrax.admin.admin_sets.delete.error_not_empty') if total_items > 0
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
hyrax-1.1.1 app/presenters/hyrax/admin_set_presenter.rb
hyrax-2.0.3 app/presenters/hyrax/admin_set_presenter.rb
hyrax-1.1.0 app/presenters/hyrax/admin_set_presenter.rb
hyrax-2.0.2 app/presenters/hyrax/admin_set_presenter.rb
hyrax-2.0.1 app/presenters/hyrax/admin_set_presenter.rb
hyrax-2.0.0 app/presenters/hyrax/admin_set_presenter.rb
hyrax-2.0.0.rc3 app/presenters/hyrax/admin_set_presenter.rb
hyrax-2.0.0.rc2 app/presenters/hyrax/admin_set_presenter.rb
hyrax-2.0.0.rc1 app/presenters/hyrax/admin_set_presenter.rb
hyrax-1.0.5 app/presenters/hyrax/admin_set_presenter.rb
hyrax-2.0.0.beta5 app/presenters/hyrax/admin_set_presenter.rb
hyrax-2.0.0.beta4 app/presenters/hyrax/admin_set_presenter.rb
hyrax-2.0.0.beta3 app/presenters/hyrax/admin_set_presenter.rb
hyrax-2.0.0.beta2 app/presenters/hyrax/admin_set_presenter.rb
hyrax-2.0.0.beta1 app/presenters/hyrax/admin_set_presenter.rb
hyrax-1.0.4 app/presenters/hyrax/admin_set_presenter.rb
hyrax-1.0.3 app/presenters/hyrax/admin_set_presenter.rb
hyrax-1.0.2 app/presenters/hyrax/admin_set_presenter.rb
hyrax-1.0.1 app/presenters/hyrax/admin_set_presenter.rb
hyrax-1.0.0.rc2 app/presenters/hyrax/admin_set_presenter.rb