Skip to content

Commit

Permalink
Merge pull request #2275 from samvera/user_collections
Browse files Browse the repository at this point in the history
Only load user's collections where they're used
  • Loading branch information
mjgiarlo authored Nov 28, 2017
2 parents fa7c48a + 99bb17c commit 6822da4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
7 changes: 7 additions & 0 deletions app/controllers/hyrax/my/works_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ def search_builder_class
end

def index
# The user's collections for the "add to collection" form
@user_collections = collections_service.search_results(:edit)

add_breadcrumb t(:'hyrax.controls.home'), root_path
add_breadcrumb t(:'hyrax.dashboard.breadcrumbs.admin'), hyrax.dashboard_path
add_breadcrumb t(:'hyrax.admin.sidebar.works'), hyrax.my_works_path
Expand All @@ -20,6 +23,10 @@ def index

private

def collections_service
Hyrax::CollectionsService.new(self)
end

def search_action_url(*args)
hyrax.my_works_url(*args)
end
Expand Down
8 changes: 0 additions & 8 deletions app/controllers/hyrax/my_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,6 @@ def self.configure_facets
helper_method :suppressed_to_status

def index
# The user's collections for the "add to collection" form
# TODO: could this be only on the My::WorksController?
@user_collections = collections_service.search_results(:edit)

@user = current_user
(@response, @document_list) = query_solr
prepare_instance_variables_for_batch_control_display
Expand All @@ -57,10 +53,6 @@ def suppressed_to_status(value)

private

def collections_service
Hyrax::CollectionsService.new(self)
end

# TODO: Extract a presenter object that wrangles all of these instance variables.
def prepare_instance_variables_for_batch_control_display
# set up some parameters for allowing the batch controls to show appropriately
Expand Down

0 comments on commit 6822da4

Please sign in to comment.