Make sure the branch counter gets updated

When you delete a branch, the counters wont get updated automaticly,
this happends because of the JS nature of the original call. I've
fixed this by responding with a JS file, and recalculate the counters.

Fixes: #6030
Changed some stuff around after rebase
Merge pull request #6991 from jvanbaarsen/branch-counter-after-delete

Make sure the branch counter gets updated