Merge pull request #415 from metamaps/less-autocomplete
only autocomplete topic/synapse if the user types more than 2 characters
This commit is contained in:
commit
a8dc64a6fe
1 changed files with 12 additions and 6 deletions
|
@ -665,8 +665,11 @@ Metamaps.Create = {
|
||||||
});
|
});
|
||||||
|
|
||||||
// initialize the autocomplete results for the metacode spinner
|
// initialize the autocomplete results for the metacode spinner
|
||||||
$('#topic_name').typeahead([
|
$('#topic_name').typeahead(
|
||||||
{
|
{
|
||||||
|
minLength: 2,
|
||||||
|
},
|
||||||
|
[{
|
||||||
name: 'topic_autocomplete',
|
name: 'topic_autocomplete',
|
||||||
limit: 8,
|
limit: 8,
|
||||||
template: $('#topicAutocompleteTemplate').html(),
|
template: $('#topicAutocompleteTemplate').html(),
|
||||||
|
@ -674,8 +677,8 @@ Metamaps.Create = {
|
||||||
url: '/topics/autocomplete_topic?term=%QUERY'
|
url: '/topics/autocomplete_topic?term=%QUERY'
|
||||||
},
|
},
|
||||||
engine: Hogan
|
engine: Hogan
|
||||||
}
|
}]
|
||||||
]);
|
);
|
||||||
|
|
||||||
// tell the autocomplete to submit the form with the topic you clicked on if you pick from the autocomplete
|
// 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) {
|
$('#topic_name').bind('typeahead:selected', function (event, datum, dataset) {
|
||||||
|
@ -724,8 +727,11 @@ Metamaps.Create = {
|
||||||
});
|
});
|
||||||
|
|
||||||
// initialize the autocomplete results for synapse creation
|
// initialize the autocomplete results for synapse creation
|
||||||
$('#synapse_desc').typeahead([
|
$('#synapse_desc').typeahead(
|
||||||
{
|
{
|
||||||
|
minLength: 2,
|
||||||
|
},
|
||||||
|
[{
|
||||||
name: 'synapse_autocomplete',
|
name: 'synapse_autocomplete',
|
||||||
template: "<div class='genericSynapseDesc'>{{label}}</div>",
|
template: "<div class='genericSynapseDesc'>{{label}}</div>",
|
||||||
remote: {
|
remote: {
|
||||||
|
@ -745,8 +751,8 @@ Metamaps.Create = {
|
||||||
},
|
},
|
||||||
engine: Hogan,
|
engine: Hogan,
|
||||||
header: "<h3>Existing synapses</h3>"
|
header: "<h3>Existing synapses</h3>"
|
||||||
}
|
}]
|
||||||
]);
|
);
|
||||||
|
|
||||||
$('#synapse_desc').bind('typeahead:selected', function (event, datum, dataset) {
|
$('#synapse_desc').bind('typeahead:selected', function (event, datum, dataset) {
|
||||||
if (datum.id) { // if they clicked on an existing synapse get it
|
if (datum.id) { // if they clicked on an existing synapse get it
|
||||||
|
|
Loading…
Reference in a new issue