Skip to content

Commit

Permalink
replaced overwritten homepage controller with decorator
Browse files Browse the repository at this point in the history
  • Loading branch information
maxturer committed Mar 4, 2024
1 parent 97a794a commit c090645
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 51 deletions.
51 changes: 0 additions & 51 deletions app/controllers/hyrax/homepage_controller.rb

This file was deleted.

17 changes: 17 additions & 0 deletions app/controllers/hyrax/homepage_controller_decorator.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# frozen_string_literal: true
# OVERRIDE Hyrax v3.6.0 to display 3 rather than 4 recent uploads
module Hyrax
module HomepageControllerDecorator
def recent
# grab any recent documents
(_, @recent_documents) = search_service.search_results do |builder|
builder.rows(3)
builder.merge(sort: sort_field)
end
rescue Blacklight::Exceptions::ECONNREFUSED, Blacklight::Exceptions::InvalidRequest
@recent_documents = []
end
end
end

Hyrax::HomepageController.prepend Hyrax::HomepageControllerDecorator

0 comments on commit c090645

Please sign in to comment.