Skip to content

Commit

Permalink
Merge branch 'develop-perf' of git://github.com/yahoo/mojito into par…
Browse files Browse the repository at this point in the history
…tials
  • Loading branch information
caridy committed Nov 17, 2012
2 parents a2311e4 + 5457737 commit 82fcda6
Show file tree
Hide file tree
Showing 135 changed files with 110 additions and 2,965 deletions.
40 changes: 14 additions & 26 deletions docs/dev_guide/code_exs/route_config.rst
Expand Up @@ -161,56 +161,45 @@ To set up and run ``configure_routing``:
.. code-block:: javascript .. code-block:: javascript
YUI.add('RoutingMojit', function(Y, NAME) { YUI.add('RoutingMojit', function(Y, NAME) {
Y.namespace('mojito.controllers')[NAME] = {
index: function(ac) {
ac.done(route_info(ac));
},
show: function(ac){
ac.done(route_info(ac));
}
};
// Builds object containing route information // Builds object containing route information
function route_info(ac) { function route_info(ac) {
var methods = "", var methods = "",
name = "", name = "",
action = ac.action, action = ac.action,
path = ac.http.getRequest().url; path = ac.http.getRequest().url,
ac.url.getRouteMaker(); routes = ac.config.getRoutes();
if (action === "index" && path === "/") { if (action === "index" && path === "/") {
name = ac.app.routes.root_route.name; name = "root_route";
Object.keys(ac.app.routes.root_route.verbs).forEach(function(n) { routes.root_route.verbs.forEach(function(n) {
methods += n + ", "; methods += n + ", ";
}); });
} else if (action === "index") { } else if (action==="index") {
name = ac.app.routes.index_route.name; name = "index_route";
Object.keys(ac.app.routes.index_route.verbs).forEach(function(n) { routes.index_route.verbs.forEach(function(n) {
methods += n + ", "; methods += n + ", ";
}); });
} else { } else {
name = ac.app.routes.show_route.name; name = "show_route";
Object.keys(ac.app.routes.show_route.verbs).forEach(function(n) { routes.show_route.verbs.forEach(function(n) {
methods += n + ", "; methods += n + ", ";
}); });
} }
methods = methods.toUpperCase();
return { return {
"path": path, "path": path,
"name": name, "name": name,
"methods": methods.replace(/, $/, "") "methods": methods.replace(/, $/, "")
}; };
} }
Y.namespace('mojito.controllers')[NAME] = { Y.namespace('mojito.controllers')[NAME] = {
init: function (config) {
this.config = config;
},
index: function (ac) { index: function (ac) {
ac.done(route_info(ac)); ac.done(route_info(ac));
}, },
show: function (ac) { show: function (ac) {
ac.done(route_info(ac)); ac.done(route_info(ac));
} }
}; };
}, '0.0.1', {requires: ['mojito-url-addon', 'mojito-http-addon']}); }, '0.0.1', {requires: ['mojito-config-addon', 'mojito-http-addon']});
#. To display your route information in your ``index`` template, replace the content of #. To display your route information in your ``index`` template, replace the content of
``index.hb.html`` with the following: ``index.hb.html`` with the following:
Expand Down Expand Up @@ -249,4 +238,3 @@ Source Code
- `Route Configuration <http://github.com/yahoo/mojito/tree/master/examples/developer-guide/configure_routing/routes.json>`_ - `Route Configuration <http://github.com/yahoo/mojito/tree/master/examples/developer-guide/configure_routing/routes.json>`_
- `Configure Routing Application <http://github.com/yahoo/mojito/tree/master/examples/developer-guide/configure_routing/>`_ - `Configure Routing Application <http://github.com/yahoo/mojito/tree/master/examples/developer-guide/configure_routing/>`_



2 changes: 1 addition & 1 deletion docs/dev_guide/reference/mojito_troubleshooting.rst
Expand Up @@ -38,7 +38,7 @@ an error or the value is not found.*
**A:** **A:**
Try inspecting the ``spec`` object that is found in the ``ActionContext`` object for the Try inspecting the ``spec`` object that is found in the ``ActionContext`` object for the
key. If ``ac`` is the ``ActionContext`` object, you can access the ``specs` object with the key. If ``ac`` is the ``ActionContext`` object, you can access the ``specs` object with the
following: ``ac.app.config.specs``. following: ``ac.config.getAppConfig().specs``.


