0.0.6 • Published 9 years ago

isomagic-simpleapp v0.0.6

Weekly downloads
3
License
MIT
Repository
github
Last release
9 years ago

IsoMagic-simpleapp

IsoMagic extension that adds simple app capabilities

uses IsoMagic-template to translate a templateid, from res.templateid with data from res.data, and apply it to the app 'body', specified by the config bodySelector option

This extension requires IsoMagic-template. For details on template file structure, see that repository.

Sample Config file:

{
	"extensions" : [
		{
			"id":"simpleapp",
			"require":"isomagic-simpleapp",
			"filePath":"node_modules/isomagic-simpleapp/simpleapp.js"
			//optional parameter bodySelector described below.
		},
		{
			"id":"template",
			"require":"isomagic-template",
			"filePath":"node_modules/isomagic-template/template.js",
			"templateFiles":["myTemplates.html"]
		}
	], 
	"routes" : [
		{"middleware" : ["simpleapp#checkpage"]},
		{
			"method":"get",
			"route":"/", 
			"middleware" : [
				{"type":"simpleapp#usetemplate", "templateid":"homeTemplate"}
			]
		},
		{
			"method":"get",
			"route":"/foo", 
			"middleware" : [
				{"type":"simpleapp#usetemplate", "templateid":"fooTemplate"}
			]
		},
		{"middleware" : ["simpleapp#showpage"]}
	]
}

Config

  • bodySelector (String) default: "body" a jQuery selector for where the translated template will be applied if "simpleapp#showpage" is called

Middleware

  • checkpage - checks the "body" for the current page against req.originalUrl. If we're already there, halts the middleware chain
  • builder usetemplate * templateid: a templateid to be stored in res.templateid
  • builder setdata * data: some data object to be attached to res.data
  • showpage - translates res.templateid with res.data using IsoMagic-template, and puts the content into the "body" specified by bodySelector

TLC Formats

none included

0.0.6

9 years ago

0.0.5

9 years ago

0.0.4

9 years ago

0.0.3

9 years ago

0.0.2

9 years ago

0.0.1

9 years ago