refactors header notifications (renders them via separate controller)

Step 2 of the refactoring described here: https://github.com/discourse/discourse/pull/1615

It is mostly code reorganization (plus adding unit tests for everything), behavior is preservad 1:1 with the one small exception: previously when there was no topic title a completely empty link was displayed: `<a href=""></a>`. As such link is "invisible" for the user I thought it will make more sense to not display the link at all, so I generate nothing (empty string) instead in such case.