Add support for dynamic templates for popover