-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3871687
commit c5fce24
Showing
3 changed files
with
43 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/** | ||
* Populate Images tab body with images via AJAX call to Biocache | ||
*/ | ||
function loadImagesTab() { | ||
var wsBase = "/occurrences/search.json"; | ||
var uiBase = "/occurrences/search"; | ||
var imagesQueryUrl = "?facets=type_status&fq=multimedia%3AImage&pageSize=100&q=collectionUid:" + SHOW_REC.instanceUuid; | ||
$.ajax({ | ||
url: SHOW_REC.biocacheServicesUrl + wsBase + imagesQueryUrl, | ||
dataType: 'jsonp', | ||
timeout: 20000, | ||
complete: function(jqXHR, textStatus) { | ||
if (textStatus == 'timeout') { | ||
noBiocacheData(); | ||
} | ||
if (textStatus == 'error') { | ||
noBiocacheData(); | ||
} | ||
}, | ||
success: function(data) { | ||
// check for errors | ||
if (data.length == 0 || data.totalRecords == undefined || data.totalRecords == 0) { | ||
//noBiocacheData(); | ||
} else { | ||
if(data.totalRecords > 0){ | ||
$('#imagesTabEl').css({display:'block'}); | ||
var description = "" | ||
$('#imagesSpiel').html('<p><a href="' + SHOW_REC.biocacheWebappUrl + uiBase + imagesQueryUrl +'">' + data.totalRecords + ' images</a> have been made available from the ' + SHOW_REC.instanceName + '. <br/> ' + description + '</p>'); | ||
$.each(data.occurrences, function(idx, item){ | ||
var imageText = item.scientificName; | ||
if(item.typeStatus !== undefined){ | ||
imageText = item.typeStatus + " - " + imageText; | ||
} | ||
$('#imagesList').append('<div class="imgCon"><a href="' + SHOW_REC.biocacheWebappUrl + '/occurrences/' + item.uuid + '"><img src="' + item.smallImageUrl + '"/><br/>'+ imageText + '</a></div>'); | ||
}) | ||
} | ||
} | ||
} | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters