Skip to content
This repository has been archived by the owner on Oct 30, 2018. It is now read-only.

Commit

Permalink
merge develop into develop-perf
Browse files Browse the repository at this point in the history
  • Loading branch information
drewfish committed Oct 15, 2012
1 parent 6403297 commit e5a44b3
Show file tree
Hide file tree
Showing 140 changed files with 2,381 additions and 1,951 deletions.
18 changes: 12 additions & 6 deletions docs/dev_guide/api_overview/index.rst
Expand Up @@ -3,15 +3,21 @@
Mojito API Overview
===================

This section introduces some of the main features of the Mojito API. Please see the `Mojito API documentation <../../api/>`_ that has been built using `YUI Doc <http://yuilibrary.com/projects/yuidoc>`_ and is continuously updated.
This section introduces some of the main features of the Mojito API. Please see the
`Mojito API documentation <../../api/>`_ that has been built using
`YUI Doc <http://yuilibrary.com/projects/yuidoc>`_ and is continuously updated.

The API contains the following five modules:

- **ActionContext** - is a key module of the Mojito framework, giving you access to the frameworks features from within a controller function.
- **Addons** - extensions that provide functionality that lives both on the server and/or client. Each addon provides additional functions through a namespace that is attached directly to the ``Action Context`` object available in every controller function.
- **CommonLibs** - is a utility library containing methods to handle cookies, access input parameters, and make REST calls.
- **MojitoClient** - is the client-side Mojito runtime module containing methods that allow inter-mojit communication through the ``mojitProxy`` object.

- **ActionContext** - is a key module of the Mojito framework, giving you access to the frameworks
features from within a controller function.
- **Addons** - extensions that provide functionality that lives both on the server and/or client.
Each addon provides additional functions through a namespace that is attached directly to the
``Action Context`` object available in every controller function.
- **CommonLibs** - is a utility library containing methods to handle cookies, access input
parameters, and make REST calls.
- **MojitoClient** - is the client-side Mojito runtime module containing methods that allow
inter-mojit communication through the ``mojitProxy`` object.
- **MojitServer** - is the module that provides access to the Mojito server.


Expand Down
17 changes: 10 additions & 7 deletions docs/dev_guide/api_overview/mojito_action_context.rst
Expand Up @@ -4,16 +4,19 @@
Action Context
==============

The Action Context is an essential element of the Mojito framework that gives you access to the frameworks features from within a controller function. To use the Action Context,
you create an instance of the ``ActionContext`` class, which we will call ``ac`` for short. From ``ac``, you can call methods to execute mojit actions within either a server or
client context. See the `ActionContext Class <../../api/classes/ActionContext.html>`_ for the methods available from ``ac``.

One of the most common methods used from an instance of the ``ActionContext`` class is ``done``, which lets you pass data from the controller to a view. In the example ``controller.server.js`` below,
The Action Context is an essential element of the Mojito framework that gives you access to the
frameworks features from within a controller function. To use the Action Context, you create an
instance of the ``ActionContext`` class, which we will call ``ac`` for short. From ``ac``, you can
call methods to execute mojit actions within either a server or client context. See the
`ActionContext Class <../../api/classes/ActionContext.html>`_ for the methods available from ``ac``.

One of the most common methods used from an instance of the ``ActionContext`` class is ``done``,
which lets you pass data from the controller to a view. In the example ``controller.server.js`` below,
the ``done`` method sends the ``data`` object to the ``index`` template.

