diff --git a/app/assets/javascripts/src/Metamaps.js b/app/assets/javascripts/src/Metamaps.js index 2a378623..af0518d0 100644 --- a/app/assets/javascripts/src/Metamaps.js +++ b/app/assets/javascripts/src/Metamaps.js @@ -665,8 +665,11 @@ Metamaps.Create = { }); // initialize the autocomplete results for the metacode spinner - $('#topic_name').typeahead([ + $('#topic_name').typeahead( { + minLength: 2, + }, + [{ name: 'topic_autocomplete', limit: 8, template: $('#topicAutocompleteTemplate').html(), @@ -674,8 +677,8 @@ Metamaps.Create = { url: '/topics/autocomplete_topic?term=%QUERY' }, engine: Hogan - } - ]); + }] + ); // tell the autocomplete to submit the form with the topic you clicked on if you pick from the autocomplete $('#topic_name').bind('typeahead:selected', function (event, datum, dataset) { @@ -724,8 +727,11 @@ Metamaps.Create = { }); // initialize the autocomplete results for synapse creation - $('#synapse_desc').typeahead([ + $('#synapse_desc').typeahead( { + minLength: 2, + }, + [{ name: 'synapse_autocomplete', template: "
{{label}}
", remote: { @@ -745,8 +751,8 @@ Metamaps.Create = { }, engine: Hogan, header: "

Existing synapses

" - } - ]); + }] + ); $('#synapse_desc').bind('typeahead:selected', function (event, datum, dataset) { if (datum.id) { // if they clicked on an existing synapse get it