If you need to examine the entire ``ActionContext`` object, you can use the If you need to examine the entire ``ActionContext`` object, you can use the
``console.log(ac)`` or the following code: ``console.log(ac)`` or the following code:
Expand Down
Expand Up @@ -2,18 +2,15 @@


YUI.add('myMojit', function (Y, NAME) { YUI.add('myMojit', function (Y, NAME) {


Y.mojito.controllers[NAME] = { Y.namespace('mojito.controllers')[NAME] = {


init: function (config) {
this.config = config;
},
default_ve: function (ac) { default_ve: function (ac) {
ac.done({ ac.done({
"title": "Handlebars at work!", "title": "Handlebars at work!",
"view_engines": [ "view_engines": [
{"name": "EJS"}, {"name": "EJS"},
{"name": "Jade"}, {"name": "Jade"},
{"name": "dust"}, {"name": "Dust"},
{"name": "underscore" } {"name": "underscore" }
], ],
"ul": { "title": 'Here are some of the other available rendering engines:' } "ul": { "title": 'Here are some of the other available rendering engines:' }
Expand All @@ -27,4 +24,4 @@ YUI.add('myMojit', function (Y, NAME) {
}); });
} }
}; };
}, '0.0.1', {requires: ['mojito', 'myMojitModelFoo']}); }, '0.0.1', {requires: ['mojito', 'myMojitModelFoo']});
Expand Up @@ -16,7 +16,7 @@ YUI.add('myMojitModelFoo', function(Y, NAME) {
* @class myMojitModelFoo * @class myMojitModelFoo
* @constructor * @constructor
*/ */
Y.mojito.models[NAME] = { Y.namespace('mojito.models')[NAME] = {


init: function(config) { init: function(config) {
this.config = config; this.config = config;
Expand All @@ -34,4 +34,4 @@ YUI.add('myMojitModelFoo', function(Y, NAME) {


}; };


}, '0.0.1', {requires: ['mojito']}); }, '0.0.1', {requires: []});

This file was deleted.

This file was deleted.

This file was deleted.

Expand Up @@ -38,9 +38,6 @@ YUI.add('PagerMojit', function (Y, NAME) {
* @constructor * @constructor
*/ */
Y.namespace('mojito.controllers')[NAME] = { Y.namespace('mojito.controllers')[NAME] = {
init: function(config) {
this.config = config;
},
index: function(actionContext) { index: function(actionContext) {
var page = 0, var page = 0,
start, start,
Expand Down
Expand Up @@ -6,19 +6,19 @@


/*jslint anon:true, sloppy:true, nomen:true*/ /*jslint anon:true, sloppy:true, nomen:true*/


YUI.add('PagerMojitModel', function(Y) { YUI.add('PagerMojitModel', function(Y, NAME) {
var API_KEY = '84921e87fb8f2fc338c3ff9bf51a412e'; var API_KEY = '84921e87fb8f2fc338c3ff9bf51a412e';


/** /**
* The PagerMojitModel module. * The PagerMojitModel module.
* @module PagerMojitModel * @module PagerMojitModel
*/ */
/** /**
* Constructor for the Model class. * Constructor for the Model class.
* @class Model * @class Model
* @constructor * @constructor
*/ */
Y.mojito.models.PagerMojitModel = { Y.namespace('mojito.models')[NAME] = {
init: function(config) { init: function(config) {
this.config = config; this.config = config;
}, },
Expand Down Expand Up @@ -57,8 +57,4 @@ YUI.add('PagerMojitModel', function(Y) {
}); });
} }
}; };
}, '0.0.1', {requires: [ }, '0.0.1', {requires: ['mojito', 'yql']});
'mojito',
'mojito-models-addon',
'yql'
]});

This file was deleted.

0 comments on commit 82fcda6

Please sign in to comment.