Permalink
Browse files

getting pr4 merged for partials

  • Loading branch information...
2 parents 6b2a5c4 + 0f5d67a commit 459bd5058a84300555d5bb8e1b0ec3634102d7f2 @caridy committed Nov 15, 2012
Showing with 28,474 additions and 5,066 deletions.
  1. +1 −0 .npmignore
  2. +1 −5 docs/dev_guide/api_overview/index.rst
  3. +10 −13 docs/dev_guide/api_overview/mojito_action_context.rst
  4. +72 −17 docs/dev_guide/api_overview/mojito_addons.rst
  5. +6 −4 docs/dev_guide/api_overview/mojito_client_obj.rst
  6. +9 −9 docs/dev_guide/api_overview/mojito_rest_lib.rst
  7. +47 −32 docs/dev_guide/code_exs/adding_assets.rst
  8. +18 −9 docs/dev_guide/code_exs/app_config.rst
  9. +2 −1 docs/dev_guide/code_exs/assets.rst
  10. +139 −114 docs/dev_guide/code_exs/binding_events.rst
  11. +82 −70 docs/dev_guide/code_exs/calling_yql.rst
  12. +2 −2 docs/dev_guide/code_exs/config.rst
  13. +32 −23 docs/dev_guide/code_exs/cookies.rst
  14. +51 −43 docs/dev_guide/code_exs/dynamic_assets.rst
  15. +2 −1 docs/dev_guide/code_exs/events.rst
  16. +43 −32 docs/dev_guide/code_exs/framed_assets.rst
  17. +44 −38 docs/dev_guide/code_exs/generating_urls.rst
  18. +53 −28 docs/dev_guide/code_exs/global_assets.rst
  19. +39 −28 docs/dev_guide/code_exs/htmlframe_view.rst
  20. +99 −51 docs/dev_guide/code_exs/i18n_apps.rst
  21. +7 −42 docs/dev_guide/code_exs/index.rst
  22. +2 −1 docs/dev_guide/code_exs/inter-mojit.rst
  23. +110 −98 docs/dev_guide/code_exs/intermojit_communication.rst
  24. +42 −41 docs/dev_guide/code_exs/multiple_mojits.rst
  25. +2 −2 docs/dev_guide/code_exs/other.rst
  26. +43 −0 docs/dev_guide/code_exs/overview.rst
  27. +63 −45 docs/dev_guide/code_exs/query_params.rst
  28. +69 −48 docs/dev_guide/code_exs/route_config.rst
  29. +38 −27 docs/dev_guide/code_exs/scroll_views.rst
  30. +51 −31 docs/dev_guide/code_exs/simple_logging.rst
  31. +42 −32 docs/dev_guide/code_exs/simple_view_template.rst
  32. +89 −65 docs/dev_guide/code_exs/view_engines.rst
  33. +2 −2 docs/dev_guide/code_exs/views.rst
  34. +77 −45 docs/dev_guide/code_exs/views_multiple_devices.rst
  35. +57 −33 docs/dev_guide/code_exs/yui_modules.rst
  36. +220 −0 docs/dev_guide/conf.py
  37. +20 −29 docs/dev_guide/faq/index.rst
  38. +6 −9 docs/dev_guide/getting_started/index.rst
  39. +0 −2 docs/dev_guide/getting_started/mojito_getting_started_requirements.rst
  40. +96 −59 docs/dev_guide/getting_started/mojito_getting_started_tutorial.rst
  41. +72 −0 docs/dev_guide/getting_started/quickstart.rst
  42. +75 −0 docs/dev_guide/index.rst
  43. +4 −6 docs/dev_guide/intro/index.rst
  44. +85 −45 docs/dev_guide/intro/mojito_apps.rst
  45. +36 −36 docs/dev_guide/intro/mojito_architecture.rst
  46. +110 −76 docs/dev_guide/intro/mojito_binders.rst
  47. +334 −180 docs/dev_guide/intro/mojito_configuring.rst
  48. +24 −18 docs/dev_guide/intro/mojito_mojits.rst
  49. +301 −303 docs/dev_guide/intro/mojito_mvc.rst
  50. +79 −40 docs/dev_guide/intro/mojito_overview.rst
  51. +50 −25 docs/dev_guide/intro/mojito_quicktour.rst
  52. +35 −14 docs/dev_guide/intro/mojito_static_resources.rst
  53. +25 −18 docs/dev_guide/quickstart/index.rst
  54. +75 −48 docs/dev_guide/reference/glossary.rst
  55. +0 −2 docs/dev_guide/reference/index.rst
  56. +142 −111 docs/dev_guide/reference/mojito_cmdline.rst
  57. +77 −42 docs/dev_guide/reference/mojito_troubleshooting.rst
  58. +19 −14 docs/dev_guide/resources/index.rst
  59. +8 −8 docs/dev_guide/topics/index.rst
  60. +110 −54 docs/dev_guide/topics/mojito_assets.rst
  61. +76 −41 docs/dev_guide/topics/mojito_composite_mojits.rst
  62. +167 −107 docs/dev_guide/topics/mojito_data.rst
  63. +321 −168 docs/dev_guide/topics/mojito_extensions.rst
  64. +144 −89 docs/dev_guide/topics/{mojito_framework_mojits.rst → mojito_frame_mojits.rst}
  65. +261 −0 docs/dev_guide/topics/mojito_hosting_container_reqs.rst
  66. +144 −144 docs/dev_guide/topics/mojito_logging.rst
  67. +73 −50 docs/dev_guide/topics/mojito_npm.rst
  68. +257 −208 docs/dev_guide/topics/mojito_resource_store.rst
  69. +246 −119 docs/dev_guide/topics/mojito_run_dyn_defined_mojits.rst
  70. +180 −133 docs/dev_guide/topics/mojito_testing.rst
  71. +197 −122 docs/dev_guide/topics/mojito_using_contexts.rst
  72. +35 −16 lib/app/addons/ac/deploy.server.js
  73. +10 −3 lib/app/addons/ac/intl.common.js
  74. +34 −40 lib/app/addons/rs/url.js
  75. +552 −81 lib/app/addons/rs/yui.js
  76. +7 −17 lib/app/archetypes/app/full/application.json
  77. +0 −4 lib/app/archetypes/mojit/default/controller.server.js.hb
  78. +8 −1 lib/app/archetypes/mojit/default/tests/models/foo.server-tests.js.hb
  79. +0 −4 lib/app/archetypes/mojit/full/controller.server.js.hb
  80. +18 −3 lib/app/archetypes/mojit/full/tests/models/{model.server-tests.js.hb → foo.server-tests.js.hb}
  81. +38 −0 lib/app/autoload/action-context.common.js
  82. +158 −58 lib/app/autoload/dispatch.common.js
  83. +6 −43 lib/app/autoload/mojito-client.client.js
  84. +18 −59 lib/app/autoload/store.server.js
  85. +1 −1 lib/app/autoload/{tunnel.client-optional.js → tunnel.common.js}
  86. +20 −0 lib/app/autoload/util.common.js
  87. +39 −2 lib/app/commands/build.js
  88. +13 −12 lib/app/commands/test.js
  89. +0 −593 lib/app/middleware/mojito-combo-handler.js
  90. +192 −89 lib/app/middleware/mojito-handler-static.js
  91. +4 −0 lib/config.json
  92. +26 −38 lib/management/utils.js
  93. +22 −11 lib/mojito.js
  94. +4 −4 lib/store.js
  95. +3 −0 lib/yui-sandbox.js
  96. +2 −3 package.json
  97. +29 −3 tests/base/mojito-test.js
  98. +383 −387 tests/func/applications/frameworkapp/common/application.json
  99. +5 −1 tests/func/applications/frameworkapp/common/mojits/BroadCast/controller.common.js
  100. +1 −1 tests/func/applications/frameworkapp/common/mojits/CM_Nav/binders/index.js
  101. +0 −4 tests/func/applications/frameworkapp/common/mojits/CM_Nav/controller.common.js
  102. +2 −2 tests/func/applications/frameworkapp/common/mojits/CM_Nav/views/index.mu.html
  103. +0 −2 tests/func/common/html5apptest_descriptor.json
  104. +14 −18 tests/func/common/testacmojitdone1client.js
  105. +2 −6 tests/func/common/testcompositemojit1client.js
  106. +12 −2 tests/func/common/testconfiginappfilecompclient.js
  107. +18 −3 tests/func/common/testconfiginappfilecompserver.js
  108. +2 −6 tests/func/common/testdependencyclient.js
  109. +1 −3 tests/func/common/testmojitproxybroadcaststaticlisten2.js
  110. +2 −1 tests/func/examples/developerguide/test_yuimodule.js
  111. +28 −0 tests/harness/lib/yuitest/LICENSE
  112. +1 −0 tests/harness/lib/yuitest/README
  113. +33 −0 tests/harness/lib/yuitest/java/README
  114. +39 −0 tests/harness/lib/yuitest/java/ant.properties
  115. +243 −0 tests/harness/lib/yuitest/java/build.xml
  116. BIN tests/harness/lib/yuitest/java/build/yuitest-coverage-report.jar
  117. BIN tests/harness/lib/yuitest/java/build/yuitest-coverage.jar
  118. BIN tests/harness/lib/yuitest/java/build/yuitest-selenium-driver.jar
  119. BIN tests/harness/lib/yuitest/java/lib/antlr-2.7.7.jar
  120. BIN tests/harness/lib/yuitest/java/lib/antlr-3.2.jar
  121. BIN tests/harness/lib/yuitest/java/lib/antlr-runtime-3.2.jar
  122. BIN tests/harness/lib/yuitest/java/lib/jargs-1.0.jar
  123. BIN tests/harness/lib/yuitest/java/lib/junit-4.1.jar
  124. BIN tests/harness/lib/yuitest/java/lib/selenium-java-client-driver.jar
  125. BIN tests/harness/lib/yuitest/java/lib/stringtemplate-3.2.1.jar
  126. +114 −0 tests/harness/lib/yuitest/java/src/com/yahoo/platform/yuitest/config/TestConfig.java
  127. +114 −0 tests/harness/lib/yuitest/java/src/com/yahoo/platform/yuitest/config/TestPage.java
  128. +119 −0 tests/harness/lib/yuitest/java/src/com/yahoo/platform/yuitest/config/TestPageGroup.java
  129. +108 −0 tests/harness/lib/yuitest/java/src/com/yahoo/platform/yuitest/coverage/DirectoryInstrumenter.java
  130. +274 −0 tests/harness/lib/yuitest/java/src/com/yahoo/platform/yuitest/coverage/ES3YUITest.tokens
  131. +53 −0 tests/harness/lib/yuitest/java/src/com/yahoo/platform/yuitest/coverage/ES3YUITestTemplates.stg
  132. +114 −0 tests/harness/lib/yuitest/java/src/com/yahoo/platform/yuitest/coverage/FileInstrumenter.java
  133. +123 −0 tests/harness/lib/yuitest/java/src/com/yahoo/platform/yuitest/coverage/JavaScriptInstrumenter.java
  134. +152 −0 tests/harness/lib/yuitest/java/src/com/yahoo/platform/yuitest/coverage/YUITestCoverage.java
  135. +1,536 −0 tests/harness/lib/yuitest/java/src/com/yahoo/platform/yuitest/coverage/grammar/ES3.g
  136. +1,612 −0 tests/harness/lib/yuitest/java/src/com/yahoo/platform/yuitest/coverage/grammar/ES3Instrument.g
  137. +55 −0 ...arness/lib/yuitest/java/src/com/yahoo/platform/yuitest/coverage/grammar/ES3Instrument_license.txt
  138. +1,751 −0 tests/harness/lib/yuitest/java/src/com/yahoo/platform/yuitest/coverage/grammar/ES3YUITest.g
  139. +30 −0 tests/harness/lib/yuitest/java/src/com/yahoo/platform/yuitest/coverage/grammar/ES3_license.txt
  140. +22 −0 ...ness/lib/yuitest/java/src/com/yahoo/platform/yuitest/coverage/report/CoverageReportGenerator.java
  141. +28 −0 ...b/yuitest/java/src/com/yahoo/platform/yuitest/coverage/report/CoverageReportGeneratorFactory.java
  142. +112 −0 .../harness/lib/yuitest/java/src/com/yahoo/platform/yuitest/coverage/report/GCOVReportGenerator.java
  143. +120 −0 .../harness/lib/yuitest/java/src/com/yahoo/platform/yuitest/coverage/report/HTMLReportGenerator.java
  144. +209 −0 .../harness/lib/yuitest/java/src/com/yahoo/platform/yuitest/coverage/report/LCOVReportGenerator.java
  145. +141 −0 ...arness/lib/yuitest/java/src/com/yahoo/platform/yuitest/coverage/report/YUITestCoverageReport.java
  146. +150 −0 ...ess/lib/yuitest/java/src/com/yahoo/platform/yuitest/coverage/results/DirectoryCoverageReport.java
  147. +322 −0 .../harness/lib/yuitest/java/src/com/yahoo/platform/yuitest/coverage/results/FileCoverageReport.java
  148. +47 −0 tests/harness/lib/yuitest/java/src/com/yahoo/platform/yuitest/coverage/results/FileFunction.java
  149. +23 −0 ...ness/lib/yuitest/java/src/com/yahoo/platform/yuitest/coverage/results/FileFunctionComparator.java
  150. +51 −0 tests/harness/lib/yuitest/java/src/com/yahoo/platform/yuitest/coverage/results/FileLine.java
  151. +299 −0 ...rness/lib/yuitest/java/src/com/yahoo/platform/yuitest/coverage/results/SummaryCoverageReport.java
  152. +66 −0 ...test/java/src/com/yahoo/platform/yuitest/coverage/writers/AbstractStringTemplateReportWriter.java
  153. +23 −0 tests/harness/lib/yuitest/java/src/com/yahoo/platform/yuitest/coverage/writers/FileReportWriter.java
  154. +27 −0 ...ess/lib/yuitest/java/src/com/yahoo/platform/yuitest/coverage/writers/FileReportWriterFactory.java
  155. +34 −0 ...ness/lib/yuitest/java/src/com/yahoo/platform/yuitest/coverage/writers/GCOVFileReportTemplates.stg
  156. +179 −0 ...ness/lib/yuitest/java/src/com/yahoo/platform/yuitest/coverage/writers/HTMLFileReportTemplates.stg
  157. +115 −0 ...s/lib/yuitest/java/src/com/yahoo/platform/yuitest/coverage/writers/HTMLSummaryReportTemplates.stg
  158. +21 −0 ...ess/lib/yuitest/java/src/com/yahoo/platform/yuitest/coverage/writers/HTMLSummaryReportWriter.java
  159. +114 −0 .../yuitest/java/src/com/yahoo/platform/yuitest/coverage/writers/StringTemplateFileReportWriter.java
  160. +48 −0 ...itest/java/src/com/yahoo/platform/yuitest/coverage/writers/StringTemplateSummaryReportWriter.java
  161. +23 −0 ...harness/lib/yuitest/java/src/com/yahoo/platform/yuitest/coverage/writers/SummaryReportWriter.java
  162. +111 −0 tests/harness/lib/yuitest/java/src/com/yahoo/platform/yuitest/results/Test.java
  163. +123 −0 tests/harness/lib/yuitest/java/src/com/yahoo/platform/yuitest/results/TestCase.java
  164. +91 −0 tests/harness/lib/yuitest/java/src/com/yahoo/platform/yuitest/results/TestReport.java
  165. +101 −0 tests/harness/lib/yuitest/java/src/com/yahoo/platform/yuitest/results/TestReportXMLHandler.java
  166. +137 −0 tests/harness/lib/yuitest/java/src/com/yahoo/platform/yuitest/results/TestSuite.java
  167. +63 −0 tests/harness/lib/yuitest/java/src/com/yahoo/platform/yuitest/selenium/RawTestResultsParser.java
  168. +470 −0 tests/harness/lib/yuitest/java/src/com/yahoo/platform/yuitest/selenium/SeleniumDriver.java
  169. +93 −0 tests/harness/lib/yuitest/java/src/com/yahoo/platform/yuitest/selenium/SessionResult.java
  170. +137 −0 .../harness/lib/yuitest/java/src/com/yahoo/platform/yuitest/selenium/SessionResultFileGenerator.java
  171. +264 −0 tests/harness/lib/yuitest/java/src/com/yahoo/platform/yuitest/selenium/YUITestSeleniumDriver.java
  172. +36 −0 tests/harness/lib/yuitest/java/src/com/yahoo/platform/yuitest/selenium/default.properties
  173. +173 −0 tests/harness/lib/yuitest/java/src/com/yahoo/platform/yuitest/writers/CoverageFileReportHTML.stg
  174. +115 −0 tests/harness/lib/yuitest/java/src/com/yahoo/platform/yuitest/writers/CoverageSummaryReportHTML.stg
  175. +32 −0 tests/harness/lib/yuitest/java/src/com/yahoo/platform/yuitest/writers/CoverageSummaryReportLCOV.stg
  176. +32 −0 tests/harness/lib/yuitest/java/src/com/yahoo/platform/yuitest/writers/GCOVFileReport.stg
  177. +630 −0 tests/harness/lib/yuitest/java/src/com/yahoo/platform/yuitest/writers/LCOVHTMLDirectoryReport.stg
  178. +594 −0 tests/harness/lib/yuitest/java/src/com/yahoo/platform/yuitest/writers/LCOVHTMLFileReport.stg
  179. +590 −0 tests/harness/lib/yuitest/java/src/com/yahoo/platform/yuitest/writers/LCOVHTMLFunctionReport.stg
  180. +630 −0 tests/harness/lib/yuitest/java/src/com/yahoo/platform/yuitest/writers/LCOVHTMLIndexReport.stg
  181. +22 −0 tests/harness/lib/yuitest/java/src/com/yahoo/platform/yuitest/writers/ReportWriter.java
  182. +30 −0 tests/harness/lib/yuitest/java/src/com/yahoo/platform/yuitest/writers/ReportWriterFactory.java
  183. +115 −0 tests/harness/lib/yuitest/java/src/com/yahoo/platform/yuitest/writers/StringTemplateWriter.java
  184. +31 −0 tests/harness/lib/yuitest/java/src/com/yahoo/platform/yuitest/writers/TestReportJUnitXML.stg
  185. +37 −0 tests/harness/lib/yuitest/java/src/com/yahoo/platform/yuitest/writers/TestReportTAP.stg
  186. +28 −0 tests/harness/lib/yuitest/java/src/com/yahoo/platform/yuitest/writers/TestReportYUITestXML.stg
  187. +279 −0 tests/harness/lib/yuitest/java/src/org/json/CDL.java
  188. +169 −0 tests/harness/lib/yuitest/java/src/org/json/Cookie.java
  189. +90 −0 tests/harness/lib/yuitest/java/src/org/json/CookieList.java
  190. +163 −0 tests/harness/lib/yuitest/java/src/org/json/HTTP.java
  191. +77 −0 tests/harness/lib/yuitest/java/src/org/json/HTTPTokener.java
  192. +960 −0 tests/harness/lib/yuitest/java/src/org/json/JSONArray.java
  193. +27 −0 tests/harness/lib/yuitest/java/src/org/json/JSONException.java
  194. +455 −0 tests/harness/lib/yuitest/java/src/org/json/JSONML.java
  195. +1,569 −0 tests/harness/lib/yuitest/java/src/org/json/JSONObject.java
  196. +18 −0 tests/harness/lib/yuitest/java/src/org/json/JSONString.java
  197. +78 −0 tests/harness/lib/yuitest/java/src/org/json/JSONStringer.java
  198. +425 −0 tests/harness/lib/yuitest/java/src/org/json/JSONTokener.java
  199. +323 −0 tests/harness/lib/yuitest/java/src/org/json/JSONWriter.java
  200. +437 −0 tests/harness/lib/yuitest/java/src/org/json/XML.java
  201. +365 −0 tests/harness/lib/yuitest/java/src/org/json/XMLTokener.java
  202. +101 −0 tests/harness/lib/yuitest/java/tests/com/yahoo/platform/yuitest/config/TestConfigTest.java
  203. +14 −0 tests/harness/lib/yuitest/java/tests/com/yahoo/platform/yuitest/config/tests.xml
  204. +138 −0 ...rness/lib/yuitest/java/tests/com/yahoo/platform/yuitest/coverage/results/DirectoryReportTest.java
  205. +277 −0 tests/harness/lib/yuitest/java/tests/com/yahoo/platform/yuitest/coverage/results/FileReportTest.java
  206. +100 −0 ...harness/lib/yuitest/java/tests/com/yahoo/platform/yuitest/coverage/results/SummaryReportTest.java
  207. +155 −0 tests/harness/lib/yuitest/java/tests/com/yahoo/platform/yuitest/coverage/results/coverage.json
  208. +148 −0 tests/harness/lib/yuitest/java/tests/com/yahoo/platform/yuitest/coverage/results/coverage2.json
  209. +155 −0 tests/harness/lib/yuitest/java/tests/com/yahoo/platform/yuitest/coverage/results/coverage3.json
  210. +101 −0 tests/harness/lib/yuitest/java/tests/com/yahoo/platform/yuitest/results/TestCaseTest.java
  211. +105 −0 tests/harness/lib/yuitest/java/tests/com/yahoo/platform/yuitest/results/TestReportTest.java
  212. +116 −0 tests/harness/lib/yuitest/java/tests/com/yahoo/platform/yuitest/results/TestSuiteTest.java
  213. +108 −0 tests/harness/lib/yuitest/java/tests/com/yahoo/platform/yuitest/results/TestTest.java
  214. +59 −0 tests/harness/lib/yuitest/java/tests/com/yahoo/platform/yuitest/results/results.xml
  215. +1 −0 tests/harness/lib/yuitest/java/tests/coverage.json
  216. +32 −9 tests/run.js
  217. +27 −9 tests/unit/lib/app/addons/ac/test-deploy.server.js
  218. +40 −12 tests/unit/lib/app/addons/ac/test-intl.common.js
  219. +24 −55 tests/unit/lib/app/addons/rs/test-url.js
  220. +177 −8 tests/unit/lib/app/addons/rs/test-yui.js
  221. +2 −2 tests/unit/lib/app/autoload/autoload_test_descriptor.json
  222. +137 −66 tests/unit/lib/app/autoload/test-dispatch.common.js
  223. +4 −7 tests/unit/lib/app/autoload/test-store.server.js
  224. +1 −1 tests/unit/lib/app/autoload/{test-tunnel.client-optional.js → test-tunnel.common.js}
  225. +16 −0 tests/unit/lib/app/autoload/test-util.common.js
  226. +1 −1 tests/unit/lib/app/middleware/test-contextualizer.js
  227. +346 −19 tests/unit/lib/app/middleware/test-handler-static.js
  228. +1 −1 tests/unit/lib/app/middleware/test-handler-tunnel.js
  229. +1 −1 tests/unit/lib/app/middleware/test-router.js
  230. +2 −1 tests/unit/lib/lib_test_descriptor.json
  231. +83 −0 tests/unit/lib/test-mojito.js
  232. +13 −1 tests/unit/lib/test-server-log.server.js
