diff --git a/docs/dev_guide/api_overview/index.rst b/docs/dev_guide/api_overview/index.rst index 3bcfcbfde..b55e69908 100644 --- a/docs/dev_guide/api_overview/index.rst +++ b/docs/dev_guide/api_overview/index.rst @@ -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 `_ 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 `_ 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. diff --git a/docs/dev_guide/api_overview/mojito_action_context.rst b/docs/dev_guide/api_overview/mojito_action_context.rst index 5a13c71ac..9fa7efc0b 100644 --- a/docs/dev_guide/api_overview/mojito_action_context.rst +++ b/docs/dev_guide/api_overview/mojito_action_context.rst @@ -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. * @@ -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; }, diff --git a/docs/dev_guide/api_overview/mojito_addons.rst b/docs/dev_guide/api_overview/mojito_addons.rst index 70556ca63..aadfdb1f5 100644 --- a/docs/dev_guide/api_overview/mojito_addons.rst +++ b/docs/dev_guide/api_overview/mojito_addons.rst @@ -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: @@ -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()`` @@ -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>`_. diff --git a/docs/dev_guide/api_overview/mojito_rest_lib.rst b/docs/dev_guide/api_overview/mojito_rest_lib.rst index 9f956fd3c..85b979156 100644 --- a/docs/dev_guide/api_overview/mojito_rest_lib.rst +++ b/docs/dev_guide/api_overview/mojito_rest_lib.rst @@ -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"); @@ -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) { diff --git a/docs/dev_guide/code_exs/adding_assets.rst b/docs/dev_guide/code_exs/adding_assets.rst index a7cfb34bc..636a7de48 100644 --- a/docs/dev_guide/code_exs/adding_assets.rst +++ b/docs/dev_guide/code_exs/adding_assets.rst @@ -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. * @@ -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; }, @@ -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 diff --git a/docs/dev_guide/code_exs/binding_events.rst b/docs/dev_guide/code_exs/binding_events.rst index 117ac6ed7..8a24d8940 100644 --- a/docs/dev_guide/code_exs/binding_events.rst +++ b/docs/dev_guide/code_exs/binding_events.rst @@ -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 */ ... @@ -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 @@ -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; }, @@ -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 */ @@ -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; }, @@ -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; }, @@ -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 @@ -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; }, @@ -885,4 +885,4 @@ Source Code - `Application Configuration `_ - `Mojit Binder `_ -- `Binding Events Application `_ \ No newline at end of file +- `Binding Events Application `_ diff --git a/docs/dev_guide/code_exs/calling_yql.rst b/docs/dev_guide/code_exs/calling_yql.rst index b93637af5..ea1ec2069 100644 --- a/docs/dev_guide/code_exs/calling_yql.rst +++ b/docs/dev_guide/code_exs/calling_yql.rst @@ -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; }, @@ -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; }, @@ -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; }, @@ -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}'; diff --git a/docs/dev_guide/code_exs/cookies.rst b/docs/dev_guide/code_exs/cookies.rst index a7c783497..e51a35774 100644 --- a/docs/dev_guide/code_exs/cookies.rst +++ b/docs/dev_guide/code_exs/cookies.rst @@ -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; }, @@ -65,7 +65,8 @@ cookie. To use the YUI Cookie module, first include the module with ``YUI().use`

{{title}}

-

This is a demo showing how to read read cookies from browser, and how to write cookies to browser from the Mojit.

+

This is a demo showing how to read read cookies from browser, and how to write cookies to + browser from the Mojit.

Value of request cookie sent by browser: {{request_cookie_value}}

