Permalink
Browse files

Merge branch 'yaf-develop' of git://github.com/drewfish/mojito

  • Loading branch information...
2 parents a4fe91e + f5818a5 commit c6c11d8b6a0b3e418f42cab7d252f0c3a99c3ab3 @caridy committed Aug 28, 2012
Showing with 966 additions and 514 deletions.
  1. +12 −6 docs/dev_guide/api_overview/index.rst
  2. +10 −6 docs/dev_guide/api_overview/mojito_action_context.rst
  3. +11 −5 docs/dev_guide/api_overview/mojito_addons.rst
  4. +28 −16 docs/dev_guide/code_exs/adding_assets.rst
  5. +10 −5 docs/dev_guide/code_exs/app_config.rst
  6. +95 −55 docs/dev_guide/code_exs/binding_events.rst
  7. +47 −23 docs/dev_guide/code_exs/calling_yql.rst
  8. +2 −1 docs/dev_guide/code_exs/config.rst
  9. +22 −10 docs/dev_guide/code_exs/cookies.rst
  10. +38 −24 docs/dev_guide/code_exs/dynamic_assets.rst
  11. +34 −20 docs/dev_guide/code_exs/framed_assets.rst
  12. +28 −14 docs/dev_guide/code_exs/generating_urls.rst
  13. +29 −15 docs/dev_guide/code_exs/global_assets.rst
  14. +29 −17 docs/dev_guide/code_exs/htmlframe_view.rst
  15. +47 −22 docs/dev_guide/code_exs/i18n_apps.rst
  16. +11 −4 docs/dev_guide/code_exs/index.rst
  17. +77 −38 docs/dev_guide/code_exs/intermojit_communication.rst
  18. +32 −19 docs/dev_guide/code_exs/multiple_mojits.rst
  19. +2 −2 docs/dev_guide/code_exs/other.rst
  20. +44 −24 docs/dev_guide/code_exs/query_params.rst
  21. +31 −17 docs/dev_guide/code_exs/route_config.rst
  22. +20 −12 docs/dev_guide/code_exs/scroll_views.rst
  23. +26 −14 docs/dev_guide/code_exs/simple_logging.rst
  24. +14 −11 docs/dev_guide/code_exs/{simple_view_template.rst → simple_view.rst}
  25. +9 −9 docs/dev_guide/code_exs/view_engines.rst
  26. +3 −2 docs/dev_guide/code_exs/views.rst
  27. +22 −13 docs/dev_guide/code_exs/views_multiple_devices.rst
  28. +29 −14 docs/dev_guide/code_exs/yui_modules.rst
  29. +11 −11 docs/dev_guide/faq/index.rst
  30. +2 −2 docs/dev_guide/intro/mojito_apps.rst
  31. +2 −2 docs/dev_guide/intro/mojito_binders.rst
  32. +3 −3 docs/dev_guide/intro/mojito_mojits.rst
  33. +21 −21 docs/dev_guide/intro/mojito_mvc.rst
  34. +3 −3 docs/dev_guide/reference/glossary.rst
  35. +2 −2 docs/dev_guide/reference/mojito_troubleshooting.rst
  36. +2 −2 docs/dev_guide/topics/mojito_assets.rst
  37. +7 −7 docs/dev_guide/topics/mojito_composite_mojits.rst
  38. +3 −3 docs/dev_guide/topics/mojito_data.rst
  39. +11 −11 docs/dev_guide/topics/mojito_extensions.rst
  40. +2 −2 docs/dev_guide/topics/mojito_framework_mojits.rst
  41. +4 −4 docs/dev_guide/topics/mojito_resource_store.rst
  42. +22 −22 docs/dev_guide/topics/mojito_run_dyn_defined_mojits.rst
  43. +5 −1 package.json
  44. +66 −0 source/lib/app/addons/rs/localyui.server.js
  45. +38 −0 source/lib/app/middleware/mojito-handler-localyui.js
