refactoring

This commit is contained in:
2015-10-06 16:23:52 +02:00
parent 9d6dfb50c5
commit 104249e193
+6 -2
View File
@@ -20,6 +20,10 @@ javascript:
} }
}); });
var suggestion_template = function (data) {
return '<p>' + data.plz + ' - ' + data.city + '</p>';
}
$('#supporter_city').typeahead({ $('#supporter_city').typeahead({
minLength: 2, minLength: 2,
},{ },{
@@ -27,7 +31,7 @@ javascript:
display: 'city', display: 'city',
templates: { templates: {
suggestion: function (data) { suggestion: function (data) {
return '<p><strong>' + data.plz + '</strong> - ' + data.city + '</p>'; return suggestion_template(data);
} }
}, },
source: cities source: cities
@@ -42,7 +46,7 @@ javascript:
display: 'plz', display: 'plz',
templates: { templates: {
suggestion: function (data) { suggestion: function (data) {
return '<p><strong>' + data.plz + '</strong> - ' + data.city + '</p>'; return suggestion_template(data);
} }
}, },
source: cities source: cities