From 694ae9cfc4b521f373e495d5196eaa592190b152 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camila=20Ara=C3=BAjo?= Date: Mon, 26 Feb 2018 15:47:01 -0800 Subject: [PATCH] Replace spaces with hyphens (list of suggested tags and query submitted in the form) (#2380) * fix issue #2335 Fix issue #2335, replacing spaces with hyphens as people type. * fixing #2335 fixes #2335, replacing all spaces with hyphens --- app/views/tag/_sorting.html.erb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/views/tag/_sorting.html.erb b/app/views/tag/_sorting.html.erb index 5238db3784..ecfc99ed65 100644 --- a/app/views/tag/_sorting.html.erb +++ b/app/views/tag/_sorting.html.erb @@ -14,7 +14,8 @@ items: 8, minLength: 3, source: function (query, process) { - return $.post('/tag/suggested/' + query, {}, function (data) { + var replaced_query = query.replace(' ', /-/g); + return $.post('/tag/suggested/' + replaced_query, {}, function (data) { return process(data) }) }, @@ -26,7 +27,7 @@ $('#tagform').submit(function(e) { e.preventDefault(); - window.location = "/questions/tag/" + $('#taginput').val(); + window.location = "/questions/tag/" + ($('#taginput').val()).replace(/\s/g, '-'); }); });