View
@@ -5,6 +5,7 @@
*.bak
*~
/tests
+!/tests/harness/lib/yuitest/java/build
arrowreport
artifacts
examples
@@ -13,17 +13,13 @@ The API contains the following five modules:
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.
+ ``Action Context`` object 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.
- **MojitServer** - is the module that provides access to the Mojito server.
-
-Table of Contents
-#################
-
.. toctree::
:maxdepth: 2
@@ -1,18 +1,18 @@
-
-
==============
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`` 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
@@ -29,9 +29,6 @@ the ``done`` method sends the ``data`` object to the ``index`` template.
* @constructor
*/
Y.namespace('mojito.controllers')[NAME] = {
- init: function(config) {
- this.config = config;
- },
/**
* Method corresponding to the 'index' action.
*
@@ -1,15 +1,14 @@
+=====================
+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>`_
+for the addon classes.
-======
-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.
-
-Addons allow you to do the following:
+The Action Context addons allow you to do the following:
- access assets, such as CSS and JavaScript files
- get configuration information
@@ -19,21 +18,74 @@ Addons allow you to do the following:
- get and set HTTP headers
- create URLs
+
+.. _mojito_addons-syntax:
+
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()``
+
+.. _addons-requiring:
+
+Requiring Addons
+================
+
+Prior to version 0.5.0, Mojito attached addons to the ``ActionContext`` object for
+every HTTP request and mojit instance. As a result, you were able to use
+any of the Action Context addons by default.
+
+In Mojito versions 0.5.0 and later, you need to explicitly require an addon before you
+can use it. You require an addon by including an associated string in the
+``requires`` array of your controller. For example, in the controller below,
+the ``Params`` addon is required by adding the string ``'mojito-params-addon'`` to the
+``requires`` array.
+
+
+.. code-block:: javascript
+
+ YUI.add('Foo', function(Y, NAME) {
+ Y.namespace('mojito.controllers')[NAME] = {
+ index: function(ac) {
+ var all_params = ac.params.all();
+ }
+ };
+ // Require the addon by adding the param name to the requires array
+ }, '0.0.1', {requires: ['mojito', 'mojito-params-addon']});
+
+The list below shows what strings are used to require addons.
+
+- ``Assets`` addon - ``requires ['mojito-assets-addon']``
+- ``Composite`` addon - ``requires ['mojito-composite-addon']``
+- ``Config`` addon - ``requires ['mojito-config-addon']``
+- ``Cookies`` addon - ``requires ['mojito-cookie-addon']``
+- ``Http`` addon - ``requires ['mojito-http-addon']``
+- ``Intl`` addon - ``requires ['mojito-intl-addon']``
+- ``Params`` addon - ``requires ['mojito-params-addon']``
+- ``Url`` addon - ``requires ['mojito-url-addon']``
+
+
+.. note::
+ To run older applications with Mojito v0.5.0 and later, you will need to
+ modify your controllers so that the ActionContext addons that are being
+ used are required. The most common addons are ``Config``, ``Params``, ``Url``,
+ and ``Assets``.
+
+
+
+.. _mojito_addons-exs:
+
Addon Examples
-##############
+==============
The following code examples use the addons in parentheses:
@@ -44,8 +96,11 @@ The following code examples use the addons in parentheses:
- `Internationalizing Your Application <../code_exs/i18n_apps.html>`_ (``Intl``)
- `Using Multiple Mojits <../code_exs/multiple_mojits.html>`_ (``Composite``)
+
+.. _mojito_addons-create:
+
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
@@ -1,5 +1,3 @@
-
-
=============
Client Object
=============
@@ -9,17 +7,21 @@ created. The ``client`` object can be used to pause and resume mojits running wi
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.
``Y.mojito.client.pause()``
+.. _mojito_client_obj-resume:
+
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.
@@ -1,5 +1,3 @@
-
-
============
REST Library
============
@@ -8,11 +6,13 @@ Mojito has a library to make it easier to make a REST calls to Web services from
implementation details, see `Class Y.mojito.lib.REST <../../api/classes/Y.mojito.lib.REST.html>`_
in the Mojito API documentation.
+.. _mojito_rest_lib-incl:
+
Including Library
-#################
+=================
-To use the REST library, include the string 'mojito-rest-lib' in the ``requires`` array, which
-instructs YUI to load the library. Once the library is loaded, you can use
+To use the REST library, include the string 'mojito-rest-lib' in the ``requires`` array,
+which instructs YUI to load the library. Once the library is loaded, you can use
`Y.mojito.lib.REST <../../api/classes/Y.mojito.lib.REST.html>`_ to make REST calls..
.. code-block:: javascript
@@ -25,8 +25,11 @@ instructs YUI to load the library. Once the library is loaded, you can use
// Ask YUI to load the library w/ 'mojito-rest-lib'.
}, '0.0.1', {requires: ['mojito', 'mojito-rest-lib']});
+
+.. _mojito_rest_lib-ex:
+
Example
-#######
+=======
In the model for the ``recipeSearch`` mojit below, the REST library is used to make a GET call to
the Recipe Puppy API.
@@ -35,9 +38,6 @@ the Recipe Puppy API.
YUI.add('ProductSearchModel', function(Y, NAME) {
Y.namespace('mojito.models')[NAME] = {
- init: function(config) {
- this.config = config;
- },
recipeSearch: function(count, cb) {
var url = 'http://www.recipepuppy.com/api/';
var params = {
Oops, something went wrong. Retry.

0 comments on commit 459bd50

Please sign in to comment.