UNPKG

alpha-one

Version:

ideas about recurring tasks in Web- and Backend-Application building

92 lines (79 loc) 2.4 kB
// Generated by CoffeeScript 1.7.1 (function() { var app_key, get_options, name_, request, teacup, templates; teacup = require('teacup'); for (name_ in teacup) { eval("" + (name_.toUpperCase()) + " = teacup[ " + (rpr(name_)) + " ]"); } templates = {}; app_key = 'alpha-one'; get_options = function(request) { var _ref; return (_ref = request[app_key]) != null ? _ref : {}; }; templates.layout = function(request, content) { var O, page_style, title, _ref, _ref1; O = get_options(request); page_style = (_ref = O['page-style']) != null ? _ref : 'plain'; title = (_ref1 = O['title']) != null ? _ref1 : 'welcome'; return RENDER((function(_this) { return function() { DOCTYPE(5); return HTML(function() { HEAD(function() { META({ charset: 'utf-8' }); return TITLE(title); }); return BODY("." + page_style, function() { return RAW(content); }); }); }; })(this)); }; templates.alternative_layout = function(request, content) { var O, page_style, title, _ref, _ref1; O = get_options(request); page_style = (_ref = O['page-style']) != null ? _ref : 'plain'; title = (_ref1 = O['title']) != null ? _ref1 : 'welcome'; return RENDER((function(_this) { return function() { DOCTYPE(5); return HTML(function() { HEAD(function() { META({ charset: 'utf-8' }); return TITLE(title); }); return BODY("." + page_style, DIV('.foo-wrapper', function() { return DIV('.bar-wrapper', function() { return DIV('.baz-wrapper', function() { return RAW(content); }); }); })); }); }; })(this)); }; templates.helo = function(request) { var O, layout, _ref; O = get_options(request); layout = (_ref = O['layout']) != null ? _ref : this.layout.bind(this); debug(O); return layout(request, RENDER((function(_this) { return function() { return DIV('#greeting', 'helo from teacup'); }; })(this))); }; request = {}; request[app_key] = { 'title': 'welcome to alpha-one', 'page-style': 'laid-back' }; info(templates.helo(request)); }).call(this);