Web UI cleanup/refactoring, fixes #1247

- Pull out helpers into separate module
- Fix i18n strings to be loaded once, not every request
- Clearer separation between default and custom tabs
- Fix action redirects to contain the query string from the referrer so we don't lose our context upon redirect.
Merge branch 'master' into web_cleanup
update changes