Refactored the modal pane into a mixin.

This commit refactors the jquery ui component used to display dialogues
into its own mixin and creates a dedicated 'database' model on the JS
side to better future-proof and componentize things.