I am currently working on a recipe template where I am using {{#each recipes}} to render the recipes. I have implemented ReactiveVar to toggle the edit form of each recipe from hide to show. Everything is functioning correctly, but I want to ensure that when I click the edit button for one recipe, all other open recipe forms are set to hide.
Template.Recipe.onCreated(function(){
this.editMode = new ReactiveVar(false);
});
Template.Recipe.helpers({
editMode: function() {
return Template.instance().editMode.get();
}
});
Template.Recipe.events({
'click .fa-pencil': function(event, template) {
//I need to include something here to reset all other "editMode" variables to false
template.editMode.set(!template.editMode.get());
},
});