ext-starfall/chain.js
2016-05-31 23:31:25 +08:00

44 lines
922 B
JavaScript

"use strict";
const Dragonfly = global.Dragonfly;
const cl = global.botanLoader;
const doT = require("dot");
const OChain = cl.load( "botansx.mvc.model.chain" );
class Chain extends OChain
{
HFC( viewData, hfData, handler )
{
var _self = this;
viewData.modules.push(
"Astro.Starfall.Element.Header"
, "Astro.Starfall.Layout.MainFrame"
, "Astro.Starfall.Element.Footer"
);
var options = hfData.templating || {};
var chainHandler = function( def, data, _class )
{
var view = doT.template( data, options[ _class ], _self.utils );
viewData["footer"] = view( hfData );
handler();
};
var chainFooter = function( def, data, _class )
{
var view = doT.template( data, options[ _class ], _self.utils );
viewData["header"] = view( hfData );
_self.Template( "Element.Footer", chainHandler );
};
this.Template( "Element.Header", chainFooter );
}
}
module.exports = Chain;