Closed cboulay closed 12 years ago
The navbar now has one dynamic slot. Call the navbar into the layout using something like the following.
myLayout.view(".navbar", new Navigation.Views.Navbar({href: "#edittournament/"+tournamentId, name: "Edit"}));
This is pretty flexible. In the future I might need all of the buttons to be a little more dynamic but then I will open a new issue.
It is possible to use a href: "#savetournament/"+tournamentId, then match that route to a save function that does all the saving then navigates to "#tournament/"+tournamentId. However, having a URL for saving a tournament is a problem because the user might use the back button or accidentally navigate there and a save will be triggered though there won't be any data to save.
Instead I would like for the save button's click to be bound to a function that saves the data then navigates backward. This is difficult to do with the navbar in its current implementation so I am reopening this issue while I consider whether to use the navbar to save or to use a separate button to save. If I use a separate button, then the navbar can be used for "cancel". If I use the navbar, then I probably need to expand the navigation module to use a collection and model and have every entry in the navbar be a rendering of each model. Finally, views that require the Save button will have to instantiate a navigation model, pass it a copy of the edited model, and bind it to a function that will save the model then do history.go(-1).
One advantage to having the save button separate, at the bottom, is that users might look for it at the bottom when they are done entering/editing data.
I decided to make the delete and save executed by buttons at the bottom of the edit screen. Cancel appears in the navbar. This behaviour is good enough for now so I can close this issue. I hope I don't need to reopen it.
"New" button when viewing lists of teams or tournaments. "Save" button when editing a (new) Team/Player/Tournament/Game Cancel will be handled by navigating back (swiping back depending on the browser).
"Save" will create/save the model then navigate back.