Module: Hyrax::WorksHelper

Included in:
HyraxHelperBehavior
Defined in:
app/helpers/hyrax/works_helper.rb

Instance Method Summary collapse

Instance Method Details

#available_collections(work:) ⇒ Object



5
6
7
8
9
10
11
12
# File 'app/helpers/hyrax/works_helper.rb', line 5

def available_collections(work:)
  return [] if @current_ability.blank?

  all_collections = Hyrax::CollectionsService.new(self).search_results(:deposit)
  return all_collections if work.blank?

  all_collections.reject { |col| work.member_of_collection_ids.include?(col.id) }
end