Moving shared logic to editor and display templates