@@ -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.
@@ -4,12 +4,16 @@
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`` view 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
@@ -36,7 +40,7 @@ the ``done`` method sends the ``data`` object to the ``index`` view template.
* provides access to the Mojito API.
*/
index: function(ac) {
- var data = { "data":"data passed to the index view template" };
+ var data = { "data":"data passed to the index template" };
ac.done(data);
}
};
@@ -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>`_.
@@ -11,17 +11,18 @@ Adding CSS
Summary
#######
-This example shows how to include assets (CSS) in the view template of a mojit.
+This example shows how to include assets (CSS) in the template of a mojit.
The following topics will be covered:
- configuring an application to have assets
-- including assets in the view template
+- including assets in the template
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
+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:
@@ -37,7 +38,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,7 +54,8 @@ In the ``simple`` mojit below, you see the local ``assets`` directory for CSS fi
|-- 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
@@ -66,15 +69,18 @@ This code example only uses local CSS, so the ``simple.css`` file is placed in t
}
.toolbar li { display:inline; }
-The CSS files in the mojit ``assets`` directory can be accessed in the view 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`` view 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
@@ -84,7 +90,7 @@ The ``index.hb.html`` view template below includes ``simple.css`` from the ``ass
<script type="text/javascript">
// Changes background color of the header.
// Note: JavaScript code should not be hard
- // coded into the view template. It's done
+ // coded into the template. It's done
// here to simplify the code example.
function setColor(id, color) {
document.getElementById(id).style.backgroundColor = color;
@@ -103,12 +109,15 @@ The ``index.hb.html`` view template below includes ``simple.css`` from the ``ass
</body>
</html>
-To access the global assets for the application, you use a similar syntax, replacing the mojit name with the application name. Thus, if the application name is ``simple_assets`` and ``simple.css``
+To access the global assets for the application, you use a similar syntax, replacing the mojit name
+with the application name. Thus, if the application name is ``simple_assets`` and ``simple.css``
is in ``simple_assets/assets/``, you would access ``simple.css`` with the following path:
``/static/simple_assets/assets/simple.css``
-.. note:: For the purpose of simplifying this code example, the ``setColor`` function was hardcoded into the view template. In your Mojito applications, you should avoid mixing the business and presentation logic of your application by hardcoding JavaScript into your view template.
+.. note:: For the purpose of simplifying this code example, the ``setColor`` function was hardcoded
+ into the template. In your Mojito applications, you should avoid mixing the business and
+ presentation logic of your application by hardcoding JavaScript into your template.
Setting Up this Example
#######################
@@ -125,7 +134,8 @@ To create and run ``simple_assets``:
``$ mojito create mojit simple``
-#. To configure your application to use the ``simple`` mojit, replace the code in ``application.json`` with the following:
+#. To configure your application to use the ``simple`` mojit, replace the code in
+ ``application.json`` with the following:
.. code-block:: javascript
@@ -160,7 +170,8 @@ To create and run ``simple_assets``:
``$ cd mojits/simple``
-#. Modify your controller to pass an array of objects to the view 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
@@ -201,7 +212,8 @@ To create and run ``simple_assets``:
};
}, '0.0.1', {requires: []});
-#. Include the assets in your view 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
@@ -211,7 +223,7 @@ To create and run ``simple_assets``:
<script type="text/javascript">
// Changes background color of the header.
// Note: JavaScript code should not be hard
- // coded into the view template. It's done
+ // coded into the template. It's done
// here to simplify the code example.
function setColor(id, color) {
document.getElementById(id).style.backgroundColor = color;
@@ -256,7 +268,7 @@ Source Code
###########
- `Mojit Assets <http://github.com/yahoo/mojito/tree/master/examples/developer-guide/simple_assets/mojits/simple/assets/>`_
-- `Index View Template <http://github.com/yahoo/mojito/tree/master/examples/developer-guide/simple_assets/mojits/simple/views/index.hb.html>`_
+- `Index Template <http://github.com/yahoo/mojito/tree/master/examples/developer-guide/simple_assets/mojits/simple/views/index.hb.html>`_
- `Simple Assets Application <http://github.com/yahoo/mojito/tree/master/examples/developer-guide/simple_assets/>`_
@@ -16,7 +16,8 @@ This example shows how to configure a mojit and the routing for your application
Implementation Notes
####################
-The ``application.json`` file is used to specify the mojits that your application can use. The example ``application.json`` below specifies that the application use the mojit ``SimpleMojit``.
+The ``application.json`` file is used to specify the mojits that your application can use. The
+example ``application.json`` below specifies that the application use the mojit ``SimpleMojit``.
.. code-block:: javascript
@@ -31,7 +32,9 @@ The ``application.json`` file is used to specify the mojits that your applicatio
}
]
-The routing configuration for Mojito applications is contained in ``routes.json``. In this example ``routes.json``, the Mojito server is told to call the ``index`` method in the controller when an HTTP GET is called on the root path.
+The routing configuration for Mojito applications is contained in ``routes.json``. In this example
+``routes.json``, the Mojito server is told to call the ``index`` method in the controller when an
+HTTP GET is called on the root path.
.. code-block:: javascript
@@ -46,8 +49,9 @@ The routing configuration for Mojito applications is contained in ``routes.json`
}
]
-The ``index`` method is a canned method in the controller when you create a mojit. To learn how to create view templates that get data from the controller,
-see `Creating a Simple View with Handlebars <simple_view_template.html>`_.
+The ``index`` method is a canned method in the controller when you create a mojit. To learn how to
+create templates that get data from the controller,
+see `Creating a Simple View with Handlebars <simple_view.html>`_.
Setting Up this Example
#######################
@@ -64,7 +68,8 @@ To set up and run ``simple_config``:
``$ mojito create mojit SimpleMojit``
-#. To specify that your application use ``SimpleMojit``, replace the code in ``application.json`` with the following:
+#. To specify that your application use ``SimpleMojit``, replace the code in ``application.json``
+ with the following:
.. code-block:: javascript
Oops, something went wrong.

0 comments on commit c6c11d8

Please sign in to comment.