diff --git a/.npmignore b/.npmignore
index 931f42576..692298c9b 100644
--- a/.npmignore
+++ b/.npmignore
@@ -5,6 +5,7 @@
*.bak
*~
/tests
+!/tests/harness/lib/yuitest/java/build
arrowreport
artifacts
examples
diff --git a/docs/dev_guide/api_overview/index.rst b/docs/dev_guide/api_overview/index.rst
index b55e69908..8fcc879f3 100644
--- a/docs/dev_guide/api_overview/index.rst
+++ b/docs/dev_guide/api_overview/index.rst
@@ -13,17 +13,13 @@ The API contains the following five modules:
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.
+ ``Action Context`` object available when required in a controller.
- **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.
-
-Table of Contents
-#################
-
.. toctree::
:maxdepth: 2
diff --git a/docs/dev_guide/api_overview/mojito_action_context.rst b/docs/dev_guide/api_overview/mojito_action_context.rst
index 9fa7efc0b..b2371dd29 100644
--- a/docs/dev_guide/api_overview/mojito_action_context.rst
+++ b/docs/dev_guide/api_overview/mojito_action_context.rst
@@ -1,18 +1,18 @@
-
-
==============
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``.
+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.
+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
@@ -29,9 +29,6 @@ the ``done`` method sends the ``data`` object to the ``index`` template.
* @constructor
*/
Y.namespace('mojito.controllers')[NAME] = {
- init: function(config) {
- this.config = config;
- },
/**
* Method corresponding to the 'index' action.
*
diff --git a/docs/dev_guide/api_overview/mojito_addons.rst b/docs/dev_guide/api_overview/mojito_addons.rst
index aadfdb1f5..efdb83b40 100644
--- a/docs/dev_guide/api_overview/mojito_addons.rst
+++ b/docs/dev_guide/api_overview/mojito_addons.rst
@@ -1,15 +1,14 @@
+=====================
+Action Context 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.
-======
-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.
-
-Addons allow you to do the following:
+The Action Context addons allow you to do the following:
- access assets, such as CSS and JavaScript files
- get configuration information
@@ -19,21 +18,74 @@ Addons allow you to do the following:
- get and set HTTP headers
- create URLs
+
+.. _mojito_addons-syntax:
+
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()``
+
+.. _addons-requiring:
+
+Requiring Addons
+================
+
+Prior to version 0.5.0, Mojito attached addons to the ``ActionContext`` object for
+every HTTP request and mojit instance. As a result, you were able to use
+any of the Action Context addons by default.
+
+In Mojito versions 0.5.0 and later, you need to explicitly require an addon before you
+can use it. You require an addon by including an associated string in the
+``requires`` array of your controller. For example, in the controller below,
+the ``Params`` addon is required by adding the string ``'mojito-params-addon'`` to the
+``requires`` array.
+
+
+.. code-block:: javascript
+
+ YUI.add('Foo', function(Y, NAME) {
+ Y.namespace('mojito.controllers')[NAME] = {
+ index: function(ac) {
+ var all_params = ac.params.all();
+ }
+ };
+ // Require the addon by adding the param name to the requires array
+ }, '0.0.1', {requires: ['mojito', 'mojito-params-addon']});
+
+The list below shows what strings are used to require addons.
+
+- ``Assets`` addon - ``requires ['mojito-assets-addon']``
+- ``Composite`` addon - ``requires ['mojito-composite-addon']``
+- ``Config`` addon - ``requires ['mojito-config-addon']``
+- ``Cookies`` addon - ``requires ['mojito-cookie-addon']``
+- ``Http`` addon - ``requires ['mojito-http-addon']``
+- ``Intl`` addon - ``requires ['mojito-intl-addon']``
+- ``Params`` addon - ``requires ['mojito-params-addon']``
+- ``Url`` addon - ``requires ['mojito-url-addon']``
+
+
+.. note::
+ To run older applications with Mojito v0.5.0 and later, you will need to
+ modify your controllers so that the ActionContext addons that are being
+ used are required. The most common addons are ``Config``, ``Params``, ``Url``,
+ and ``Assets``.
+
+
+
+.. _mojito_addons-exs:
+
Addon Examples
-##############
+==============
The following code examples use the addons in parentheses:
@@ -44,8 +96,11 @@ The following code examples use the addons in parentheses:
- `Internationalizing Your Application <../code_exs/i18n_apps.html>`_ (``Intl``)
- `Using Multiple Mojits <../code_exs/multiple_mojits.html>`_ (``Composite``)
+
+.. _mojito_addons-create:
+
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
diff --git a/docs/dev_guide/api_overview/mojito_client_obj.rst b/docs/dev_guide/api_overview/mojito_client_obj.rst
index d4417759f..376b61247 100644
--- a/docs/dev_guide/api_overview/mojito_client_obj.rst
+++ b/docs/dev_guide/api_overview/mojito_client_obj.rst
@@ -1,5 +1,3 @@
-
-
=============
Client Object
=============
@@ -9,8 +7,10 @@ created. The ``client`` object can be used to pause and resume mojits running wi
See `Class Y.mojito.Client <../../api/classes/Y.mojito.Client.html>`_ in the
`Mojito API Reference <../../api/>`_ for more details.
+.. _mojito_client_obj-pause:
+
Pausing Mojits
-##############
+==============
From the ``client`` object, you call the ``pause`` method as seen below to prevent any code from
executing outside of the individual binders (within the Mojito framework) and to call ``onPause()``
@@ -18,8 +18,10 @@ on all binders.
``Y.mojito.client.pause()``
+.. _mojito_client_obj-resume:
+
Resuming Mojits
-###############
+===============
From the ``client`` object, you call the ``resume`` method as seen below to immediately execute all
cached operations and notify all of the binders through the ``onResume`` function.
diff --git a/docs/dev_guide/api_overview/mojito_rest_lib.rst b/docs/dev_guide/api_overview/mojito_rest_lib.rst
index 85b979156..778a28d08 100644
--- a/docs/dev_guide/api_overview/mojito_rest_lib.rst
+++ b/docs/dev_guide/api_overview/mojito_rest_lib.rst
@@ -1,5 +1,3 @@
-
-
============
REST Library
============
@@ -8,11 +6,13 @@ Mojito has a library to make it easier to make a REST calls to Web services from
implementation details, see `Class Y.mojito.lib.REST <../../api/classes/Y.mojito.lib.REST.html>`_
in the Mojito API documentation.
+.. _mojito_rest_lib-incl:
+
Including Library
-#################
+=================
-To use the REST library, include the string 'mojito-rest-lib' in the ``requires`` array, which
-instructs YUI to load the library. Once the library is loaded, you can use
+To use the REST library, include the string 'mojito-rest-lib' in the ``requires`` array,
+which instructs YUI to load the library. Once the library is loaded, you can use
`Y.mojito.lib.REST <../../api/classes/Y.mojito.lib.REST.html>`_ to make REST calls..
.. code-block:: javascript
@@ -25,8 +25,11 @@ instructs YUI to load the library. Once the library is loaded, you can use
// Ask YUI to load the library w/ 'mojito-rest-lib'.
}, '0.0.1', {requires: ['mojito', 'mojito-rest-lib']});
+
+.. _mojito_rest_lib-ex:
+
Example
-#######
+=======
In the model for the ``recipeSearch`` mojit below, the REST library is used to make a GET call to
the Recipe Puppy API.
@@ -35,9 +38,6 @@ the Recipe Puppy API.
YUI.add('ProductSearchModel', function(Y, NAME) {
Y.namespace('mojito.models')[NAME] = {
- init: function(config) {
- this.config = config;
- },
recipeSearch: function(count, cb) {
var url = 'http://www.recipepuppy.com/api/';
var params = {
diff --git a/docs/dev_guide/code_exs/adding_assets.rst b/docs/dev_guide/code_exs/adding_assets.rst
index 636a7de48..cb01f5212 100644
--- a/docs/dev_guide/code_exs/adding_assets.rst
+++ b/docs/dev_guide/code_exs/adding_assets.rst
@@ -2,10 +2,16 @@
Adding CSS
==========
+.. raw:: html
+
+ Time Estimate: 10 minutes Difficulty: Beginner
+
**Time Estimate:** 10 minutes
**Difficulty:** Beginner
+.. _code_exs_css-summary:
+
Summary
=======
@@ -16,12 +22,14 @@ The following topics will be covered:
- configuring an application to have assets
- including assets in the template
+.. _code_exs_css-notes:
+
Implementation Notes
====================
-Each application has an ``assets`` directory for placing global CSS files that can be accessed by
-all of your mojits. Each mojit has its own ``assets`` directory for local CSS files that are only
-accessible by the mojit.
+Each application has an ``assets`` directory for placing global CSS files that can be
+accessed by all of your mojits. Each mojit has its own ``assets`` directory for local
+CSS files that are only accessible by the mojit.
The global assets are located in the ``{app_dir}/assets`` directory as shown here:
@@ -36,8 +44,8 @@ The global assets are located in the ``{app_dir}/assets`` directory as shown her
|-- routes.json
|-- server.js
-In the ``simple`` mojit below, you see the local ``assets`` directory for CSS files only available
-to the ``simple`` mojit:
+In the ``simple`` mojit below, you see the local ``assets`` directory for CSS files only
+available to the ``simple`` mojit:
::
@@ -52,8 +60,8 @@ to the ``simple`` mojit:
|-- tests/
`-- views/
-This code example only uses local CSS, so the ``simple.css`` file is placed in the ``assets``
-directory under the ``simple`` mojit.
+This code example only uses local CSS, so the ``simple.css`` file is placed in the
+``assets`` directory under the ``simple`` mojit.
.. code-block:: css
@@ -67,18 +75,18 @@ directory under the ``simple`` mojit.
}
.toolbar li { display:inline; }
-The CSS files in the mojit ``assets`` directory can be accessed in the template using the following
-path syntax:
+The CSS files in the mojit ``assets`` directory can be accessed in the template using the
+following path syntax:
``/static/{mojit}/assets/{css_file}.css``
-This code example uses the ``simple`` mojit and the ``simple.css`` asset. To access ``simple.css``,
-you would use the following path:
+This code example uses the ``simple`` mojit and the ``simple.css`` asset. To access
+``simple.css``, you would use the following path:
``/static/simple/assets/simple.css``
-The ``index.hb.html`` template below includes ``simple.css`` from the ``assets`` directory using the
-path above.
+The ``index.hb.html`` template below includes ``simple.css`` from the ``assets`` directory
+using the path above.
.. code-block:: html
@@ -107,15 +115,19 @@ path above.