Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

only uses admin sets if Hyrax is present #739

Merged
merged 1 commit into from
Feb 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/helpers/bulkrax/importers_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

module Bulkrax
module ImportersHelper
# borrowd from batch-importer https://github.com/samvera-labs/hyrax-batch_ingest/blob/main/app/controllers/hyrax/batch_ingest/batches_controller.rb
# borrowed from batch-importer https://github.com/samvera-labs/hyrax-batch_ingest/blob/main/app/controllers/hyrax/batch_ingest/batches_controller.rb
def available_admin_sets
# Restrict available_admin_sets to only those current user can desposit to.
# Restrict available_admin_sets to only those current user can deposit to.
@available_admin_sets ||= Hyrax::Collections::PermissionsService.source_ids_for_deposit(ability: current_ability, source_type: 'admin_set').map do |admin_set_id|
[AdminSet.find(admin_set_id).title.first, admin_set_id]
end
Expand Down
2 changes: 1 addition & 1 deletion app/models/bulkrax/importer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class Importer < ApplicationRecord
has_many :entries, as: :importerexporter, dependent: :destroy

validates :name, presence: true
validates :admin_set_id, presence: true
validates :admin_set_id, presence: true if defined?(::Hyrax)
validates :parser_klass, presence: true

delegate :valid_import?, :write_errored_entries_file, :visibility, to: :parser
Expand Down
2 changes: 1 addition & 1 deletion app/views/bulkrax/importers/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

<%= form.input :name, input_html: { class: 'form-control' } %>

<%= form.input :admin_set_id, collection: available_admin_sets %>
<%= form.input :admin_set_id, collection: available_admin_sets if defined?(::Hyrax) %>

<%= form.hidden_field :user_id, value: current_user.id %>

Expand Down