Class: Hyrax::AdminSetPresenter
- Inherits:
-
CollectionPresenter
- Object
- CollectionPresenter
- Hyrax::AdminSetPresenter
- Defined in:
- app/presenters/hyrax/admin_set_presenter.rb
Instance Attribute Summary
Attributes inherited from CollectionPresenter
#current_ability, #request, #solr_document
Instance Method Summary collapse
-
#disable_delete? ⇒ Boolean
AdminSet cannot be deleted if default set or non-empty.
-
#disabled_message ⇒ Object
Message to display if deletion is disabled.
- #total_items ⇒ Object
Methods inherited from CollectionPresenter
#[], #initialize, #size, terms, #terms_with_values
Methods included from PresentsAttributes
#attribute_to_html, #display_microdata?, #microdata_type_to_html, #permission_badge, #permission_badge_class
Methods included from ModelProxy
#persisted?, #to_model, #to_partial_path
Constructor Details
This class inherits a constructor from Hyrax::CollectionPresenter
Instance Method Details
#disable_delete? ⇒ Boolean
AdminSet cannot be deleted if default set or non-empty
8 9 10 |
# File 'app/presenters/hyrax/admin_set_presenter.rb', line 8 def disable_delete? AdminSet.default_set?(id) || total_items > 0 end |
#disabled_message ⇒ Object
Message to display if deletion is disabled
13 14 15 16 |
# File 'app/presenters/hyrax/admin_set_presenter.rb', line 13 def 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 |
#total_items ⇒ Object
3 4 5 |
# File 'app/presenters/hyrax/admin_set_presenter.rb', line 3 def total_items ActiveFedora::SolrService.count("{!field f=isPartOf_ssim}#{id}") end |