Paul Pound
12 years ago
6 changed files with 94 additions and 18 deletions
@ -0,0 +1,12 @@ |
|||||||
|
/* |
||||||
|
Document : roblib_search_evergreen |
||||||
|
Created on : Apr 11, 2013, 2:27:50 PM |
||||||
|
Author : ppound |
||||||
|
Description: |
||||||
|
Purpose of the stylesheet follows. |
||||||
|
*/ |
||||||
|
|
||||||
|
|
||||||
|
.evergreen-sor, .evergreen-date, .evergreen-holdings-item{ |
||||||
|
padding-left: 10px; font-size: smaller; |
||||||
|
} |
@ -1,23 +1,49 @@ |
|||||||
Drupal.behaviors.roblib_search_evergreen = { |
Drupal.behaviors.roblib_search_evergreen = { |
||||||
attach: function(context, settings) {
|
attach: function(context, settings) {
|
||||||
$url = settings.roblib_search_evergreen.search_url; |
url = settings.roblib_search_evergreen.search_url; |
||||||
jQuery.getJSON($url, function(data) { |
jQuery.getJSON(url, function(data) { |
||||||
var items = [];
|
var items = [];
|
||||||
if(data.length < 1){ |
if(data.length < 1){ |
||||||
jQuery('#' + 'roblib-search-content-evergreen').empty().append('No Results');
|
jQuery('#' + 'roblib-search-content-evergreen').empty().append('No Results');
|
||||||
} else { |
} else { |
||||||
jQuery.each(data, function(key, val) { |
jQuery.each(data, function(key, val) { |
||||||
|
|
||||||
items.push('<div class ="roblib-search-row">'); |
items.push('<div class ="roblib-search-row">'); |
||||||
items.push('<div class="roblib-title evergreen">'); |
items.push('<div class="roblib-title evergreen">'); |
||||||
items.push('<a href = "'+val.url+'">'+val.title+'</a></div>'); |
if (typeof val.title !== 'undefined') {
|
||||||
|
items.push('<a href = "'+val.url+'">'+val.title); |
||||||
|
} |
||||||
|
if (typeof val.subtitle !== 'undefined') { |
||||||
|
items.push(' ' + val.subtitle); |
||||||
|
}
|
||||||
|
items.push('</a></div>'); |
||||||
|
if (typeof val.sor !== 'undefined') { |
||||||
|
items.push('<div class="evergreen-sor">' + val.sor +'</div>'); |
||||||
|
}
|
||||||
|
if (typeof val.date !== 'undefined') { |
||||||
|
items.push('<div class="evergreen-date">' + val.date + '</div>') |
||||||
|
}
|
||||||
|
if(typeof val.holdings !== 'undefined'){ |
||||||
|
items.push('<div class="evergreen-holdings">'); |
||||||
|
jQuery.each(val.holdings, function(key2, val2){ |
||||||
|
roblibEvergreenAddHoldings(val2, items); |
||||||
|
}) |
||||||
|
items.push('</div>') |
||||||
|
} |
||||||
items.push('</div>'); |
items.push('</div>'); |
||||||
});
|
});
|
||||||
}
|
}
|
||||||
jQuery('#' + 'roblib-search-content-evergreen').empty().append(items.join('')); |
jQuery('#roblib-search-content-evergreen').empty().append(items.join('')); |
||||||
|
jQuery('#roblib-search-evergreen-more').empty().append('<a href = "' + data.catalogBaseSearchUrl + '">See all ' + data.numberOfRecords + ' results</a>'); |
||||||
}); |
}); |
||||||
} |
} |
||||||
|
|
||||||
} |
} |
||||||
|
|
||||||
|
function roblibEvergreenAddHoldings(holdings, items){ |
||||||
|
items.push('<div class="evergreen-holdings-item">' + holdings.call_number + ' ' + holdings.availability + '</div>'); |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in new issue