Refactor the collapse logic in history timeline

Prevent that the last entry becomes collapsed.
Remove the callback logic from the history controller, template and
directive.
Add an entry count method in the collapseManager service.