add method input field typeahead support

using this bootstrap3 backport of the bold bootstrap2 typeahead
component because twitter typeahead.js is poop
This commit is contained in:
Gered 2014-04-06 20:22:33 -04:00
parent 30d1e5ccce
commit 90cb98de15
3 changed files with 13 additions and 0 deletions

File diff suppressed because one or more lines are too long

View file

@ -65,6 +65,17 @@ function getAdditionalUrl(form) {
}
$(document).ready(function() {
$('input[data-typeahead-url]').each(function() {
var element = $(this);
var typeaheadUrl = element.data('typeahead-url');
element.typeahead({source: function(query, process) {
return $.get(typeaheadUrl, { q: query }, function (data) {
return process(data);
});
}});
});
$('form.api-form').submit(function(e) {
e.preventDefault();

View file

@ -12,6 +12,7 @@
{{ javascript('/js/jquery.min.js') }}
{{ javascript('/js/bootstrap.min.js') }}
{{ javascript('/js/bootstrap3-typeahead.min.js') }}
{{ javascript('/js/site.js') }}
<script type="text/javascript">