Skip to content

Commit

Permalink
Pass the correct data attribute value to the work search
Browse files Browse the repository at this point in the history
  • Loading branch information
jcoyne committed Jun 9, 2017
1 parent 752022f commit 8a0a956
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/assets/javascripts/hyrax/autocomplete.es6
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export default class Autocomplete {
new Work(
element,
url,
element.data('id')
element.data('exclude-work')
)
break
case 'based_near':
Expand Down
2 changes: 2 additions & 0 deletions app/authorities/qa/authorities/find_works.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
module Qa::Authorities
class FindWorks < Qa::Authorities::Base
def search(_q, controller)
# The FindWorksSearchBuilder expects a current_user
return [] unless controller.current_user
repo = CatalogController.new.repository
builder = Hyrax::FindWorksSearchBuilder.new(controller)
response = repo.search(builder)
Expand Down
3 changes: 2 additions & 1 deletion app/search_builders/hyrax/find_works_search_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ class Hyrax::FindWorksSearchBuilder < Hyrax::SearchBuilder
# Excludes the id that is part of the params
def initialize(context)
super(context)
@id = context.params[:id]
# Without an id this class will produce an invalid query.
@id = context.params[:id] || raise("missing required parameter: id")
@q = context.params[:q]
end

Expand Down

0 comments on commit 8a0a956

Please sign in to comment.