bliss icon indicating copy to clipboard operation
bliss copied to clipboard

Documentation example for global vars

Open tracker1 opened this issue 12 years ago • 1 comments

It might be worth it to outline specifically that you can have an example context... the below allowing one to extend viewbag in the view, then when rendering down to the layout, it can be utilized...

context: { 
  viewbag:{} 
}

which should allow you to attach parameters to the viewbag, such as viewbag.title, that will be carried out to a layout. Which will be somewhat similar to what you may be used to...

Another suggestion of convention would be to pass (regions/model) as a single argument... This way certain conventions can be extended while keeping the same signature... such as the (error,data,callback) signature in a lot of node itself... if a layout gets (regions) and the target view or partial gets a (model), while this would take a bit more effort to utilize, it's just a thought.

layout.cs.html

@(regions)
...
  @regions.side()
...
  @regions.body()
...

index.cs.html

@(model)
@function side() { ...}
@function body() {...}
@render('layout',{side:side,body:body})

tracker1 avatar Aug 29 '12 23:08 tracker1

Thank you for this. I will think about this.

cstivers78 avatar Aug 30 '12 09:08 cstivers78