Skip to content

Commit

Permalink
Merge pull request #182 from steventlamb/topic/remove_family_name_fro…
Browse files Browse the repository at this point in the history
…m_species_list

Topic/remove family name from species list
  • Loading branch information
Steve Lamb committed Jan 2, 2014
2 parents 083c748 + 899bacd commit 26b8ddb
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions static/treemap.js
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ tm = {
formatTreeName: function(item) {
var cultivar_portion = item.cultivar ? " '" + item.cultivar + "'" : " ";
return item.cname + " [ " + item.sname + " " + cultivar_portion +
" " + item.family + " " + item.other_part + "]";
" " + item.other_part + "]";
},

formatSpeciesName: function(item) {
Expand All @@ -496,17 +496,22 @@ tm = {

setupAutoComplete: function(field) {
return field.autocomplete({
source:function(request, response){
response( $.map( tm.speciesData, function( item ) {
if (item.cname.toLowerCase().indexOf(request.term.toLowerCase()) != -1 ||
item.sname.toLowerCase().indexOf(request.term.toLowerCase()) != -1)
{
return {
label: tm.formatTreeName(item),
value: item.id
}
source: function(request, response) {
response($.map(tm.speciesData, function(item) {
var lcTerm = request.term.toLowerCase(),
itemIContainsSearchTerm =
(item.cname.toLowerCase().indexOf(lcTerm) !== -1 ||
item.sname.toLowerCase().indexOf(lcTerm) !== -1);

if (itemIContainsSearchTerm) {
return {
label: tm.formatTreeName(item),
value: item.id
};
} else {
return null;
}
}));
}));
},
minLength: 1,
select: function(event, ui) {
Expand Down

0 comments on commit 26b8ddb

Please sign in to comment.