diff --git a/app/assets/javascripts/cited_documents.js b/app/assets/javascripts/cited_documents.js index f543d2fc2..6c75eac58 100644 --- a/app/assets/javascripts/cited_documents.js +++ b/app/assets/javascripts/cited_documents.js @@ -13,17 +13,17 @@ if (citedDocList[0].innerHTML != '') return; var data = $el.data(); - var solrQueryString = data.documentids.join(' OR '); + var queryIds = data.documentids.join(' '); + $.post(data.path, { - q: solrQueryString, + ids: queryIds, format: 'json', - rows: 1000 }, function (response) { - response.data.forEach(function(citedDocEntry) { + response.forEach(function(citedDocEntry) { var html = '
  • ' + - ' ' + - citedDocEntry.attributes.title_full_display.attributes.value + + ' ' + + citedDocEntry['title_display'] + '' + '
  • '; citedDocList.append(html); diff --git a/app/controllers/catalog_controller.rb b/app/controllers/catalog_controller.rb index 474402b89..92046ce77 100644 --- a/app/controllers/catalog_controller.rb +++ b/app/controllers/catalog_controller.rb @@ -483,6 +483,13 @@ def search_tips end end + def documents_list + search_service = Blacklight::SearchService.new(config: blacklight_config) + ids = params[:ids].present? ? params[:ids].split : [] + @documents = ids.empty? ? [] : search_service.fetch(ids, { :rows => 1000 }) + render json: @documents + end + class << self def document_has_full_text_and_search_is_query?(context, _config, document) context.params[:q].present? && document.full_text? diff --git a/app/views/catalog/_cited_documents_default.html.erb b/app/views/catalog/_cited_documents_default.html.erb index ee02efa14..c396a77f5 100644 --- a/app/views/catalog/_cited_documents_default.html.erb +++ b/app/views/catalog/_cited_documents_default.html.erb @@ -1,7 +1,7 @@ <% if @document.reference? && @document.cites_other_documents? %>
    diff --git a/config/routes.rb b/config/routes.rb index 6088503be..d7fcb3cf4 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -43,6 +43,7 @@ end get '/search_tips' => 'catalog#search_tips' + post '/documents_list' => 'catalog#documents_list', as: :documents_list resources :solr_documents, only: [:show], path: '/catalog', controller: 'catalog' resource :catalog, only: [:index], as: 'catalog', path: '/catalog', controller: 'catalog' do diff --git a/spec/features/manuscript_display_bibliography_spec.rb b/spec/features/manuscript_display_bibliography_spec.rb index d05f909cb..b408b2acb 100644 --- a/spec/features/manuscript_display_bibliography_spec.rb +++ b/spec/features/manuscript_display_bibliography_spec.rb @@ -28,7 +28,7 @@ end scenario 'cited documents element data required by async loader comes through to front end' do - expect(page).to have_css('div.record-metadata-section[data-path="/default-exhibit/catalog"]') + expect(page).to have_css('div.record-metadata-section[data-path="/documents_list"]') expect(page).to have_css("div.record-metadata-section[data-parentid=\"#{resource_id}\"]") expect(page).to have_css('div.record-metadata-section[data-documentids]') expect(page.find('div.record-metadata-section[data-documentids]')['data-documentids']).to eq(citations_string)