Migrate and generalize template functions from Admin module to toplevel templates.lisp