Permalink
Browse files

Copy edited the developer guide documentation.

  • Loading branch information...
1 parent dc2f56f commit 0e6a84613fdc17c06d565e99582dd6840e95486d Joe Catera committed Nov 22, 2012
Showing with 236 additions and 284 deletions.
  1. +8 −7 docs/dev_guide/api_overview/index.rst
  2. +4 −2 docs/dev_guide/api_overview/mojito_addons.rst
  3. +10 −9 docs/dev_guide/api_overview/mojito_client_obj.rst
  4. +6 −5 docs/dev_guide/api_overview/mojito_rest_lib.rst
  5. +16 −17 docs/dev_guide/code_exs/binding_events.rst
  6. +4 −4 docs/dev_guide/code_exs/cookies.rst
  7. +2 −1 docs/dev_guide/code_exs/framed_assets.rst
  8. +3 −4 docs/dev_guide/code_exs/global_assets.rst
  9. +1 −1 docs/dev_guide/code_exs/htmlframe_view.rst
  10. +2 −2 docs/dev_guide/code_exs/multiple_mojits.rst
  11. +3 −4 docs/dev_guide/code_exs/scroll_views.rst
  12. +2 −2 docs/dev_guide/code_exs/views_multiple_devices.rst
  13. +43 −27 docs/dev_guide/faq/index.rst
  14. +2 −2 docs/dev_guide/getting_started/mojito_getting_started_tutorial.rst
  15. +7 −3 docs/dev_guide/index.rst
  16. +2 −1 docs/dev_guide/intro/mojito_binders.rst
  17. +7 −7 docs/dev_guide/intro/mojito_configuring.rst
  18. +3 −3 docs/dev_guide/intro/mojito_mojits.rst
  19. +1 −1 docs/dev_guide/intro/mojito_mvc.rst
  20. +10 −7 docs/dev_guide/reference/glossary.rst
  21. +54 −54 docs/dev_guide/reference/mojito_cmdline.rst
  22. +1 −2 docs/dev_guide/topics/mojito_composite_mojits.rst
  23. +2 −2 docs/dev_guide/topics/mojito_data.rst
  24. +1 −0 docs/dev_guide/topics/mojito_extensions.rst
  25. +17 −16 docs/dev_guide/topics/mojito_logging.rst
  26. +1 −1 docs/dev_guide/topics/mojito_npm.rst
  27. +9 −9 docs/dev_guide/topics/mojito_resource_store.rst
  28. +1 −1 docs/dev_guide/topics/mojito_run_dyn_defined_mojits.rst
  29. +5 −84 docs/dev_guide/topics/mojito_testing.rst
  30. +9 −6 docs/dev_guide/topics/mojito_using_contexts.rst
