You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+13-4Lines changed: 13 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -214,7 +214,7 @@ list:
214
214
- Three
215
215
---
216
216
```
217
-
and **_context.js** files ([example](https://github.com/modularcode/modular-admin-html/blob/master/src/_context.js)).
217
+
and **_context.js** files.
218
218
```
219
219
module.exports = {
220
220
foo: 'bar',
@@ -227,17 +227,26 @@ module.exports = {
227
227
}
228
228
```
229
229
230
-
The final result of page context is compination of both ways. Moreover, different depth level _context.js files are extending each other and then are extended with YAML headers data. In our case we have ```src/_context.js``` file, where main website properties are defined and YAML headers in ```*-page.hbs``` files.
230
+
The final result of page context is compination of both ways. Moreover, different depth level _context.js files are extending each other and then are extended with YAML headers data. For simplicity we use only **YAML** headers.
231
231
232
232
#### Layouts (*-layout.hbs)
233
233
234
234
If different pages have lot of common components like sidebar, header, footer, It's a good idea to define a layout for those common pages and define in page files only the content which is unique.
235
235
236
236
Layout is a page content wrapper. If the page has layout in output we'll get page's content inserted into layout. Layouts should have ```{{{body}}}``` handlebars tag, which is entry point for page content. ([example](https://github.com/modularcode/modular-admin-html/blob/master/src/app/app-layout.hbs))
237
237
238
-
To define a page layout you need to specify page file context's ```layout``` variable. It can be done both by YAML header or _context.js file. ([example](https://github.com/modularcode/modular-admin-html/blob/master/src/app/forms/forms-page.hbs))
238
+
To define a page layout you need to specify page file context's ```layout``` variable. It can be done both by YAML header or _context.js file. ([example](https://github.com/modularcode/modular-admin-html/blob/master/src/app/forms/forms-page.hbs)).
239
239
240
-
If you need more advanced layouting you can use [handlebar-layouts](https://www.npmjs.com/package/handlebars-layouts) helper approach, which is also available out of the box.
240
+
Layouts can also have contexts and parent layouts.
241
+
242
+
```
243
+
{_main-layout.hbs} # main layout with doctype, head, scripts declaration
244
+
{app/app-layout.hbs} # dashboard layout with sidebar, header and footer
245
+
{app/forms/forms-page.hbs} # any dashboard page
246
+
```
247
+
248
+
249
+
If you need more advanced layouting with multiple content blocks at the same time you can use [handlebar-layouts](https://www.npmjs.com/package/handlebars-layouts) helper approach, which is also available out of the box.
0 commit comments