Skip to content
Browse files

Fixed syntax for namespacing controllers/models in docs/examples.

  • Loading branch information...
1 parent 24ac218 commit 74b3d8ae25655cc8e8415cb12eb6b36a32335832 @zhouyaoji zhouyaoji committed Oct 3, 2012
View
18 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 <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.
View
17 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;
},
View
16 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>`_.
View
8 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) {
View
7 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
View
20 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 <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/>`_
View
14 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}';
View
13 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`
<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>
@@ -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 <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/>`_
View
8 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;
},
View
13 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
View
8 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;
},
View
4 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();
}
View
4 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;
},
View
16 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
View
24 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;
View
20 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;
},
View
4 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;
},
View
4 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;
},
View
16 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.
</div>
</div>
<script type="text/javascript" charset="utf-8">
- YUI().use('scrollview', function(Y,NAME) {
+ YUI().use('scrollview', function(Y, NAME) {
var scrollView = new Y.ScrollView({
id: 'scrollview',
srcNode: '#scrollview-content',
@@ -207,8 +207,8 @@ To set up and run ``scroll_views``:
.. code-block:: javascript
- YUI.add('scroll', function(Y,NAME) {
- Y.mojito.controllers[NAME] = {
+ YUI.add('scroll', function(Y, NAME) {
+ Y.namespace('mojito.controllers')[NAME] = {
init: function(config) {
this.config = config;
},
@@ -269,7 +269,7 @@ To set up and run ``scroll_views``:
</div>
</div>
<script type="text/javascript" charset="utf-8">
- YUI().use('scrollview', function(Y,NAME) {
+ YUI().use('scrollview', function(Y, NAME) {
var scrollView = new Y.ScrollView({
id: 'scrollview',
srcNode: '#scrollview-content',
View
2 docs/dev_guide/code_exs/simple_logging.rst
@@ -147,7 +147,7 @@ To set up and run ``simple_logging``:
.. code-block:: javascript
YUI.add('log', function(Y, NAME) {
- Y.mojito.controllers[NAME] = {
+ Y.namespace('mojito.controllers')[NAME] = {
init: function(config) {
this.config = config;
},
View
7 docs/dev_guide/code_exs/simple_view_template.rst
@@ -117,7 +117,8 @@ To set up and run ``simple_view``:
}
]
-#. To configure the routing for your application, replace the code in ``routes.json`` with the following:
+#. To configure the routing for your application, replace the code in ``routes.json`` with the
+ following:
.. code-block:: javascript
@@ -139,7 +140,7 @@ To set up and run ``simple_view``:
.. code-block:: javascript
YUI.add('simple', function(Y, NAME) {
- Y.mojito.controllers[NAME] = {
+ Y.namespace('mojito.controllers')[NAME] = {
init: function(config) {
this.config = config;
},
@@ -188,4 +189,4 @@ Source Code
===========
- `Mojit Controller <http://github.com/yahoo/mojito/tree/master/examples/developer-guide/simple_view/mojits/simple/controller.server.js>`_
-- `Simple View Application <http://github.com/yahoo/mojito/tree/master/examples/developer-guide/simple_view/>`_
+- `Simple View Application <http://github.com/yahoo/mojito/tree/master/examples/developer-guide/simple_view/>`_
View
2 docs/dev_guide/code_exs/view_engines.rst
@@ -333,7 +333,7 @@ To set up and run ``adding_view_engines``:
YUI.add('myMojit', function(Y, NAME) {
- Y.mojito.controllers[NAME] = {
+ Y.namespace('mojito.controllers')[NAME] = {
init: function(config) {
this.config = config;
View
4 docs/dev_guide/code_exs/views_multiple_devices.rst
@@ -221,8 +221,8 @@ To set up and run ``device_views``:
.. 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;
},
View
10 docs/dev_guide/code_exs/yui_modules.rst
@@ -42,7 +42,8 @@ string for identifying the module and ``{affinity}`` is either ``common``, ``ser
``{module_name}.{affinity}.js``
-In this code example, code is being deployed to the client, so the affinity must be either ``common`` or ``client``.
+In this code example, code is being deployed to the client, so the affinity must be either
+``common`` or ``client``.
.. _registering_module:
@@ -92,7 +93,8 @@ and set persistent data. Note that you must use the ``Y`` instance to access the
var keyname = 'storage-lite-example', notes = node.one('#notes');
// Populate the textarea with the stored note
// text on page load.
- notes.set('value', Y.StorageLite.getItem(keyname) || ''); // Save the contents of the textarea after
+ notes.set('value', Y.StorageLite.getItem(keyname) || '');
+ // Save the contents of the textarea after
// each keystroke.
notes.on('keyup', function() {
Y.StorageLite.setItem(keyname, notes.get('value'));
@@ -162,8 +164,8 @@ To set up and run ``yui_module``:
.. code-block:: javascript
- YUI.add('Notepad', function(Y,NAME) {
- Y.mojito.controllers[NAME] = {
+ YUI.add('Notepad', function(Y, NAME) {
+ Y.namespace('mojito.controllers')[NAME] = {
index: function(ac) {
ac.done();
}
View
2 docs/dev_guide/getting_started/mojito_getting_started_tutorial.rst
@@ -134,7 +134,7 @@ You will now modify the controller, so that the ``index`` function called in the
* @class Controller
* @constructor
*/
- Y.mojito.controllers[NAME] = {
+ Y.namespace('mojito.controllers')[NAME] = {
init: function(config) {
this.config = config;
View
2 docs/dev_guide/topics/mojito_extensions.rst
@@ -151,7 +151,7 @@ addon's constructor. In our addon, we defined the namespace ``cheese`` (``"names
.. code-block:: javascript
YUI.add('Foo', function(Y) {
- Y.mojito.controllers = {
+ Y.namespace('mojito.controllers')[NAME] = {
index: function(ac) {
// Use the type 'cheese' and then the
// the addon function 'cheesify'

0 comments on commit 74b3d8a

Please sign in to comment.
Something went wrong with that request. Please try again.