calipso icon indicating copy to clipboard operation
calipso copied to clipboard

Add better comments to template module

Open adrinux opened this issue 13 years ago • 6 comments

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.

adrinux avatar Jun 09 '11 21:06 adrinux

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

cliftonc avatar Jun 10 '11 06:06 cliftonc

Also - note on the other issue, is that it definitely shouldn't be called right! :)

cliftonc avatar Jun 10 '11 06:06 cliftonc

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.

dennishall avatar Jul 08 '11 11:07 dennishall

@adrinux / cliftonc - comment & close [this thread]?

dennishall avatar Jul 08 '11 11:07 dennishall

A more descriptive title - haven't had time to get back to this issue yet.

adrinux avatar Jul 08 '11 11:07 adrinux

Will target a full breadth example / template module for the 0.3.0 release.

cliftonc avatar Sep 26 '11 06:09 cliftonc