From 104249e19382211b40404424b60bf112761680a1 Mon Sep 17 00:00:00 2001 From: Markus Graf Date: Tue, 6 Oct 2015 16:23:52 +0200 Subject: [PATCH] refactoring --- app/views/supporters/_form.slim | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/views/supporters/_form.slim b/app/views/supporters/_form.slim index bbef31e..7317c7b 100644 --- a/app/views/supporters/_form.slim +++ b/app/views/supporters/_form.slim @@ -20,6 +20,10 @@ javascript: } }); + var suggestion_template = function (data) { + return '

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

'; + } + $('#supporter_city').typeahead({ minLength: 2, },{ @@ -27,7 +31,7 @@ javascript: display: 'city', templates: { suggestion: function (data) { - return '

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

'; + return suggestion_template(data); } }, source: cities @@ -42,7 +46,7 @@ javascript: display: 'plz', templates: { suggestion: function (data) { - return '

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

'; + return suggestion_template(data); } }, source: cities