app/controllers/concerns/hyrax/embargoes_controller_behavior.rb in hyrax-2.1.0.beta1 vs app/controllers/concerns/hyrax/embargoes_controller_behavior.rb in hyrax-2.1.0.beta2

- old
+ new

@@ -3,10 +3,13 @@ extend ActiveSupport::Concern include Hyrax::ManagesEmbargoes include Hyrax::Collections::AcceptsBatches def index + add_breadcrumb t(:'hyrax.controls.home'), root_path + add_breadcrumb t(:'hyrax.dashboard.breadcrumbs.admin'), hyrax.dashboard_path + add_breadcrumb t(:'hyrax.embargoes.index.manage_embargoes'), hyrax.embargoes_path authorize! :index, Hydra::AccessControls::Embargo end # Removes a single embargo def destroy @@ -23,16 +26,29 @@ def update filter_docs_with_edit_access! copy_visibility = params[:embargoes].values.map { |h| h[:copy_visibility] } ActiveFedora::Base.find(batch).each do |curation_concern| Hyrax::Actors::EmbargoActor.new(curation_concern).destroy - curation_concern.copy_visibility_to_files if copy_visibility.include?(curation_concern.id) + # if the concern is a FileSet, set its visibility and skip the copy_visibility_to_files, which is built for Works + if curation_concern.file_set? + curation_concern.visibility = curation_concern.to_solr["visibility_after_embargo_ssim"] + curation_concern.save! + elsif copy_visibility.include?(curation_concern.id) + curation_concern.copy_visibility_to_files + end end redirect_to embargoes_path end # This allows us to use the unauthorized template in curation_concerns/base def self.local_prefixes ['hyrax/base'] + end + + def edit + add_breadcrumb t(:'hyrax.controls.home'), root_path + add_breadcrumb t(:'hyrax.dashboard.breadcrumbs.admin'), hyrax.dashboard_path + add_breadcrumb t(:'hyrax.embargoes.index.manage_embargoes'), hyrax.embargoes_path + add_breadcrumb t(:'hyrax.embargoes.edit.embargo_update'), '#' end end end