Move JavaScript from dashboard template into its own module