@@ -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; }, @@ -201,4 +202,4 @@ Source Code =========== - `Mojit Controller `_ -- `Using Cookie Application `_ \ No newline at end of file +- `Using Cookie Application `_ diff --git a/docs/dev_guide/code_exs/dynamic_assets.rst b/docs/dev_guide/code_exs/dynamic_assets.rst index 5178e6d0e..493bdaa9a 100644 --- a/docs/dev_guide/code_exs/dynamic_assets.rst +++ b/docs/dev_guide/code_exs/dynamic_assets.rst @@ -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; }, @@ -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; }, diff --git a/docs/dev_guide/code_exs/framed_assets.rst b/docs/dev_guide/code_exs/framed_assets.rst index f6ca25fa1..a6e2c4f65 100644 --- a/docs/dev_guide/code_exs/framed_assets.rst +++ b/docs/dev_guide/code_exs/framed_assets.rst @@ -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 @@ -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; }, @@ -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 diff --git a/docs/dev_guide/code_exs/generating_urls.rst b/docs/dev_guide/code_exs/generating_urls.rst index 1299e1587..d9716daba 100644 --- a/docs/dev_guide/code_exs/generating_urls.rst +++ b/docs/dev_guide/code_exs/generating_urls.rst @@ -77,8 +77,8 @@ pass the instance and action to ``url.make`` to create the URL based on the path .. code-block:: javascript - YUI.add('GenURLMojit', function(Y,NAME) { - Y.mojito.controllers[NAME] = { + YUI.add('GenURLMojit', function(Y, NAME) { + Y.namespace('mojito.controllers')[NAME] = { init: function(config) { this.config = config; }, @@ -147,8 +147,8 @@ To set up and run ``generating_urls``: .. code-block:: javascript - YUI.add('GenURLMojit', function(Y,NAME) { - Y.mojito.controllers[NAME] = { + YUI.add('GenURLMojit', function(Y, NAME) { + Y.namespace('mojito.controllers')[NAME] = { init: function(config) { this.config = config; }, diff --git a/docs/dev_guide/code_exs/global_assets.rst b/docs/dev_guide/code_exs/global_assets.rst index 2d0dc4745..6f6764361 100644 --- a/docs/dev_guide/code_exs/global_assets.rst +++ b/docs/dev_guide/code_exs/global_assets.rst @@ -211,8 +211,8 @@ To set up and run ``global_assets``: .. code-block:: javascript - YUI.add('OhHai', function(Y,NAME) { - Y.mojito.controllers[NAME] = { + YUI.add('OhHai', function(Y, NAME) { + Y.namespace('mojito.controllers')[NAME] = { index: function(ac) { ac.done(); } diff --git a/docs/dev_guide/code_exs/htmlframe_view.rst b/docs/dev_guide/code_exs/htmlframe_view.rst index cb2e31244..ea07f8ff9 100644 --- a/docs/dev_guide/code_exs/htmlframe_view.rst +++ b/docs/dev_guide/code_exs/htmlframe_view.rst @@ -154,8 +154,8 @@ To set up and run ``htmlframe_mojit``: .. 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; }, diff --git a/docs/dev_guide/code_exs/i18n_apps.rst b/docs/dev_guide/code_exs/i18n_apps.rst index d6158797d..21f1ad233 100644 --- a/docs/dev_guide/code_exs/i18n_apps.rst +++ b/docs/dev_guide/code_exs/i18n_apps.rst @@ -55,7 +55,7 @@ the string ``'intl'`` to the ``requires`` array. .. code-block:: javascript - YUI.add("lang/i18n_en-US", function(Y,NAME) { + YUI.add("lang/i18n_en-US", function(Y, NAME) { Y.Intl.add( "i18n", // associated mojit "en-US", // BCP 47 language tag @@ -78,8 +78,8 @@ include the `Intl addon <../../api/classes/Intl.common.html>`_ by adding the str .. code-block:: javascript - YUI.add('i18n', function(Y,NAME) {/ - Y.mojito.controllers[NAME] = { + YUI.add('i18n', function(Y, NAME) {/ + Y.namespace('mojito.controllers')[NAME] = { init: function(config) { this.config = config; }, @@ -185,8 +185,8 @@ To set up and run ``locale_i18n``: .. code-block:: javascript - YUI.add('i18n', function(Y,NAME) { - Y.mojito.controllers[NAME] = { + YUI.add('i18n', function(Y, NAME) { + Y.namespace('mojito.controllers')[NAME] = { init: function(config) { this.config = config; }, @@ -207,7 +207,7 @@ To set up and run ``locale_i18n``: .. code-block:: javascript - YUI.add("lang/i18n_en-US", function(Y,NAME) { + YUI.add("lang/i18n_en-US", function(Y, NAME) { Y.Intl.add( "i18n", // associated mojit "en-US", // BCP 47 language tag @@ -222,7 +222,7 @@ To set up and run ``locale_i18n``: .. code-block:: javascript - YUI.add("lang/i18n_fr-FR", function(Y,NAME) { + YUI.add("lang/i18n_fr-FR", function(Y, NAME) { Y.Intl.add( "i18n", // associated mojit "fr-FR", // BCP 47 language tag @@ -238,7 +238,7 @@ To set up and run ``locale_i18n``: .. code-block:: javascript - YUI.add("lang/i18n_en-AU", function(Y,NAME) { + YUI.add("lang/i18n_en-AU", function(Y, NAME) { Y.Intl.add( "i18n", // associated mojit "en-AU", // BCP 47 language tag diff --git a/docs/dev_guide/code_exs/intermojit_communication.rst b/docs/dev_guide/code_exs/intermojit_communication.rst index ffc1270cf..c6493a696 100644 --- a/docs/dev_guide/code_exs/intermojit_communication.rst +++ b/docs/dev_guide/code_exs/intermojit_communication.rst @@ -114,8 +114,8 @@ can execute the ``index`` functions of the child mojits by calling the ``done`` .. code-block:: javascript - YUI.add('MasterMojit', function(Y,NAME) { - Y.mojito.controllers[NAME] = { + YUI.add('MasterMojit', function(Y, NAME) { + Y.namespace('mojito.controllers')[NAME] = { init: function(config) { this.config = config; }, @@ -256,8 +256,8 @@ binder, which we'll look at next. .. code-block:: javascript - YUI.add('ReceiverMojit', function(Y,NAME) { - Y.mojito.controllers[NAME] = { + YUI.add('ReceiverMojit', function(Y, NAME) { + Y.namespace('mojito.controllers')[NAME] = { init: function(config) { this.config = config; }, @@ -278,7 +278,7 @@ object is used to invoke the ``show`` function and pass the photo URI. .. code-block:: javascript - YUI.add('ReceiverMojitBinderIndex', function(Y,NAME) { + YUI.add('ReceiverMojitBinderIndex', function(Y, NAME) { Y.namespace('mojito.binders')[NAME] = { init: function(mojitProxy) { var self = this; @@ -393,8 +393,8 @@ To set up and run ``inter-mojit``: .. code-block:: javascript - YUI.add('MasterMojit', function(Y,NAME) { - Y.mojito.controllers[NAME] = { + YUI.add('MasterMojit', function(Y, NAME) { + Y.namespace('mojito.controllers')[NAME] = { init: function(spec) { this.spec=spec; }, @@ -460,8 +460,8 @@ To set up and run ``inter-mojit``: .. code-block:: javascript - YUI.add('SenderMojit', function(Y,NAME) { - Y.mojito.controllers[NAME] = { + YUI.add('SenderMojit', function(Y, NAME) { + Y.namespace('mojito.controllers')[NAME] = { init: function(config) { this.config = config; }, @@ -523,8 +523,8 @@ To set up and run ``inter-mojit``: .. code-block:: javascript - YUI.add('ReceiverMojit', function(Y,NAME) { - Y.mojito.controllers[NAME] = { + YUI.add('ReceiverMojit', function(Y, NAME) { + Y.namespace('mojito.controllers')[NAME] = { init: function(spec) { this.spec = spec; }, @@ -543,7 +543,7 @@ To set up and run ``inter-mojit``: .. code-block:: javascript - YUI.add('ReceiverMojitBinderIndex', function(Y,NAME) { + YUI.add('ReceiverMojitBinderIndex', function(Y, NAME) { Y.namespace('mojito.binders')[NAME] = { init: function(mojitProxy) { var self = this; diff --git a/docs/dev_guide/code_exs/multiple_mojits.rst b/docs/dev_guide/code_exs/multiple_mojits.rst index b237e8933..65935540b 100644 --- a/docs/dev_guide/code_exs/multiple_mojits.rst +++ b/docs/dev_guide/code_exs/multiple_mojits.rst @@ -103,8 +103,8 @@ which we will take a look at next. .. code-block:: javascript - YUI.add('FrameMojit', function(Y,NAME) { - Y.mojito.controllers[NAME] = { + YUI.add('FrameMojit', function(Y, NAME) { + Y.namespace('mojito.controllers')[NAME] = { init: function(config) { this.config = config; }, @@ -218,8 +218,8 @@ To set up and run ``multiple_mojits``: .. code-block:: javascript - YUI.add('FrameMojit', function(Y,NAME) { - Y.mojito.controllers[NAME] = { + YUI.add('FrameMojit', function(Y, NAME) { + Y.namespace('mojito.controllers')[NAME] = { init: function(config) { this.config = config; }, @@ -255,8 +255,8 @@ To set up and run ``multiple_mojits``: .. code-block:: javascript - YUI.add('HeaderMojit', function(Y,NAME) { - Y.mojito.controllers[NAME] = { + YUI.add('HeaderMojit', function(Y, NAME) { + Y.namespace('mojito.controllers')[NAME] = { init: function(config) { this.config = config; }, @@ -287,8 +287,8 @@ To set up and run ``multiple_mojits``: .. code-block:: javascript - YUI.add('BodyMojit', function(Y,NAME) { - Y.mojito.controllers[NAME] = { + YUI.add('BodyMojit', function(Y, NAME) { + Y.namespace('mojito.controllers')[NAME] = { init: function(config) { this.config = config; }, @@ -316,8 +316,8 @@ To set up and run ``multiple_mojits``: .. code-block:: javascript - YUI.add('FooterMojit', function(Y,NAME) { - Y.mojito.controllers[NAME] = { + YUI.add('FooterMojit', function(Y, NAME) { + Y.namespace('mojito.controllers')[NAME] = { init: function(config) { this.config = config; }, diff --git a/docs/dev_guide/code_exs/query_params.rst b/docs/dev_guide/code_exs/query_params.rst index a4b2aaa7b..6c19db6b9 100644 --- a/docs/dev_guide/code_exs/query_params.rst +++ b/docs/dev_guide/code_exs/query_params.rst @@ -253,8 +253,8 @@ To set up and run ``using_parameters``: .. code-block:: javascript - YUI.add('QueryMojit', function(Y,NAME) { - Y.mojito.controllers[NAME] = { + YUI.add('QueryMojit', function(Y, NAME) { + Y.namespace('mojito.controllers')[NAME] = { init: function(config) { this.config = config; }, diff --git a/docs/dev_guide/code_exs/route_config.rst b/docs/dev_guide/code_exs/route_config.rst index 640c4d8ca..0677f777f 100644 --- a/docs/dev_guide/code_exs/route_config.rst +++ b/docs/dev_guide/code_exs/route_config.rst @@ -149,8 +149,8 @@ To set up and run ``configure_routing``: .. code-block:: javascript - YUI.add('RoutingMojit', function(Y,NAME) { - Y.mojito.controllers[NAME] = { + YUI.add('RoutingMojit', function(Y, NAME) { + Y.namespace('mojito.controllers')[NAME] = { init: function(config) { this.config = config; }, diff --git a/docs/dev_guide/code_exs/scroll_views.rst b/docs/dev_guide/code_exs/scroll_views.rst index c049e764d..8e461d51e 100644 --- a/docs/dev_guide/code_exs/scroll_views.rst +++ b/docs/dev_guide/code_exs/scroll_views.rst @@ -61,10 +61,10 @@ the image ``alt`` attribute is passed to the ``index`` template. .. code-block:: javascript - YUI.add('scroll', function(Y,NAME) { - Y.mojito.controllers[NAME] = { - init: function(config) { - this.config = config; + YUI.add('scroll', function(Y, NAME) { + Y.namespace('mojito.controllers')[NAME] = { + init: function(config) { + this.config = config; }, index: function(ac) { // Populate Template @@ -127,7 +127,7 @@ YUI 3: ScrollView page.