Module: Hyrax::EmbargoHelper
- Included in:
- HyraxHelperBehavior
- Defined in:
- app/helpers/hyrax/embargo_helper.rb
Instance Method Summary collapse
- #assets_under_embargo ⇒ Object
- #assets_with_deactivated_embargoes ⇒ Object
- #assets_with_expired_embargoes ⇒ Object
-
#embargo_enforced?(resource) ⇒ Boolean
Whether the resource has an embargo that is currently enforced (regardless of whether it has expired).
- #embargo_history(resource) ⇒ Array
Instance Method Details
#assets_under_embargo ⇒ Object
8 9 10 |
# File 'app/helpers/hyrax/embargo_helper.rb', line 8 def @assets_under_embargo ||= EmbargoService. end |
#assets_with_deactivated_embargoes ⇒ Object
12 13 14 |
# File 'app/helpers/hyrax/embargo_helper.rb', line 12 def @assets_with_deactivated_embargoes ||= EmbargoService. end |
#assets_with_expired_embargoes ⇒ Object
4 5 6 |
# File 'app/helpers/hyrax/embargo_helper.rb', line 4 def @assets_with_expired_embargoes ||= EmbargoService. end |
#embargo_enforced?(resource) ⇒ Boolean
Note:
Hyrax::Forms::Failedsubmissionformwrapper is a place holder until we switch to Valkyrie::ChangeSet instead of Form objects
Returns whether the resource has an embargo that is currently enforced (regardless of whether it has expired).
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'app/helpers/hyrax/embargo_helper.rb', line 27 def (resource) # This is a guard; from the UI rendering perspective, there's no # active embargo enforcement until the object is saved. return false unless resource.persisted? case resource when Hydra::AccessControls::Embargoable !resource..nil? when HydraEditor::Form, Hyrax::Forms::FailedSubmissionFormWrapper (resource.model) when Valkyrie::ChangeSet Hyrax::EmbargoManager.new(resource: resource.model).enforced? else Hyrax::EmbargoManager.new(resource: resource).enforced? end end |
#embargo_history(resource) ⇒ Array
50 51 52 53 |
# File 'app/helpers/hyrax/embargo_helper.rb', line 50 def (resource) resource.try(:embargo_history) || Array(resource.&.) end |