.. code-block:: javascript
YUI.add('HelloMojit', function(Y) {
YUI.add('HelloMojit', function(Y, NAME) {
/**
* The HelloMojit module.
*
Expand All @@ -25,7 +28,7 @@ the ``done`` method sends the ``data`` object to the ``index`` template.
* @class Controller
* @constructor
*/
Y.mojito.controller = {
Y.namespace('mojito.controllers')[NAME] = {
init: function(config) {
this.config = config;
},
Expand Down
16 changes: 11 additions & 5 deletions docs/dev_guide/api_overview/mojito_addons.rst
Expand Up @@ -4,8 +4,10 @@
Addons
======

The Action Context uses a mechanism called addons to provide functionality that lives both on the server and client. Each addon provides additional functions through a namespacing object,
which is appended to the ``ActionContext`` object that is available in every controller function. See the `ActionContext Class <../../api/classes/ActionContext.html>`_ for the addon classes.
The Action Context uses a mechanism called addons to provide functionality that lives both on the
server and client. Each addon provides additional functions through a namespacing object,
which is appended to the ``ActionContext`` object that is available in every controller function.
See the `ActionContext Class <../../api/classes/ActionContext.html>`_ for the addon classes.

Addons allow you to do the following:

Expand All @@ -20,11 +22,13 @@ Addons allow you to do the following:
Syntax
######

Using the ActionContext object ``ac``, you would call a ``{method}`` from an ``{addon}`` with the following syntax:
Using the ActionContext object ``ac``, you would call a ``{method}`` from an ``{addon}`` with the
following syntax:

``ac.{addon}.{method}``

For example, to get all of the query string parameters, you would use the ``Params`` addon with the ``url`` method as seen here:
For example, to get all of the query string parameters, you would use the ``Params`` addon with the
``url`` method as seen here:

``ac.params.url()``

Expand All @@ -43,6 +47,8 @@ The following code examples use the addons in parentheses:
Creating Addons
###############

Because customized addons are not part of the standard API, but an extension of the API, the instructions for creating addons can be found in `Creating New Addons <../topics/mojito_extensions.html#creating-new-addons>`_.
Because customized addons are not part of the standard API, but an extension of the API, the
instructions for creating addons can be found in
`Creating New Addons <../topics/mojito_extensions.html#creating-new-addons>`_.


8 changes: 4 additions & 4 deletions docs/dev_guide/api_overview/mojito_rest_lib.rst
Expand Up @@ -17,7 +17,7 @@ instructs YUI to load the library. Once the library is loaded, you can use

.. code-block:: javascript
YUI.add('MyModel', function(Y) {
YUI.add('MyModel', function(Y, NAME) {
...
// Make the REST call.
Y.mojito.lib.REST.GET("http://example.com");
Expand All @@ -33,9 +33,9 @@ the Recipe Puppy API.

.. code-block:: javascript
YUI.add('ProductSearchModel', function(Y) {
Y.mojito.models.RecipeSearch = {
init: function(config) {
YUI.add('ProductSearchModel', function(Y, NAME) {
Y.namespace('mojito.models')[NAME] = {
init: function(config) {
this.config = config;
},
recipeSearch: function(count, cb) {
Expand Down
7 changes: 4 additions & 3 deletions docs/dev_guide/code_exs/adding_assets.rst
Expand Up @@ -171,7 +171,7 @@ To create and run ``simple_assets``:

.. code-block:: javascript
YUI.add('simple', function(Y,NAME) {
YUI.add('simple', function(Y, NAME) {
/**
* The simple module.
*
Expand All @@ -183,7 +183,7 @@ To create and run ``simple_assets``:
* @class Controller
* @constructor
*/
Y.mojito.controllers[NAME] = {
Y.namespace('mojito.controllers')[NAME] = {
init: function(config) {
this.config = config;
},
Expand All @@ -208,7 +208,8 @@ To create and run ``simple_assets``:
};
}, '0.0.1', {requires: []});
#. Include the assets in your template by replacing the code in ``views/index.hb.html`` with the following:
#. Include the assets in your template by replacing the code in ``views/index.hb.html`` with the
following:

.. code-block:: html

Expand Down
20 changes: 10 additions & 10 deletions docs/dev_guide/code_exs/binding_events.rst
Expand Up @@ -61,7 +61,7 @@ get Flickr photo information. To access the utility in your model, specify ``'yq

.. code-block:: javascript
YUI.add('PagerMojitModel', function(Y,NAME) {
YUI.add('PagerMojitModel', function(Y, NAME) {
...
/* Code for PagerMojitModel */
...
Expand All @@ -87,7 +87,7 @@ the controller through the ``callback`` function.

.. code-block:: javascript
YUI.add('PagerMojitModel', function(Y,NAME) {
YUI.add('PagerMojitModel', function(Y, NAME) {
/**
* The PagerMojitModel module.
* @module PagerMojitModel
Expand All @@ -97,7 +97,7 @@ the controller through the ``callback`` function.
* @class Model
* @constructor
**/
Y.mojito.models.simple = {
Y.namespace('mojito.models')[NAME] = {
init: function(config) {
this.config = config;
},
Expand Down Expand Up @@ -502,7 +502,7 @@ the **next** and **prev** links.

.. code-block:: javascript
YUI.add('PagerMojit', function(Y,NAME) {
YUI.add('PagerMojit', function(Y, NAME) {
/**
* The PagerMojit module.
* @module PagerMojit */
Expand All @@ -512,7 +512,7 @@ the **next** and **prev** links.
* @class Controller
* @constructor
*/
Y.mojito.controllers[NAME] = {
Y.namespace('mojito.controllers')[NAME] = {
init: function(config) {
this.config = config;
},
Expand Down Expand Up @@ -624,14 +624,14 @@ To set up and run ``binding_events``:

.. code-block:: javascript
YUI.add('PagerMojit', function(Y,NAME) {
YUI.add('PagerMojit', function(Y, NAME) {
var PAGE_SIZE = 10;
/**
* Constructor for the Controller class.
* @class Controller
* @constructor
*/
Y.mojito.controllers[NAME] = {
Y.namespace('mojito.controllers')[NAME] = {
init: function(config) {
this.config = config;
},
Expand Down Expand Up @@ -686,7 +686,7 @@ To set up and run ``binding_events``:

.. code-block:: javascript
YUI.add('PagerMojitModel', function(Y,NAME) {
YUI.add('PagerMojitModel', function(Y, NAME) {
/**
* The PagerMojitModel module.
* @module PagerMojitModel
Expand All @@ -696,7 +696,7 @@ To set up and run ``binding_events``:
* @class Model
* @constructor
*/
Y.mojito.models.PagerMojit = {
Y.namespace('mojito.models')[NAME] = {
init: function(config) {
this.config = config;
},
Expand Down Expand Up @@ -885,4 +885,4 @@ Source Code

- `Application Configuration <http://github.com/yahoo/mojito/tree/master/examples/developer-guide/binding_events/application.json>`_
- `Mojit Binder <http://github.com/yahoo/mojito/tree/master/examples/developer-guide/binding_events/mojits/PagerMojit/binders/index.js>`_
- `Binding Events Application <http://github.com/yahoo/mojito/tree/master/examples/developer-guide/binding_events/>`_
- `Binding Events Application <http://github.com/yahoo/mojito/tree/master/examples/developer-guide/binding_events/>`_
14 changes: 7 additions & 7 deletions docs/dev_guide/code_exs/calling_yql.rst
Expand Up @@ -92,10 +92,10 @@ function.

.. code-block: javascript
YUI.add('flickrModel', function(Y,NAME) {
YUI.add('flickrModel', function(Y, NAME) {
// Flickr requires an API key
var API_KEY = '84921e87fb8f2fc338c3ff9bf51a412e';
Y.mojito.models.flickr = {
Y.namespace('mojito.models')[NAME] = {
init: function(config) {
this.config = config;
},
Expand Down Expand Up @@ -176,8 +176,8 @@ the ``index`` template.

.. code-block:: javascript
YUI.add('flickr', function(Y,NAME) {
Y.mojito.controllers[NAME] = {
YUI.add('flickr', function(Y, NAME) {
Y.namespace('mojito.controllers')[NAME] = {
init: function(config) {
this.config = config;
},
Expand Down Expand Up @@ -265,11 +265,11 @@ To set up and run ``model_yql``:

.. code-block:: javascript
YUI.add('flickrModel', function(Y,NAME) {
YUI.add('flickrModel', function(Y, NAME) {
// Replace '{Flickr API Key}' with your own Flickr
// API key.
var API_KEY = '{Flickr API Key}';
Y.mojito.models.flickr = {
Y.namespace('mojito.models')[NAME] = {
init: function(config) {
this.config = config;
},
Expand Down Expand Up @@ -325,7 +325,7 @@ To set up and run ``model_yql``:

.. code-block:: javascript
YUI.add('flickrModel', function(Y,NAME) {
YUI.add('flickrModel', function(Y, NAME) {
// Replace '{Flickr API Key}' with your own Flickr
// API key.
var API_KEY = '{Flickr API Key}';
Expand Down
13 changes: 7 additions & 6 deletions docs/dev_guide/code_exs/cookies.rst
Expand Up @@ -34,8 +34,8 @@ these methods for getting and setting cookies should be familiar as Mojito uses

.. code-block:: javascript
YUI.add('CookieMojit', function(Y,NAME) {
Y.mojito.controllers[NAME] = {
YUI.add('CookieMojit', function(Y, NAME) {
Y.namespace('mojito.controllers')[NAME] = {
init: function(config) {
this.config = config;
},
Expand Down Expand Up @@ -65,7 +65,8 @@ cookie. To use the YUI Cookie module, first include the module with ``YUI().use`
<div id="{{mojit_view_id}}" class="mojit">
<h2>{{title}}</h2>
<div>
<p>This is a demo showing how to read read cookies from browser, and how to write cookies to browser from the Mojit.</p>
<p>This is a demo showing how to read read cookies from browser, and how to write cookies to
browser from the Mojit.</p>
</div>
<div>
<p>Value of request cookie sent by browser: {{request_cookie_value}}</p>
Expand Down Expand Up @@ -140,8 +141,8 @@ To set up and run ``using_cookies``:

.. code-block:: javascript
YUI.add('CookieMojit', function(Y,NAME) {
Y.mojito.controllers[NAME] = {
YUI.add('CookieMojit', function(Y, NAME) {
Y.namespace('mojito.controllers')[NAME] = {
init: function(config) {
this.config = config;
},
Expand Down Expand Up @@ -201,4 +202,4 @@ Source Code
===========

- `Mojit Controller <http://github.com/yahoo/mojito/tree/master/examples/developer-guide/using_cookies/mojits/CookieMojit/controller.server.js>`_
- `Using Cookie Application <http://github.com/yahoo/mojito/tree/master/examples/developer-guide/using_cookies/>`_
- `Using Cookie Application <http://github.com/yahoo/mojito/tree/master/examples/developer-guide/using_cookies/>`_
8 changes: 4 additions & 4 deletions docs/dev_guide/code_exs/dynamic_assets.rst
Expand Up @@ -92,8 +92,8 @@ The appropriate CSS file is dynamically attached to the template with ``ac.asset

.. code-block:: javascript
YUI.add('device', function(Y,NAME){
Y.mojito.controllers[NAME] = {
YUI.add('device', function(Y, NAME){
Y.namespace('mojito.controllers')[NAME] = {
init: function(config) {
this.config = config;
},
Expand Down Expand Up @@ -231,8 +231,8 @@ To create and run ``device_assets``:

.. code-block:: javascript
YUI.add('device', function(Y,NAME){
Y.mojito.controllers[NAME] = {
YUI.add('device', function(Y, NAME){
Y.namespace('mojito.controllers')[NAME] = {
init: function(config) {
this.config = config;
},
Expand Down
13 changes: 8 additions & 5 deletions docs/dev_guide/code_exs/framed_assets.rst
Expand Up @@ -103,7 +103,8 @@ To create and run ``framed_assets``:
#. Create your mojit.

``$ mojito create mojit framed``
#. To configure your application to have assets, replace the code in ``application.json`` with the following:
#. To configure your application to have assets, replace the code in ``application.json`` with the
following:

.. code-block:: javascript
Expand Down Expand Up @@ -146,12 +147,13 @@ To create and run ``framed_assets``:
]
#. Change to ``mojits/framed``.
#. Modify your controller to pass an array of objects to the template by replacing the code in ``controller.server.js`` with the following:
#. Modify your controller to pass an array of objects to the template by replacing the code in
``controller.server.js`` with the following:

.. code-block:: javascript
YUI.add('framed', function(Y,NAME) {
Y.mojito.controllers[NAME] = {
YUI.add('framed', function(Y, NAME) {
Y.namespace('mojito.controllers')[NAME] = {
init: function(config) {
this.config = config;
},
Expand All @@ -171,7 +173,8 @@ To create and run ``framed_assets``:
};
}, '0.0.1', {requires: []});
#. Include the assets in your template by replacing the code in ``views/index.hb.html`` with the following:
#. Include the assets in your template by replacing the code in ``views/index.hb.html`` with the
following:

.. code-block:: html

Expand Down

0 comments on commit e5a44b3

Please sign in to comment.