The two generic modals are defined in the base template, and are used in various templates. So provide functions and remove duplicate code.