Skip to content

Commit

Permalink
Replace spaces with hyphens (list of suggested tags and query submitt…
Browse files Browse the repository at this point in the history
…ed 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
  • Loading branch information
milaaraujo authored and jywarren committed Feb 26, 2018
1 parent 9874600 commit 694ae9c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions app/views/tag/_sorting.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
})
},
Expand All @@ -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, '-');
});

});
Expand Down

0 comments on commit 694ae9c

Please sign in to comment.