I am moving over from vanilla backbone to Backbone.Marionette and am attempting to solve a common design pattern in a more Marionette style.
I have a common pattern of having a subview(childview) which can have multiple possible states, each state being an individual view or state composed of html and css.
One example of this is profile notes.
My application has a profile objects and each profile possesses a collection of notes.
The profile displays a list of it's notes as a CompositeView (NotesView) which is composed of an ItemView (NoteView) for each note in the collection.
Each NoteView has two possible states, a display state and an edit state. I am currently accomplishing this state change with html and css. In other places in my application I am handling this design pattern by switching between views (destroying old view, creating new view, appending new view).
What I would like to do is have two possible views for each note, NoteDisplayView and NoteEditView, and then control which is rendered by the NotesView.
After reading through the Marionette docs, it seems the Marionette solution to view swapping is to use a layout, region, and then define which view is 'shown' by the region.
I am unclear whether a layout can be embedded within a composite view and if this would nullify the advantages of a composite view.
I could obviously write some custom code to handle this situation, continue managing the state of the NoteView via html and css, but I am wondering what design patterns other Marionette users have found to accomplish this behavior.