Skip to content
This repository has been archived by the owner. It is now read-only.

Topic autocomplete #17

Merged
merged 2 commits into from Feb 15, 2018
Merged

Topic autocomplete #17

merged 2 commits into from Feb 15, 2018

Conversation

@fofr
Copy link
Contributor

@fofr fofr commented Feb 15, 2018

screen shot 2018-02-15 at 08 12 25

Select options generated from JSON quickly using:

options = [];
pushTaxon('', t);
function pushTaxon(current, branch) {
 for(var i in branch) {
  var taxon = branch[i];

  if (current != '') {
    title = ' > ' + taxon.title;
  } else {
    title = taxon.title;
  }
  
  options.push(current + title)

  if (taxon.links && taxon.links.child_taxons.length > 0) {
    pushTaxon(current + title, taxon.links.child_taxons);
  }
 }
}

for (i in options) {
  console.log(options[i]);
}
fofr added 2 commits Feb 15, 2018
Uses `> … >` instead of option names
Autocomplete doesn’t show parent so context gets lost when using
@fofr fofr merged commit fd08e08 into master Feb 15, 2018
@fofr fofr deleted the topic-autocomplete branch Feb 15, 2018
tombye pushed a commit that referenced this pull request Jun 8, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

1 participant
You can’t perform that action at this time.