Skip to content

Commit

Permalink
Sort the admin sets for real life
Browse files Browse the repository at this point in the history
  • Loading branch information
dlpierce committed Dec 11, 2024
1 parent c3b6eec commit 1d72867
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion app/controllers/hyrax/my/works_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,20 @@ def managed_works_count
def admin_sets_for_select
source_ids = Hyrax::Collections::PermissionsService.source_ids_for_deposit(ability: current_ability, source_type: 'admin_set')

Hyrax.query_service.find_many_by_ids(ids: source_ids).map do |source|
admin_sets_list = Hyrax.query_service.find_many_by_ids(ids: source_ids).map do |source|
[source.title.first, source.id]
end

# Sorts the default admin set to be first, then the rest by title.
admin_sets_list.sort do |a, b|
if Hyrax::AdminSetCreateService.default_admin_set?(id: a[1])
-1
elsif Hyrax::AdminSetCreateService.default_admin_set?(id: b[1])
1
else
a[0] <=> b[0]
end
end
end
end
end
Expand Down

0 comments on commit 1d72867

Please sign in to comment.