From 9d6dfb50c539d5c11ee8fdc01a3a0d2f3ede950e Mon Sep 17 00:00:00 2001 From: Markus Graf Date: Tue, 6 Oct 2015 16:18:04 +0200 Subject: [PATCH] added template for autocomplete --- app/views/supporters/_form.slim | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/app/views/supporters/_form.slim b/app/views/supporters/_form.slim index 37d4383..bbef31e 100644 --- a/app/views/supporters/_form.slim +++ b/app/views/supporters/_form.slim @@ -22,9 +22,14 @@ javascript: $('#supporter_city').typeahead({ minLength: 2, - highlight: true, },{ - display: 'city', + limit: 20, + display: 'city', + templates: { + suggestion: function (data) { + return '

' + data.plz + ' - ' + data.city + '

'; + } + }, source: cities }).on('typeahead:selected', function(event, datum) { $("#supporter_zip").val(datum.plz); @@ -32,9 +37,14 @@ javascript: $('#supporter_zip').typeahead({ minLength: 2, - highlight: true, },{ + limit: 20, display: 'plz', + templates: { + suggestion: function (data) { + return '

' + data.plz + ' - ' + data.city + '

'; + } + }, source: cities }).on('typeahead:selected', function(event, datum) { $("#supporter_city").val(datum.city);