Feature: Edit a project
Let's add an edit project form for our feature Edit a project
. It consists of a text box for the project name a save and cancel button. Clicking on save will PUT the project to our Express server; clicking on cancel closes the form. We will use the same handlebars template we used for adding a project. In order to make RepositoryListView
editable, we will need to introduce the concept of an edit state. We have called editMode
.
Let's make some changes to projectView
. We start by adding a new event edit
to the events
hash, which calls an edit
function. We change our repository
method by passing a new arg.editMode
to event_aggregator
, which will inform our RepositoryListView
that it is in edit mode.
The edit
method, which displays our project formTemplate
, populated with our project
model data calls the repository
method with editMode
set to false
, informing RepositoryListView
that it is in edit mode. Finally, we update our add
, cancel
, and save
methods; calls in these...