-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changed config so that IntlHTMLFrameMojit uses 'children' instead of …
…a 'child' object.
- Loading branch information
Joe Catera
committed
Jan 30, 2013
1 parent
e66f13d
commit 4da8f7d
Showing
7 changed files
with
207 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
[ | ||
{ | ||
"settings": [ "master" ], | ||
"appPort": "8666", | ||
"specs": { | ||
"ms": { | ||
"type": "IntlHTMLFrameMojit", | ||
"config": { | ||
"title": "Title of HTML page", | ||
"child" : { | ||
"type" : "FrameMojit", | ||
"config": { | ||
"children": { | ||
"header": { | ||
"type": "HeaderMojit" | ||
}, | ||
"body": { | ||
"type": "BodyMojit" | ||
}, | ||
"footer": { | ||
"type": "FooterMojit" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
{ | ||
"settings": [ "environment:development" ], | ||
"staticHandling": { | ||
"forceUpdate": true | ||
} | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
/* | ||
* Copyright (c) 2011-2013, Yahoo! Inc. All rights reserved. | ||
* Copyrights licensed under the New BSD License. | ||
* See the accompanying LICENSE file for terms. | ||
*/ | ||
|
||
|
||
/*jslint anon:true, sloppy:true, nomen:true*/ | ||
/*global YUI*/ | ||
|
||
|
||
YUI.add('IntlHTMLFrameMojit', function (Y, NAME) { | ||
|
||
'use strict'; | ||
|
||
Y.namespace('mojito.controllers')[NAME] = { | ||
|
||
index: function (ac) { | ||
this.__call(ac); | ||
}, | ||
|
||
__call: function (ac) { | ||
|
||
Y.log('executing IntlHTMLFrameMojit child', 'mojito', 'qeperf'); | ||
|
||
this._renderChild(ac, function (data, meta) { | ||
|
||
// meta.assets from child should be piped into | ||
// the frame's assets before doing anything else. | ||
ac.assets.addAssets(meta.assets); | ||
|
||
// SHAKER RUNTIME! | ||
// NOTE: We move the deployment of the client to within Shaker addon... | ||
ac.shaker.run(meta); | ||
|
||
Y.log('IntlHTMLFrameMojit done()', 'mojito', 'qeperf'); | ||
|
||
// 1. mixing bottom and top fragments from assets into | ||
// the template data, along with title and mojito version. | ||
// 2. mixing meta with child metas, along with some extra | ||
// headers. | ||
ac.done( | ||
Y.merge(data, ac.assets.renderLocations(), { | ||
"name": "IntlHtmlFrameMojit", | ||
"greeting": ac.intl.lang("GREETING"), | ||
"says": ac.intl.lang("SAYS"), | ||
"preposition": ac.intl.lang("PREPOSITION"), | ||
"today": ac.intl.formatDate(new Date()), | ||
"enableDynamicTitle": ac.config.get('enableDynamicTitle'), | ||
"mojito_version": Y.mojito.version | ||
|
||
}), | ||
Y.merge(meta, { | ||
|
||
http: { | ||
headers: { | ||
'content-type': 'text/html; charset="utf-8"' | ||
} | ||
}, | ||
|
||
view: { | ||
name: 'index' | ||
} | ||
|
||
}) | ||
); | ||
|
||
}); | ||
|
||
}, | ||
|
||
/** | ||
* Renders a child mojit based on a config called "child" and | ||
* the "assets" collection specified in the specs. | ||
* @method _renderChild | ||
* @protected | ||
* @param {Object} ac Action Context Object. | ||
* @param {Function} callback The callback. | ||
*/ | ||
_renderChild: function (ac, callback) { | ||
// Grab the "child" from the config an add it as the | ||
// only item in the "children" map. | ||
// var child = ac.config.get('child'), | ||
var children = ac.config.get('children'), | ||
cfg; | ||
|
||
// Map the action to the child if the action | ||
// is not specified as part of the child config. | ||
child.action = child.action || ac.action; | ||
Y.log(children); | ||
// Create a config object for the composite addon | ||
/* | ||
cfg = { | ||
children: { | ||
child: child | ||
}, | ||
assets: ac.config.get('assets') | ||
}; | ||
*/ | ||
|
||
cfg = { children, assets: ac.config.get('assets')}; | ||
// Now execute the child as a composite | ||
ac.composite.execute(cfg, callback); | ||
} | ||
|
||
}; | ||
|
||
}, '0.1.0', {requires: [ | ||
'mojito', | ||
'mojito-assets-addon', | ||
'mojito-deploy-addon', | ||
'mojito-config-addon', | ||
'mojito-composite-addon', | ||
'mojito-shaker-addon', | ||
'mojito-intl-addon' | ||
]}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<html> | ||
<head> | ||
<script type="text/javascript">var MOJITO_INIT=new Date().getTime();</script> | ||
{{#meta}} | ||
<meta name="{{name}}" content="{{content}}"> | ||
{{/meta}} | ||
{{^meta}} | ||
<meta name="creator" content="Yahoo! Mojito {{mojito_version}}"> | ||
{{/meta}} | ||
|
||
<title>{{title}}</title> | ||
|
||
{{{top}}} | ||
|
||
</head> | ||
<body> | ||
<div id="intl_frame" class="header" style="border: dashed black 1px; margin: 10px 10px 10px 10px;"> | ||
<h3>{{{name}}} {{{says}} {{{greeting}}} {{{preposition}}} {{{today}}}</h3> | ||
|
||
{{{child}}} | ||
|
||
{{{bottom}}} | ||
</div> | ||
|
||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters