add events in templates