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

[docs] Copy edited the entire developer guide documentation. #782

Merged
merged 1 commit into from Nov 22, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 8 additions & 7 deletions docs/dev_guide/api_overview/index.rst
Expand Up @@ -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::
Expand Down
6 changes: 4 additions & 2 deletions docs/dev_guide/api_overview/mojito_addons.rst
Expand Up @@ -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:
Expand Down
19 changes: 10 additions & 9 deletions docs/dev_guide/api_overview/mojito_client_obj.rst
Expand Up @@ -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()``

Expand All @@ -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()``

Expand Down
11 changes: 6 additions & 5 deletions docs/dev_guide/api_overview/mojito_rest_lib.rst
Expand Up @@ -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:

Expand All @@ -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

Expand Down
33 changes: 16 additions & 17 deletions docs/dev_guide/code_exs/binding_events.rst
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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

Expand All @@ -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

Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions docs/dev_guide/code_exs/cookies.rst
Expand Up @@ -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

Expand All @@ -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

Expand Down
3 changes: 2 additions & 1 deletion docs/dev_guide/code_exs/framed_assets.rst
Expand Up @@ -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

Expand Down
7 changes: 3 additions & 4 deletions docs/dev_guide/code_exs/global_assets.rst
Expand Up @@ -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:

Expand Down
2 changes: 1 addition & 1 deletion docs/dev_guide/code_exs/htmlframe_view.rst
Expand Up @@ -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>`_.
Expand Down
4 changes: 2 additions & 2 deletions docs/dev_guide/code_exs/multiple_mojits.rst
Expand Up @@ -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:
Expand Down
7 changes: 3 additions & 4 deletions docs/dev_guide/code_exs/scroll_views.rst
Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions docs/dev_guide/code_exs/views_multiple_devices.rst
Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand Down