calipso
calipso copied to clipboard
Add better comments to template module
So. If the example 'template' module has:
/**
* Every page block function
*/
function allPages(req, res, template, block, next) {
var myVariable = "Hello World on every page!";
var item = {
id: "NA",
type: 'content',
meta: {
variable: myVariable
}
};
calipso.theme.renderItem(req, res, template, block, {
item: item
},next);
};
Why doesn't a block with "Hello World on every page!" appear on every page? I started work on an admin toolbar module, https://github.com/adrinux/calipso/tree/module-toolbar but can't fathom why a block isn't appearing, despite looking at core/community modules.
The module needs to be turned on, and the block needs to be rendered in a template within the theme. If you look in the init function, you will see that by default that function renders to a block called 'right', so this needs to be included in the right.js / right.html in the theme (the name is just a key, you have to include it for it to appear).
You will see that for most things, the block is something like content.blah - and the theme typically uses a regex to render anything /content.*/ to the body element of a page. The template module isn't actually a great example any more, specifically with cleanslate as it doesn't include it by default ... needs to be fixed!
HTH
Clifton
Also - note on the other issue, is that it definitely shouldn't be called right! :)
On the other hand, including too many things in cleanslate would turn it into a misnomer.
I think that the 'template' module just needs beefier comments. A good place to start might be to paste your comment in this thread at the top of the template module.
@adrinux / cliftonc - comment & close [this thread]?
A more descriptive title - haven't had time to get back to this issue yet.
Will target a full breadth example / template module for the 0.3.0 release.