Refactor tag editing with better validation.

Tidy up client side JS a little bit, and simplify server side view. Use
a form to validate the new tag input, and don't allow whitespace or
characters that'll horribly break URLs (?#&). Probably still needs other
characters filtered out. Add tests.