Better string-to-slug js function to generate identifiers

Used when generating suggestions for identifiers when creating spaces and
users. To test it, had to add capybara-webkit, that allows us to test js
with capybara.

refs #1379