Fix exception for _get_db_version

An exception should now be correctly thrown if there is no comment in
the database.
Improve prefix insertion time

Profiling (see #589) showed that calc_tags ate up a lot of CPU time and
this changes when we invoke calc_tags, essentially removing one case
which should be completely useless. When a new prefix is inserted, it
would invoke calc_tags on the parent prefix to set the inherited_tags on
the new prefix, but the before-trigger has already set the
inherited_tags of the new prefix, so it's a useless operation that not
only touches the new prefix but also all other prefixes within the same
parent prefix. Same features as before, only higher performance.

There are further improvements that can be done and I've added TODO
entries for some of them.

Fixes #589.
Merge pull request #592 from plajjan/589-improve-prefix-inserts

Improve prefix insertion time
Merge pull request #588 from dosomder/586-fix-exception-db-version

Fix exception for _get_db_version
Fix nipapd sqlite file leak

An open instance in the main thread prevented others from being closed.
Merge pull request #591 from dosomder/485-close-sqlitedb

Fix nipapd sqlite file leak
Split AngularJS definitions into multiple files

Splitted the AngularJS code into multiple files to get some structure.
In the future we'll probably want to split it even further, but IMHO
this'll suffice for now.
Merge pull request #593 from garberg/split_ng

Split AngularJS definitions into multiple files