@@ -9,15 +9,16 @@ This section introduces some of the main features of the Mojito API. Please see
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 when required in a controller.
+- **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 and is 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.
+- **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.
.. toctree::
@@ -4,8 +4,10 @@ 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>`_
+object that is appended to the ``ActionContext`` object. The ``ActionContext`` object
+is available in each controller function, but controllers need to
+:ref:`require addons <addons-requiring>` before accessing addon methods.
+See the `ActionContext Class <../../api/classes/ActionContext.html>`_
for the addon classes.
The Action Context addons allow you to do the following:
@@ -2,19 +2,19 @@
Client Object
=============
-When Mojito starts up, the global object ``Y.mojito.client`` that represents the client runtime is
-created. The ``client`` object can be used to pause and resume mojits running within the page.
-See `Class Y.mojito.Client <../../api/classes/Y.mojito.Client.html>`_ in the
-`Mojito API Reference <../../api/>`_ for more details.
+When Mojito starts up, the global object ``Y.mojito.client`` that represents the client
+runtime is created. The ``client`` object can be used to pause and resume mojits running
+within the page. 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()``
-on all binders.
+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()`` on all binders.
``Y.mojito.client.pause()``
@@ -23,8 +23,9 @@ on all binders.
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.
+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.
``Y.mojito.client.resume()``
@@ -2,9 +2,10 @@
REST Library
============
-Mojito has a library to make it easier to make a REST calls to Web services from your model. For
-implementation details, see `Class Y.mojito.lib.REST <../../api/classes/Y.mojito.lib.REST.html>`_
-in the Mojito API documentation.
+Mojito has a library to make it easier to make a REST calls to Web services from your
+model. For implementation details, see
+`Class Y.mojito.lib.REST <../../api/classes/Y.mojito.lib.REST.html>`_ in the Mojito API
+documentation.
.. _mojito_rest_lib-incl:
@@ -31,8 +32,8 @@ which instructs YUI to load the library. Once the library is loaded, you can us
Example
=======
-In the model for the ``recipeSearch`` mojit below, the REST library is used to make a GET call to
-the Recipe Puppy API.
+In the model for the ``recipeSearch`` mojit below, the REST library is used to make a
+GET call to the Recipe Puppy API.
.. code-block:: javascript
@@ -11,7 +11,6 @@ Binding Events
Summary
=======
-
This example shows how to bind events to a mojit, configure code to run
on the client, and make AJAX calls to the YQL Web service. The application
listens for events and then makes AJAX calls to YQL to get Flickr photo
@@ -179,11 +178,11 @@ Binder Basics
#############
A mojit may have zero, one, or many binders within the ``binders`` directory. Each binder
-will be deployed to the browser along with the rest of the mojit code, where the client-side
-Mojito runtime will call it appropriately. On the client, the binder has a proxy
-object (``mojitProxy``) for interacting with the mojit it represents as well as with other
-mojits on the page. Methods can be called from the ``mojitProxy`` object that allow
-binders to listen for and fire events.
+will be deployed to the browser along with the rest of the mojit code, where the
+client-side Mojito runtime will call it appropriately. On the client, the binder has a
+proxy object (``mojitProxy``) for interacting with the mojit it represents as well as
+with other mojits on the page. Methods can be called from the ``mojitProxy`` object
+that allow binders to listen for and fire events.
The binder consists of a constructor, an initializer, and a bind function. The following
describes each component and indicates when the ``mojitProxy`` object can be used.
@@ -233,8 +232,8 @@ dissect and analyze the code. Let's begin by looking at the ``bind`` function o
In this code snippet of ``binders/index.js``, the ``bind`` function contains the nested
``updateDOM`` function that updates node content and attaches event handlers. Using the
-``mojitProxy`` object, the nested ``flipper`` function calls the ``index`` function of the
-controller. The callback ``updateDOM`` is passed to ``index`` to update the content.
+``mojitProxy`` object, the nested ``flipper`` function calls the ``index`` function of
+the controller. The callback ``updateDOM`` is passed to ``index`` to update the content.
.. code-block:: javascript
@@ -261,10 +260,10 @@ controller. The callback ``updateDOM`` is passed to ``index`` to update the cont
...
-The event handler for mouseovers and mouseouts are handled by the ``showOverlay`` function,
-which creates the overlay containing photo information. In the code snippet below,
-``showOverlay`` makes an AJAX call to YQL to get photo data that is placed in an unordered
-list for the overlay.
+The event handler for mouseovers and mouseouts are handled by the ``showOverlay``
+function, which creates the overlay containing photo information. In the code snippet
+below, ``showOverlay`` makes an AJAX call to YQL to get photo data that is placed in an
+unordered list for the overlay.
.. code-block:: javascript
@@ -501,8 +500,8 @@ To get the photo data, the controller depends on the model to call YQL to query
Flickr API. Using ``actionContext.get({model_name})`` lets you get a reference to the
model. The example controller below calls the ``getData`` from the model
``PagerMojitModel`` with ``actionContext.models.get('PagerMojitModel').getData`, which
-will get the returned data from YQL in the callback function. To use methods from models, you need
-to require the model in the ``requires`` array of the controller.
+will get the returned data from YQL in the callback function. To use methods from models,
+you need to require the model in the ``requires`` array of the controller.
.. code-block:: javascript
@@ -733,11 +732,11 @@ To set up and run ``binding_events``:
}
return actionContext.url.make('frame', 'index', Y.QueryString.stringify(mergedParams));
}
- }, '0.0.1', {requires: ['dump', 'mojito-url-addon', 'mojito-params-addon', 'PagerMojitModel']});
+ }, '0.0.1', {requires: ['dump', 'mojito-url-addon', 'mojito-params-addon', 'mojito-models-addon', 'PagerMojitModel']});
-#. To get Flickr photo information using YQL, create the file ``models/model.server.js`` with
- the code below. Be sure to replace the ``'{your_flickr_api_key}'`` with your own
+#. To get Flickr photo information using YQL, create the file ``models/model.server.js``
+ with the code below. Be sure to replace the ``'{your_flickr_api_key}'`` with your own
Flickr API key.
.. code-block:: javascript
@@ -145,8 +145,8 @@ To set up and run ``using_cookies``:
]
#. Change to ``mojits/CookieMojit``.
-#. To set a cookie from your controller, replace the code in ``controller.server.js`` with the
- following:
+#. To set a cookie from your controller, replace the code in ``controller.server.js`` with
+ the following:
.. code-block:: javascript
@@ -168,8 +168,8 @@ To set up and run ``using_cookies``:
};
}, '0.0.1', {requires: ['mojito-cookie-addon']});
-#. To display the cookie values set in your controller, replace the code in ``views/index.hb.html``
- with the following:
+#. To display the cookie values set in your controller, replace the code in
+ ``views/index.hb.html`` with the following:
.. code-block:: html
@@ -205,7 +205,8 @@ To create and run ``framed_assets``:
</ul>
</div>
-#. Replace the contents of ``assets/index.css`` for the CSS of your page with the following:
+#. Replace the contents of ``assets/index.css`` for the CSS of your page with the
+ following:
.. code-block:: css
@@ -12,10 +12,9 @@ Summary
=======
This example shows how to configure and use global assets in Mojito
-applications. In this
-example, the ``HTMLFrameMojit`` inserts global assets into the rendered
-view. See `Adding CSS <./adding_assets.html>`_ for an example that uses
-mojit-level assets.
+applications. In this example, the ``HTMLFrameMojit`` inserts global assets
+into the rendered view. See `Adding CSS <./adding_assets.html>`_ for an example
+that uses mojit-level assets.
The following topics will be covered:
@@ -102,7 +102,7 @@ example, the child mojit creates the ``<div>`` tag and its content.
</body>
</html>
-The ``HTMLFrameMojit`` mojit can be used to allow dynamic run-time selection of running
+The ``HTMLFrameMojit`` mojit can be used to allow dynamic runtime selection of running
on the client or server. You can also use ``HTMLFrameMojit`` to include assets and control
language defaults. These subjects are discussed in
`Internationalizing Your Application <i18n_apps.html>`_.
@@ -21,8 +21,8 @@ The following topics will be covered:
- embedding the rendered template into the HTML frame
.. tip::
- To learn how to use the Mojito built-in mojit ``HTMLFrameMojit`` to aggregate and
- display the output from child mojits, see
+ To learn how to use the Mojito built-in mojit ``HTMLFrameMojit`` to aggregate
+ and display the output from child mojits, see
`Using the HTML Frame Mojit <./htmlframe_view.html>`_.
.. _code_exs_multiple_mojits-notes:
@@ -33,7 +33,7 @@ devices.
:width: 401px
In the ``application.json`` file for this code example, the customized
-CSS are specified in the ``assets`` array as seen below.
+CSS is specified in the ``assets`` array as seen below.
.. code-block:: javascript
@@ -99,11 +99,10 @@ photo URLs and the text for the image ``alt`` attribute is passed to the
}, '0.0.1', {requires: ['mojito']});
In the ``index.hb.html`` below, the YUI ScrollView module is included with
-``YUI.use``. To create the scrolling content widget, you need to create a
+``YUI.use``. To create the scrolling content widget, you need to create a
container, a header, and content frame with ``div`` tags that use YUI-specific
IDs and render a ScrollView object. For detailed instructions, see the
-`Getting Started <http://developer.yahoo.com/yui/3/scrollview/#start>`_ section
-on the YUI 3: ScrollView page.
+`ScrollView: Getting Started <http://developer.yahoo.com/yui/3/scrollview/#start>`_.
.. code-block:: html
@@ -55,7 +55,7 @@ Context Configurations
Mojito allows you to map contexts to a set of configurations based on runtime
factors. The context is defined by the ``setting`` property in the JSON
configuration files. The default value for ``setting`` is ``master``.
-Mojito will first look to see if a base context wasset on the command line
+Mojito will first look to see if a base context was set on the command line
with the ``--context`` option, then at the HTTP headers and query string.
In this example, we want contexts defined for different devices, so, in
the ``application.json`` file, we'll define contexts for Android, Blackberry,
@@ -228,7 +228,7 @@ To set up and run ``device_views``:
}
]
-#. To configure routing, replace the code in ``routes.json`` with the
+#. To configure routing, replace the code in ``routes.json`` with the
following:
.. code-block:: javascript
Oops, something went wrong.

0 comments on commit 0e6a846

Please sign in to comment.