Browse Source

added link to all search results for site target

2.x-ebsco
Paul Pound 10 years ago
parent
commit
31dbdf4bc7
  1. 10
      targets/solr_site/js/solr_site_results.js
  2. 6
      targets/solr_site/theme/theme.inc

10
targets/solr_site/js/solr_site_results.js

@ -1,7 +1,9 @@
Drupal.behaviors.roblib_search_solr_site_results = { Drupal.behaviors.roblib_search_solr_site_results = {
attach: function(context, settings) { attach: function(context, settings) {
$url = settings.roblib_search_solr_site_results.search_url; url = settings.roblib_search_solr_site_results.search_url;
jQuery.getJSON($url, function(data) { query = settings.roblib_search_solr_site_results.search_query;
baseUrl = settings.roblib_search_solr_site_results.base_url;
jQuery.getJSON(url, function(data) {
var items = []; var items = [];
var numberOfDocs = 0; var numberOfDocs = 0;
try { try {
@ -31,6 +33,10 @@ Drupal.behaviors.roblib_search_solr_site_results = {
qtipify(divs, content, 'Summary'); qtipify(divs, content, 'Summary');
} }
if (numberOfDocs > 0)
{
jQuery('#' + 'roblib-search-solr-site-results-more').empty().append('<a href="'+ baseUrl + '/search/site/' + query +'">see all results</a>');
}
}); });
} }

6
targets/solr_site/theme/theme.inc

@ -52,8 +52,10 @@ function roblib_search_solr_site_preprocessor(&$variables, $type) {
$spinner_path = $base_url . '/' . drupal_get_path('module', 'roblib_search') . '/img/' . 'spinner.gif'; $spinner_path = $base_url . '/' . drupal_get_path('module', 'roblib_search') . '/img/' . 'spinner.gif';
$variables['spinner_path'] = $spinner_path; $variables['spinner_path'] = $spinner_path;
$variables['type'] = $type; $variables['type'] = $type;
$search_url = $base_url . '/roblib_search/solr_site/' . $type . '/' . urlencode($query); $query = urlencode($query);
$search_url = $base_url . '/roblib_search/solr_site/' . $type . '/' . $query;
drupal_add_js(drupal_get_path('module', 'roblib_search_solr_site') . '/js/solr_site_' . $type . '.js'); drupal_add_js(drupal_get_path('module', 'roblib_search_solr_site') . '/js/solr_site_' . $type . '.js');
$key = 'roblib_search_solr_site_' . $type; $key = 'roblib_search_solr_site_' . $type;
drupal_add_js(array($key => array('search_url' => $search_url)), array('type' => 'setting')); drupal_add_js(array($key => array('search_url' => $search_url, 'search_query' => $query,
'base_url' => $base_url)), array('type' => 'setting'));
} }

Loading…
Cancel
Save