Skip to content

Commit

Permalink
Use child taxa for icon images in popular taxonomy
Browse files Browse the repository at this point in the history
  • Loading branch information
pbb72 committed Aug 31, 2016
1 parent 5897330 commit 15929ca
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

## Unreleased

### Added
- Use child taxa for icon images in popular taxonomy

### Fixed
- Use child taxa for main image in popular taxonomy
- Support for species without image in popular taxonomy
Expand Down
16 changes: 10 additions & 6 deletions www/code/taxonomy.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ function readTaxaBiocachingFolkelig(data) {

if (data.collection.children.length > 0) {
data.collection.children.forEach(function(item) {
getData("https://api.biocaching.com/taxa/search?size=1&collection_id=" + item.id, readIconBiocachingFolkelig);
getData("https://api.biocaching.com/taxa/search?size=10&collection_id=" + item.id, readIconBiocachingFolkelig);
});
};
}
Expand Down Expand Up @@ -171,11 +171,15 @@ function readSpecieTaxaBiocachingFolkelig(data) {
}

function readIconBiocachingFolkelig(data) {
if (data.hits.length > 0 && data.hits[0]._source.primary_picture != null)
buildPage({descendents: [{
id: data.collection.id,
img: "https://api.biocaching.com" + data.hits[0]._source.primary_picture.urls.medium
}]});
for (var i = 0; i < data.hits.length; i++) {
if (data.hits[i]._source.primary_picture != null) {
buildPage({descendents: [{
id: data.collection.id,
img: "https://api.biocaching.com" + data.hits[i]._source.primary_picture.urls.medium
}]});
break;
}
}
}

/* ================ Encyclopedia of Life =================== */
Expand Down

0 comments on commit 15929ca

Please sign in to comment.