Skip to content
Browse files

merge partials and 0.5.0GA

  • Loading branch information...
2 parents 9d75095 + f57eed2 commit 2044d1f376d155b9abb73f0fb3695add253a002a @caridy committed Dec 6, 2012
Showing with 4,448 additions and 12,084 deletions.
  1. +1 −0 .gitignore
  2. +0 −1 .npmignore
  3. +183 −42 DEPRECATIONS.md
  4. +6 −11 bin/mojito
  5. +8 −7 docs/dev_guide/api_overview/index.rst
  6. +10 −7 docs/dev_guide/api_overview/mojito_addons.rst
  7. +10 −9 docs/dev_guide/api_overview/mojito_client_obj.rst
  8. +7 −6 docs/dev_guide/api_overview/mojito_rest_lib.rst
  9. +1 −11 docs/dev_guide/code_exs/adding_assets.rst
  10. +1 −1 docs/dev_guide/code_exs/app_config.rst
  11. +43 −23 docs/dev_guide/code_exs/binding_events.rst
  12. +4 −3 docs/dev_guide/code_exs/calling_yql.rst
  13. +4 −4 docs/dev_guide/code_exs/cookies.rst
  14. +2 −1 docs/dev_guide/code_exs/framed_assets.rst
  15. +3 −4 docs/dev_guide/code_exs/global_assets.rst
  16. +1 −1 docs/dev_guide/code_exs/htmlframe_view.rst
  17. +1 −1 docs/dev_guide/code_exs/intermojit_communication.rst
  18. +2 −2 docs/dev_guide/code_exs/multiple_mojits.rst
  19. +20 −1 docs/dev_guide/code_exs/query_params.rst
  20. +96 −69 docs/dev_guide/code_exs/scroll_views.rst
  21. +127 −94 docs/dev_guide/code_exs/simple_logging.rst
  22. +2 −3 docs/dev_guide/code_exs/views_multiple_devices.rst
  23. +44 −34 docs/dev_guide/code_exs/yui_modules.rst
  24. +58 −39 docs/dev_guide/faq/index.rst
  25. +12 −8 docs/dev_guide/getting_started/mojito_getting_started_tutorial.rst
  26. +4 −3 docs/dev_guide/getting_started/quickstart.rst
  27. +10 −6 docs/dev_guide/index.rst
  28. +16 −16 docs/dev_guide/intro/mojito_apps.rst
  29. +2 −1 docs/dev_guide/intro/mojito_binders.rst
  30. +111 −76 docs/dev_guide/intro/mojito_configuring.rst
  31. +4 −4 docs/dev_guide/intro/mojito_mojits.rst
  32. +46 −38 docs/dev_guide/intro/mojito_mvc.rst
  33. +10 −14 docs/dev_guide/reference/glossary.rst
  34. +58 −56 docs/dev_guide/reference/mojito_cmdline.rst
  35. +7 −7 docs/dev_guide/reference/mojito_troubleshooting.rst
  36. +6 −6 docs/dev_guide/topics/mojito_assets.rst
  37. +10 −11 docs/dev_guide/topics/mojito_composite_mojits.rst
  38. +28 −2 docs/dev_guide/topics/mojito_data.rst
  39. +51 −81 docs/dev_guide/topics/mojito_extensions.rst
  40. +3 −8 docs/dev_guide/topics/mojito_frame_mojits.rst
  41. +114 −109 docs/dev_guide/topics/mojito_hosting_container_reqs.rst
  42. +136 −39 docs/dev_guide/topics/mojito_logging.rst
  43. +4 −7 docs/dev_guide/topics/mojito_npm.rst
  44. +14 −16 docs/dev_guide/topics/mojito_resource_store.rst
  45. +2 −2 docs/dev_guide/topics/mojito_run_dyn_defined_mojits.rst
  46. +79 −92 docs/dev_guide/topics/mojito_testing.rst
  47. +15 −13 docs/dev_guide/topics/mojito_using_contexts.rst
  48. +18 −9 examples/developer-guide/adding_view_engines/server.js
  49. +20 −5 examples/developer-guide/binding_events/server.js
  50. +0 −48 examples/developer-guide/configure_routing/mojits/RoutingMojit/binders/index.js
  51. +1 −1 examples/developer-guide/configure_routing/mojits/RoutingMojit/models/model.server.js
  52. +20 −5 examples/developer-guide/configure_routing/server.js
  53. +21 −5 examples/developer-guide/device_assets/server.js
  54. +1 −0 examples/developer-guide/device_views/mojits/device/models/model.server.js
  55. +20 −5 examples/developer-guide/device_views/server.js
  56. +20 −5 examples/developer-guide/framed_assets/server.js
  57. +21 −5 examples/developer-guide/framed_config/server.js
  58. +21 −5 examples/developer-guide/generating_urls/server.js
  59. +21 −5 examples/developer-guide/global_assets/server.js
  60. +21 −5 examples/developer-guide/hello/server.js
  61. +21 −5 examples/developer-guide/htmlframe_mojit/server.js
  62. +0 −1 examples/developer-guide/inter-mojit/mojits/ReceiverMojit/assets/css/style.css
  63. +2 −0 examples/developer-guide/inter-mojit/mojits/ReceiverMojit/assets/index.css
  64. +30 −45 examples/developer-guide/inter-mojit/mojits/ReceiverMojit/binders/index.js
  65. +5 −0 examples/developer-guide/inter-mojit/mojits/ReceiverMojit/definition.json
  66. +37 −0 examples/developer-guide/inter-mojit/mojits/ReceiverMojit/models/foo.server.js
  67. +39 −0 examples/developer-guide/inter-mojit/mojits/ReceiverMojit/tests/models/foo.server-tests.js
  68. +1 −4 examples/developer-guide/inter-mojit/mojits/ReceiverMojit/views/index.hb.html
  69. +4 −6 examples/developer-guide/inter-mojit/mojits/ReceiverMojit/views/show.hb.html
  70. +21 −5 examples/developer-guide/inter-mojit/server.js
  71. +21 −5 examples/developer-guide/locale_i18n/server.js
  72. +1 −1 examples/developer-guide/model_yql/mojits/flickr/models/model.server.js
  73. +21 −5 examples/developer-guide/model_yql/server.js
  74. +21 −5 examples/developer-guide/multiple_mojits/server.js
  75. +1 −1 examples/developer-guide/scroll_views/application.json
  76. +0 −20 examples/developer-guide/scroll_views/mojits/scroll/binders/binder.js
  77. +34 −0 examples/developer-guide/scroll_views/mojits/scroll/binders/index.js
  78. +0 −3 examples/developer-guide/scroll_views/mojits/scroll/controller.server.js
  79. +0 −22 examples/developer-guide/scroll_views/mojits/scroll/views/index.hb.html
  80. +21 −5 examples/developer-guide/scroll_views/server.js
  81. +21 −5 examples/developer-guide/simple_assets/server.js
  82. +21 −5 examples/developer-guide/simple_config/server.js
  83. +27 −24 examples/developer-guide/simple_logging/application.json
  84. +6 −43 examples/developer-guide/simple_logging/mojits/log/binders/index.js
  85. +9 −53 examples/developer-guide/simple_logging/mojits/log/controller.server.js
  86. +8 −8 examples/developer-guide/simple_logging/mojits/log/views/index.hb.html
  87. +3 −6 examples/developer-guide/simple_logging/package.json
  88. +6 −6 examples/developer-guide/simple_logging/routes.json
  89. +18 −1 examples/developer-guide/simple_logging/server.js
  90. +21 −5 examples/developer-guide/simple_view/server.js
  91. +21 −5 examples/developer-guide/unittest_model_controller/server.js
  92. +21 −5 examples/developer-guide/using_configs/server.js
  93. +21 −5 examples/developer-guide/using_cookies/server.js
  94. +21 −5 examples/developer-guide/using_parameters/server.js
  95. +3 −3 examples/developer-guide/yui_module/README.txt
  96. +3 −1 examples/developer-guide/yui_module/mojits/Notepad/binders/index.js
  97. +1 −1 examples/developer-guide/yui_module/package.json
  98. +21 −5 examples/developer-guide/yui_module/server.js
  99. 0 examples/developer-guide/yui_module/{autoload → yui_modules}/storage-lite.client.js
  100. +0 −40 examples/sandbox/bindercomm/mojits/BlueChild/tests/binders/index.common-tests.js
  101. +0 −41 examples/sandbox/bindercomm/mojits/BlueChild/tests/controller.server-tests.js
  102. +0 −33 examples/sandbox/bindercomm/mojits/BlueChild/tests/models/model.server-tests.js
  103. +0 −40 examples/sandbox/bindercomm/mojits/Parent/tests/binders/index.common-tests.js
  104. +0 −41 examples/sandbox/bindercomm/mojits/Parent/tests/controller.server-tests.js
  105. +0 −33 examples/sandbox/bindercomm/mojits/Parent/tests/models/model.server-tests.js
  106. +0 −40 examples/sandbox/bindercomm/mojits/RedChild/tests/binders/index.common-tests.js
  107. +0 −41 examples/sandbox/bindercomm/mojits/RedChild/tests/controller.server-tests.js
  108. +0 −33 examples/sandbox/bindercomm/mojits/RedChild/tests/models/model.server-tests.js
  109. +0 −39 examples/sandbox/binderrender/mojits/ClickLog/tests/binders/index.common-tests.js
  110. +0 −43 examples/sandbox/bindertime/mojits/Loader/tests/binders/foo.common-tests.js
  111. +0 −40 examples/sandbox/controller-state/mojits/Parent/tests/binders/index.common-tests.js
  112. +0 −41 examples/sandbox/controller-state/mojits/Parent/tests/controller.server-tests.js
  113. +0 −33 examples/sandbox/controller-state/mojits/Parent/tests/models/model.server-tests.js
  114. +0 −40 examples/sandbox/controller-state/mojits/Stateful/tests/binders/index.common-tests.js
  115. +0 −41 examples/sandbox/controller-state/mojits/Stateful/tests/controller.server-tests.js
  116. +0 −33 examples/sandbox/controller-state/mojits/Stateful/tests/models/model.server-tests.js
  117. +0 −40 examples/sandbox/lazy_load/mojits/Container/tests/binders/index.common-tests.js
  118. +0 −41 examples/sandbox/lazy_load/mojits/Container/tests/controller.server-tests.js
  119. +0 −33 examples/sandbox/lazy_load/mojits/Container/tests/models/model.server-tests.js
  120. +0 −40 examples/sandbox/lazy_load/mojits/LazyPants/tests/binders/index.common-tests.js
  121. +0 −41 examples/sandbox/lazy_load/mojits/LazyPants/tests/controller.server-tests.js
  122. +0 −33 examples/sandbox/lazy_load/mojits/LazyPants/tests/models/model.server-tests.js
  123. +0 −40 examples/sandbox/metabubble/mojits/Child/tests/binders/index.common-tests.js
  124. +0 −41 examples/sandbox/metabubble/mojits/Child/tests/controller.server-tests.js
  125. +0 −40 examples/sandbox/metabubble/mojits/Parent/tests/binders/index.common-tests.js
  126. +0 −41 examples/sandbox/metabubble/mojits/Parent/tests/controller.server-tests.js
  127. +0 −41 examples/sandbox/server_side/mojits/Layout/tests/controller-tests.js
  128. +0 −33 examples/sandbox/server_side/mojits/Layout/tests/model-tests.js
  129. +0 −41 examples/sandbox/server_side/mojits/MyServer/tests/controller-tests.js
  130. +0 −33 examples/sandbox/server_side/mojits/MyServer/tests/model-tests.js
  131. +0 −40 examples/sandbox/strangeloop/mojits/Container/tests/binders/index.common-tests.js
  132. +0 −41 examples/sandbox/strangeloop/mojits/Container/tests/controller.server-tests.js
  133. +0 −33 examples/sandbox/strangeloop/mojits/Container/tests/models/model.server-tests.js
  134. +0 −40 examples/sandbox/strangeloop/mojits/Speakers/tests/binders/index.common-tests.js
  135. +0 −41 examples/sandbox/strangeloop/mojits/Speakers/tests/controller.server-tests.js
  136. +0 −33 examples/sandbox/strangeloop/mojits/Speakers/tests/models/model.server-tests.js
  137. +0 −40 examples/sandbox/strangeloop/mojits/TweetView/tests/binders/index.common-tests.js
  138. +0 −41 examples/sandbox/strangeloop/mojits/TweetView/tests/controller.server-tests.js
  139. +0 −33 examples/sandbox/strangeloop/mojits/TweetView/tests/models/model.server-tests.js
  140. +0 −40 examples/sandbox/yuiconf/mojits/Container/tests/binders/index.common-tests.js
  141. +0 −41 examples/sandbox/yuiconf/mojits/Container/tests/controller.server-tests.js
  142. +0 −33 examples/sandbox/yuiconf/mojits/Container/tests/models/model.server-tests.js
  143. +0 −40 examples/sandbox/yuiconf/mojits/TweetView/tests/binders/index.common-tests.js
  144. +0 −41 examples/sandbox/yuiconf/mojits/TweetView/tests/controller.server-tests.js
  145. +0 −33 examples/sandbox/yuiconf/mojits/TweetView/tests/models/model.server-tests.js
  146. +7 −2 lib/app/addons/ac/deploy.server.js
  147. +54 −11 lib/app/addons/rs/config.js
  148. +2 −2 lib/app/addons/rs/selector.js
  149. +1 −1 lib/app/addons/rs/url.js
  150. +24 −12 lib/app/addons/rs/yui.js
  151. +1 −0 lib/app/archetypes/app/default/{application.json → application.json.hb}
  152. +1 −1 lib/app/archetypes/app/full/{application.json → application.json.hb}
  153. +39 −0 lib/app/archetypes/app/hybrid/application.json.hb
  154. BIN lib/app/archetypes/app/hybrid/assets/favicon.ico
  155. +189 −0 lib/app/archetypes/app/hybrid/dimensions.json
  156. +2 −0 lib/app/archetypes/app/hybrid/mojits/top_frame/assets/index.css
  157. +57 −0 lib/app/archetypes/app/hybrid/mojits/top_frame/binders/index.js.hb
  158. +50 −0 lib/app/archetypes/app/hybrid/mojits/top_frame/controller.server.js.hb
  159. +5 −0 lib/app/archetypes/app/hybrid/mojits/top_frame/definition.json
  160. +37 −0 lib/app/archetypes/app/hybrid/mojits/top_frame/models/foo.server.js.hb
  161. +24 −0 lib/app/archetypes/app/hybrid/mojits/top_frame/package.json.hb
  162. +31 −0 lib/app/archetypes/app/hybrid/mojits/top_frame/specs/default.json.hb
  163. +60 −0 lib/app/archetypes/app/hybrid/mojits/top_frame/tests/controller.server-tests.js
  164. +39 −0 lib/app/archetypes/app/hybrid/mojits/top_frame/tests/models/model.server-tests.js
  165. +10 −0 lib/app/archetypes/app/hybrid/mojits/top_frame/views/index.hb.html
  166. +16 −0 lib/app/archetypes/app/hybrid/package.json.hb
  167. +23 −0 lib/app/archetypes/app/hybrid/routes.json.hb
  168. +17 −0 lib/app/archetypes/app/hybrid/server.js
  169. +1 −0 lib/app/archetypes/app/simple/{application.json → application.json.hb}
  170. +13 −0 lib/app/archetypes/app/yahoo/application.json.hb
  171. BIN lib/app/archetypes/app/yahoo/assets/favicon.ico
  172. +191 −0 lib/app/archetypes/app/yahoo/dimensions.json
  173. 0 lib/app/archetypes/app/yahoo/mojits/.placeholder
  174. +21 −0 lib/app/archetypes/app/yahoo/package.json.hb
  175. +4 −0 lib/app/archetypes/app/yahoo/routes.json
  176. +24 −0 lib/app/archetypes/app/yahoo/server.js
  177. +6 −18 lib/app/autoload/dispatch.client.js
  178. +3 −0 lib/app/autoload/mojito-client.client.js
  179. +6 −4 lib/app/autoload/store.server.js
  180. +107 −0 lib/app/autoload/view-renderer.client.js
  181. +2 −4 lib/app/autoload/{view-renderer.common.js → view-renderer.server.js}
  182. +0 −553 lib/app/commands/build.js
  183. +47 −0 lib/app/commands/build/html5app.js
  184. +104 −0 lib/app/commands/build/hybridapp.js
  185. +155 −0 lib/app/commands/build/index.js
  186. +52 −0 lib/app/commands/build/scraper.js
  187. +140 −0 lib/app/commands/build/shared.js
  188. +39 −0 lib/app/commands/build/writer.js
  189. +49 −194 lib/app/commands/compile.js
  190. +118 −140 lib/app/commands/create.js
  191. +1 −1 lib/app/commands/gv.js
  192. +6 −14 lib/app/commands/info.js
  193. +25 −43 lib/app/commands/test.js
  194. +17 −4 lib/app/middleware/mojito-handler-static.js
  195. +12 −1 lib/config.json
  196. +5 −7 lib/management/cli.js
  197. +52 −31 lib/management/utils.js
  198. +13 −12 lib/mojito.js
  199. +11 −8 package.json
  200. +23 −0 tests/cli/lib/lib_test_descriptor.json
  201. +31 −0 tests/cli/lib/management/test-cli.js
  202. +12 −0 tests/config/config.js
  203. +2 −0 tests/fixtures/config/bad.yaml
  204. +3 −0 tests/fixtures/config/ext.json
  205. +3 −0 tests/fixtures/config/json.json
  206. +1 −0 tests/fixtures/config/yaml.yaml
  207. +1 −0 tests/fixtures/config/yml.yml
  208. +103 −97 tests/func/applications/apps.json
  209. +1 −6 tests/func/applications/frameworkapp/usecase/application.json
  210. +4 −4 tests/func/applications/frameworkapp/usecase/mojits/PagedFlickr2/binders/index.js
  211. +4 −4 tests/func/applications/frameworkapp/usecase/mojits/PagedFlickr2/controller.common.js
  212. +23 −0 tests/func/applications/frameworkapp/yaml-config/application.json
  213. +14 −0 tests/func/applications/frameworkapp/yaml-config/application.yaml
  214. +13 −0 tests/func/applications/frameworkapp/yaml-config/mojits/simple/controller.common.js
  215. +9 −0 tests/func/applications/frameworkapp/yaml-config/mojits/simple/defaults.json
  216. +9 −0 tests/func/applications/frameworkapp/yaml-config/mojits/simple/defaults.yaml
  217. +5 −0 tests/func/applications/frameworkapp/yaml-config/mojits/simple/definition.json
  218. +11 −0 tests/func/applications/frameworkapp/yaml-config/mojits/simple/definition.yaml
  219. +8 −0 tests/func/applications/frameworkapp/yaml-config/mojits/simple/specs/default.json
  220. +8 −0 tests/func/applications/frameworkapp/yaml-config/mojits/simple/specs/default.yaml
  221. +3 −0 tests/func/applications/frameworkapp/yaml-config/package.json
  222. +2 −0 tests/func/applications/frameworkapp/yaml-config/package.yaml
  223. +15 −0 tests/func/applications/frameworkapp/yaml-config/routes.json
  224. +22 −0 tests/func/applications/frameworkapp/yaml-config/routes.yml
  225. 0 tests/func/common/commonclienttest_descriptor.json
  226. 0 tests/func/common/commonservertest_descriptor.json
  227. 0 tests/func/common/html5apptest_descriptor.json
  228. +2 −2 tests/func/common/testconfiginappfilecompclient.js
  229. +1 −1 tests/func/common/testconfiginappfilecompserver.js
  230. 0 tests/func/config/configtest_descriptor.json
  231. 0 tests/func/examples/developerguide/developerguide_descriptor.json
  232. +1 −1 tests/func/examples/developerguide/test_innermojit.js
  233. +4 −2 tests/func/examples/developerguide/test_simple_logging.js
  234. +4 −6 tests/func/examples/developerguide/test_yuimodule.js
  235. 0 tests/func/examples/input/input_descriptor.json
  236. 0 tests/func/examples/newsboxes/newsboxes_descriptor.json
  237. 0 tests/func/examples/simple/simple_descriptor.json
  238. 0 tests/func/routing/routingtest_descriptor.json
  239. +1 −2 tests/func/usecases/testpagedflickr-de-page2.js
  240. +1 −1 tests/func/usecases/testpagedflickr-de.js
  241. 0 tests/func/usecases/usecasestest_descriptor.json
  242. +21 −0 tests/func/yaml-config/testyamlconfig1.js
  243. +21 −0 tests/func/yaml-config/testyamlconfig2.js
  244. +36 −0 tests/func/yaml-config/yamlconfigtest_descrip-DISABLED-tor.json
  245. +0 −28 tests/harness/lib/yuitest/LICENSE
  246. +0 −1 tests/harness/lib/yuitest/README
  247. +0 −33 tests/harness/lib/yuitest/java/README
  248. +0 −39 tests/harness/lib/yuitest/java/ant.properties
  249. +0 −243 tests/harness/lib/yuitest/java/build.xml
  250. BIN tests/harness/lib/yuitest/java/build/yuitest-coverage-report.jar
  251. BIN tests/harness/lib/yuitest/java/build/yuitest-coverage.jar
  252. BIN tests/harness/lib/yuitest/java/build/yuitest-selenium-driver.jar
  253. BIN tests/harness/lib/yuitest/java/lib/antlr-2.7.7.jar
  254. BIN tests/harness/lib/yuitest/java/lib/antlr-3.2.jar
  255. BIN tests/harness/lib/yuitest/java/lib/antlr-runtime-3.2.jar
  256. BIN tests/harness/lib/yuitest/java/lib/jargs-1.0.jar
  257. BIN tests/harness/lib/yuitest/java/lib/junit-4.1.jar
  258. BIN tests/harness/lib/yuitest/java/lib/selenium-java-client-driver.jar
  259. BIN tests/harness/lib/yuitest/java/lib/stringtemplate-3.2.1.jar
  260. +0 −114 tests/harness/lib/yuitest/java/src/com/yahoo/platform/yuitest/config/TestConfig.java
  261. +0 −114 tests/harness/lib/yuitest/java/src/com/yahoo/platform/yuitest/config/TestPage.java
  262. +0 −119 tests/harness/lib/yuitest/java/src/com/yahoo/platform/yuitest/config/TestPageGroup.java
  263. +0 −108 tests/harness/lib/yuitest/java/src/com/yahoo/platform/yuitest/coverage/DirectoryInstrumenter.java
  264. +0 −274 tests/harness/lib/yuitest/java/src/com/yahoo/platform/yuitest/coverage/ES3YUITest.tokens
  265. +0 −53 tests/harness/lib/yuitest/java/src/com/yahoo/platform/yuitest/coverage/ES3YUITestTemplates.stg
  266. +0 −114 tests/harness/lib/yuitest/java/src/com/yahoo/platform/yuitest/coverage/FileInstrumenter.java
  267. +0 −123 tests/harness/lib/yuitest/java/src/com/yahoo/platform/yuitest/coverage/JavaScriptInstrumenter.java
  268. +0 −152 tests/harness/lib/yuitest/java/src/com/yahoo/platform/yuitest/coverage/YUITestCoverage.java
  269. +0 −1,536 tests/harness/lib/yuitest/java/src/com/yahoo/platform/yuitest/coverage/grammar/ES3.g
  270. +0 −1,612 tests/harness/lib/yuitest/java/src/com/yahoo/platform/yuitest/coverage/grammar/ES3Instrument.g
  271. +0 −55 ...arness/lib/yuitest/java/src/com/yahoo/platform/yuitest/coverage/grammar/ES3Instrument_license.txt
  272. +0 −1,751 tests/harness/lib/yuitest/java/src/com/yahoo/platform/yuitest/coverage/grammar/ES3YUITest.g
  273. +0 −30 tests/harness/lib/yuitest/java/src/com/yahoo/platform/yuitest/coverage/grammar/ES3_license.txt
  274. +0 −22 ...ness/lib/yuitest/java/src/com/yahoo/platform/yuitest/coverage/report/CoverageReportGenerator.java
  275. +0 −28 ...b/yuitest/java/src/com/yahoo/platform/yuitest/coverage/report/CoverageReportGeneratorFactory.java
  276. +0 −112 .../harness/lib/yuitest/java/src/com/yahoo/platform/yuitest/coverage/report/GCOVReportGenerator.java
  277. +0 −120 .../harness/lib/yuitest/java/src/com/yahoo/platform/yuitest/coverage/report/HTMLReportGenerator.java
  278. +0 −209 .../harness/lib/yuitest/java/src/com/yahoo/platform/yuitest/coverage/report/LCOVReportGenerator.java
  279. +0 −141 ...arness/lib/yuitest/java/src/com/yahoo/platform/yuitest/coverage/report/YUITestCoverageReport.java
  280. +0 −150 ...ess/lib/yuitest/java/src/com/yahoo/platform/yuitest/coverage/results/DirectoryCoverageReport.java
  281. +0 −322 .../harness/lib/yuitest/java/src/com/yahoo/platform/yuitest/coverage/results/FileCoverageReport.java
  282. +0 −47 tests/harness/lib/yuitest/java/src/com/yahoo/platform/yuitest/coverage/results/FileFunction.java
  283. +0 −23 ...ness/lib/yuitest/java/src/com/yahoo/platform/yuitest/coverage/results/FileFunctionComparator.java
  284. +0 −51 tests/harness/lib/yuitest/java/src/com/yahoo/platform/yuitest/coverage/results/FileLine.java
Sorry, we could not display the entire diff because too many files (360) changed.
View
1 .gitignore
@@ -8,6 +8,7 @@ node_modules
!tests/fixtures/packages/node_modules/*/node_modules
arrowreport
artifacts
+coverage
flatfile
*_descriptor-report.json
*_descriptor-report.xml
View
1 .npmignore
@@ -5,7 +5,6 @@
*.bak
*~
/tests
-!/tests/harness/lib/yuitest/java/build
arrowreport
artifacts
examples
View
225 DEPRECATIONS.md
@@ -9,15 +9,8 @@ future.
-Currently Deprecated
-====================
-
-
-### Deprecated but Available
-
-* (2012-08-14) Controllers that declare themselves using `Y.mojito.controller = {...}`
-should be changed to use `Y.namespace('mojito.controllers')[NAME] = {...}`. The previously
-used pattern will clobber the controllers if you are using `shareYUIInstance: true`.
+Deprecated but Available
+========================
* (2012-08-13) Files ending in `.mu.html` will eventually not be rendered
out-of-the-box by Mojito. All downstream projects should use the Handlebars
@@ -27,61 +20,209 @@ by default. To rename all views in your project, run the following in your proje
root folder:
`find . -name "*.mu.html" -exec sh -c 'mv "$1" "$(echo "$1" | sed s/mu.html\$/hb.html/)"' _ {} \;`
-* (2012-04-23) The `.guid` member of Mojito metadata (such as binder metadata)
-is going away. Often there's an associated member which more specifically
-expresses the intent of the unique ID (for example `.viewId` or `.instanceId`).
-* (2012-04-23) `ac.dispatch()` will be going away. (This already emits a
-warning.) Currently the best alternative is `ac._dispatch()`.
+Deprecated with Warnings
+========================
+
+* (2012-12-05) the `mojito compile` command will be removed in future releases, in favor of [Shaker](/yahoo/mojito-shaker).
+* (2012-04-23) `ac.dispatch()` will be going away.
+Currently the best alternative is `ac._dispatch()`.
+
+
+Removed
+=======
+
+### (0.5.0) Mojito `compile` command line tool no longer needs a `rollup` command
+
+Javascript file concatenation/combo'ing of mojito files is now built-in.
+
+### (0.5.0) Mojito No Longer Adds Common ActionContext Addons
+
+In the past, a subset of the addons provided by Mojito framework were attached on every `ActionContext` object (which are created per request, per mojit instance in the page).
+The specific list was `['mojito-config-addon', 'mojito-url-addon', 'mojito-assets-addon', 'mojito-cookie-addon', 'mojito-params-addon', 'mojito-composite-addon']`.
+This resulted in overhead for every mojit in the page.
+As part of 0.5.0, all requirements have to be specified in the controller definition. e.g:
+
+ YUI.add('Foo', function(Y, NAME) {
+
+ Y.namespace('mojito.controllers')[NAME] = {
+
+ index: function(ac) {
+ // ac.params.* is now available
+ }
+
+ };
+
+ }, '0.0.1', {requires: ['mojito', 'mojito-params-addon']});
+
+As of 0.5.0, no addon is attached unless it is required. The only public members of `ActionContent` object are `ac.done`, `ac.error`, and `ac.flush`.
+
+Recommendations to upgrade:
+
+* check every controller in your app, and check if it is using `ac.*`, and add the corresponding requirements.
+* the most common addons are: config, params, url, assets.
+
+
+
+### (0.5.0) Access to Models via a Property
+
+Models are no longer computed and attached to `ActionContext` by default.
+In other words, `ac.models.foo` is no longer a valid way to access a model.
+Computing and attaching models automatically, even when they were not really needed, added overhead during the page rendering process.
+Instead, we want Mojito to be more strict in defining and exposing structures automatically.
+
+In 0.5.0, if you need to use a model in a controller (defined at the mojit level, or at the application level), you need to:
+
+* require a new addon called `mojito-models-addon` in your controller.
+* require the module in your controller.
+* use `ac.models.get('foo')` to get a reference of the model.
+
+Here is an example:
+
+ YUI.add('DemoModelFoo', function(Y, NAME) {
+ Y.namespace('mojito.models')[NAME] = {
+ init: function(config) {
+ this.config = config;
+ },
+ getData: function(callback) {}
+ };
+ }, '0.0.1', {requires: []});
+
+ YUI.add('Foo', function(Y, NAME) {
+ Y.namespace('mojito.controllers')[NAME] = {
+ index: function(ac) {
+ ac.models.get('DemoModelFoo').getData(function (data) {
+ // data from model available here
+ });
+ }
+ };
+
+ }, '0.0.1', {requires: ['mojito', 'mojito-models-addon', 'DemoModelFoo']});
+
+> Note: the model name doesn't have to match the yui module name for the model anymore.
+
+
+
+### (0.5.0) `init` Method in Controllers
+
+The `init` method on the controller is now deprecated and should be removed.
+In many cases, the `init` method was just storing a reference of the `config` parameter to use it later on.
+This is no longer available, and the `init` method will not be executed.
+
+If you need to access the mojit `config` in an actions, you should:
+
+* require `mojito-config-addon` in the controller.
+* use `ac.config.get()` to get the `config`
+
+> Note: do not try to store a reference of that config, as it is not safe, More details below.
+
+
+
+### (0.5.0) `ac.app.*`
+
+For performance reasons, to avoid computing app config per mojit instance, per request, when the majority of the time it is not needed, we completed the transition to `mojito-config-addon` add-on.
+This change affects `ac.app.*`, specifically `ac.app.config` which was commonly used to access the computed `application.json` configuration per `context`.
+If you need to access the application `config` in an action or another add-on, you should:
+
+* require `mojito-config-addon` in the controller.
+* use `ac.config.getAppConfig()` to get the former `ac.app.config`
+
+
+
+### (0.5.0) Controllers Can No Longer Run Forever
+
+Mojito now imposes a timeout on the dispatch of the action in the controllers.
+Starting with 0.5.0 there is a "reaper" which imposes a timeout.
+Actions must call `ac.done()` or `ac.error()` before the timer expires or the system will log a warning and invoke `ac.error()` with a timeout error.
+
+This can be configured by the `actionTimeout` setting in `application.json`.
+It contains the maximum number of milliseconds that a controller action is allowed to run before the action is timed out.
+The default value is `60000` (60 seconds).
+
+
+
+### (0.5.0) Mojit and AC Addon Naming Conventions
+
+Mojito is more restrictive in how you names mojits and add-ons. There are 4 new rules:
+
+* `addon` namespace should match the filename. E.g. `ac.foo` corresponds to `addons/ac/foo.common.js`.
+* The name of the mojit, which is the name of the folder, should match the language bundle, including the filename of the bundle and its definition. E.g. `Foo` mojit can have `lang/Foo_da-DK.js`, and the content should be `YUI.add('lang/Foo_da-DK', function (Y) { Y.Intl.add('Foo', 'da-DK', {}); });`
+* Controller YUI module name should be same as directory.
+* YUI modules need to have unique names, regardless of selector.
+
+
+
+### (0.5.0) `log` Config in `application.json`
+
+In previous versions, the console log was separated for client and server, and between Mojito and YUI.
+We decided to leverage the YUI Logger, and unify this setting under a single configuration, actually the YUI configuration in `application.json`:
+ "log": {
+ "client": {
+ "level": "error",
+ "yui": false
+ },
+ "server": {
+ "level": "error",
+ "yui": false
+ }
+ }
-### Deprecated with Warnings
-nothing for mojito 0.3
+is now:
+ "yui": {
+ "config": {
+ "debug": true,
+ "logLevel": "error"
+ }
+ }
-### Removed
-nothing for mojito 0.3
+and we recommend this setting for production:
+ "yui": {
+ "config": {
+ "debug": false,
+ "logLevel": "none"
+ }
+ }
+To customize this for client or server, you can use the runtime context.
+Also, you can now use `logExclude` and `logInclude`.
+More information at http://yuilibrary.com/yui/docs/api/classes/config.html.
-Deprecation Process
-===================
-A feature will move through the following phases, at a well-defined pace.
-### "Deprecated but Available" Phase
+### (0.5.0) Other Settings in `application.json`
-* The documentation is updated to mark the feature as "deprecated".
-* The feature will be in this phase until the end of the quarter year.
-(It's possible that a feature won't spend much time in this phase, if it is
-deprecated near the end of the quarter.)
+The following are gone:
+* `embedJsFilesInHtmlFrame`
+* `shareYUIInstance`
+* in the `yui` section:
+ * `base`
+ * `dependencyCalculations`
+ * `extraModules`
+ * `loader`
+ * `url`
+ * `urlContains`
-### "Deprecated with Warning" Phase
-* The feature is removed from the documentation.
-* Mojito emits a warning (if possible) if the feature is used.
-* The feature will spend a full quarter in this phase.
+### (0.5.0) `mojito test` No Longer Tests the Framework
-### "Removed" Phase
+In the past, `mojito test` without any other parameter was running all unit tests for mojito framework, and this is no longer the case.
+We moved all the tests to `arrow`, more details here: https://github.com/yahoo/mojito/tree/develop/tests
-* The feature (and warning) is removed from Mojito.
+You can continue using `mojito test app path/to/app` and `mojito test mojit path/to/mojit`, and the behavior is still the same.
+> Note: this change is only relevant for contributors.
-### Example
-* On 2012-04-19 (Q2), Mojito deprecates the "foo" feature by saying so in the
-documentation. This event is also mentioned in an email and/or blog post for
-the next release. It's also added to this DEPRECATIONS.md document.
-* On the next release after 2012-06-30 (end of Q2), Mojito removes
-documentation for feature "foo" and adds a warning if someone tries to use
-feature "foo". It is still documented in this DEPRECATIONS.md document.
+### (0.5.0) `.guid`
+The `.guid` member of Mojito metadata (such as binder metadata) is now gone.
+Often there's an associated member which more specifically expresses the intent of the unique ID (for example `.viewId` or `.instanceId`).
-* On the next releaes after 2012-09-30 (end of Q3), Mojito removes feature
-"foo" (and the associated warnings). It is mentioned as "removed" in this
-DEPRECATIONS.md document.
View
17 bin/mojito
@@ -4,14 +4,9 @@
* Copyrights licensed under the New BSD License.
* See the accompanying LICENSE file for terms.
*/
-var libpath, libmojito;
-try {
- // this is the normal location
- libmojito = require('mojito');
-}
-catch (e) {
- libpath = require('path'),
- // need to do this if mojito is installed via `npm link`
- libmojito = require(libpath.join(__dirname, '..', 'lib/mojito'));
-}
-libmojito.include('management/cli');
+var cli,
+ resolve = require('path').resolve,
+ mojito = require(resolve(__dirname, '../lib/mojito'));
+
+cli = mojito.include('management/cli');
+cli.run();
View
15 docs/dev_guide/api_overview/index.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::
View
17 docs/dev_guide/api_overview/mojito_addons.rst
@@ -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:
@@ -47,8 +49,8 @@ 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.
+the ``Params`` addon is required by adding the string ``'mojito-params-addon'``
+to the ``requires`` array.
.. code-block:: javascript
@@ -89,7 +91,8 @@ Addon Examples
The following code examples use the addons in parentheses:
-- `Dynamically Adding CSS to Different Devices <../code_exs/dynamic_assets.html>`_ (``Assets``)
+- `Dynamically Adding CSS to Different Devices <../code_exs/dynamic_assets.html>`_
+ (``Assets``)
- `Using Cookies <../code_exs/cookies.html>`_ (``Cookie``)
- `Using Query Parameters <../code_exs/query_params.html>`_ (``Params``)
- `Generating URLs <../code_exs/generating_urls.html>`_ (``Url``)
@@ -102,8 +105,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
+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
19 docs/dev_guide/api_overview/mojito_client_obj.rst
@@ -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()``
View
13 docs/dev_guide/api_overview/mojito_rest_lib.rst
@@ -2,16 +2,17 @@
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:
Including Library
=================
-To use the REST library, include the string 'mojito-rest-lib' in the ``requires`` array,
+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..
@@ -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
View
12 docs/dev_guide/code_exs/adding_assets.rst
@@ -183,17 +183,7 @@ To create and run ``simple_assets``:
.. code-block:: javascript
YUI.add('simple', function(Y, NAME) {
- /**
- * The simple module.
- *
- * @module simple
- */
- /**
- * Constructor for the Controller class.
- *
- * @class Controller
- * @constructor
- */
+
Y.namespace('mojito.controllers')[NAME] = {
/**
View
2 docs/dev_guide/code_exs/app_config.rst
@@ -37,7 +37,7 @@ The example ``application.json`` below specifies that the application use the mo
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.
+method in the controller when HTTP GET called on the root path.
.. code-block:: javascript
View
66 docs/dev_guide/code_exs/binding_events.rst
@@ -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
@@ -500,9 +499,9 @@ calculate the index of the first photo to display:
To get the photo data, the controller depends on the model to call YQL to query the
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.
+``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.
.. code-block:: javascript
@@ -533,7 +532,14 @@ to require the model in the ``requires`` array of the controller.
}
...
};
- }, '0.0.1', {requires: ['dump', 'mojito-url-addon', 'mojito-params-addon', 'PagerMojitModel']});
+ }, '0.0.1', {requires: [
+ 'mojito',
+ 'mojito-models-addon',
+ 'mojito-url-addon',
+ 'mojito-params-addon',
+ 'PagerMojitModel',
+ 'dump'
+ ]});
The URLs for the **prev** and **next** links are created by passing the mojit instance,
@@ -546,7 +552,7 @@ If the query string created by ``Y.QueryString.stringify`` is "page=2" ,
.. code-block:: javascript
...
- function createLink(actionContext, params) {
+ function createLink(actionContext, params) {
var mergedParams = Y.mojito.util.copy(actionContext.params.getFromMerged());
for (var k in params) {
mergedParams[k] = params[k];
@@ -616,7 +622,14 @@ create URLs for the **next** and **prev** links.
}
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: [
+ 'mojito',
+ 'mojito-models-addon',
+ 'mojito-url-addon',
+ 'mojito-params-addon',
+ 'PagerMojitModel',
+ 'dump'
+ ]});
.. _code_exs_events-setup:
@@ -733,11 +746,18 @@ 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']});
-
-
-#. 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
+ }, '0.0.1', {requires: [
+ 'mojito',
+ 'mojito-models-addon',
+ 'mojito-url-addon',
+ 'mojito-params-addon',
+ 'PagerMojitModel',
+ 'dump'
+ ]});
+
+
+#. 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
View
7 docs/dev_guide/code_exs/calling_yql.rst
@@ -171,7 +171,8 @@ Calling the Model from the Controller
The controller in this code example performs the following functions:
-- gets the query string parameters using the `Params addon <../../api/classes/Params.common.html>`_
+- gets the query string parameters using the
+ `Params addon <../../api/classes/Params.common.html>`_
- passes the query string parameters to the ``search`` function of the model
- receives the ``photos`` array from the ``search`` function and sends an object to the
template
@@ -257,8 +258,8 @@ To set up and run ``model_yql``:
}
]
-#. To configure the routing to call the ``index`` method an instance of ``HTMLFrameMojit``,
- replace the code in ``routes.json`` with the following:
+#. To configure the routing to call the ``index`` method an instance of
+ ``HTMLFrameMojit``, replace the code in ``routes.json`` with the following:
.. code-block:: javascript
View
8 docs/dev_guide/code_exs/cookies.rst
@@ -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
View
3 docs/dev_guide/code_exs/framed_assets.rst
@@ -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
View
7 docs/dev_guide/code_exs/global_assets.rst
@@ -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:
View
2 docs/dev_guide/code_exs/htmlframe_view.rst
@@ -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>`_.
View
2 docs/dev_guide/code_exs/intermojit_communication.rst
@@ -598,7 +598,7 @@ To set up and run ``inter-mojit``:
.. code-block:: html
<div id="{{mojit_view_id}}" class="ReceiverMojit">
- <h3></h3>
+ <h3>{{title}}</h3>
<div id="view">
<img src="{{url}}" width="200px" alt="Missing Image"/>
</div>
View
4 docs/dev_guide/code_exs/multiple_mojits.rst
@@ -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:
View
21 docs/dev_guide/code_exs/query_params.rst
@@ -194,6 +194,25 @@ a key to ``params.getFromMerged(key)``. For example,
...
}, '0.0.1', {requires: ['dump', 'mojito-params-addon']});
+The methods of the ``Params`` addon have the following aliases for simplification:
+
++---------------------+--------------+
+| Method | Alias |
++=====================+==============+
+| ``getAll()`` | ``all()`` |
++---------------------+--------------+
+| ``getFromBody()`` | ``body()`` |
++---------------------+--------------+
+| ``getFromFiles()`` | ``files()`` |
++---------------------+--------------+
+| ``getFromMerged()`` | ``merged()`` |
++---------------------+--------------+
+| ``getfromRoute()`` | ``route()`` |
++---------------------+--------------+
+| ``getFromUrl()`` | ``url()`` |
++---------------------+--------------+
+
+
For more information, see the `Params addon <../../api/classes/Params.common.html>`_ in
the Mojito API documentation.
@@ -267,7 +286,7 @@ To set up and run ``using_parameters``:
#. Change to ``mojits/QueryMojit``.
#. Modify the controller to access different query parameters by replacing the code in
- ``controller.server.js`` with the following:
+ ``controller.server.js`` with the following:
.. code-block:: javascript
View
165 docs/dev_guide/code_exs/scroll_views.rst
@@ -13,7 +13,7 @@ Summary
This example shows how to include the
`YUI ScrollView Module <http://developer.yahoo.com/yui/3/scrollview/>`_
-in your mojit's template.
+in your view.
The following topics will be covered:
@@ -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
@@ -58,6 +58,10 @@ CSS are specified in the ``assets`` array as seen below.
}
}
}
+ },
+ {
+ "settings": [ "device:iphone" ],
+ "selector": "iphone"
}
]
@@ -68,10 +72,9 @@ photo URLs and the text for the image ``alt`` attribute is passed to the
.. code-block:: javascript
- YUI.add('scroll', function(Y, NAME) {
- Y.namespace('mojito.controllers')[NAME] = {
-
- index: function(ac) {
+ YUI.add('scroll', function (Y, NAME) {
+ Y.namespace('mojito.controllers')[NAME] = {
+ index: function (ac) {
// Populate Template
ac.done({
title: 'Scroll View',
@@ -80,7 +83,7 @@ photo URLs and the text for the image ``alt`` attribute is passed to the
url: 'http://farm5.static.flickr.com/4136/4802088086_c621e0b501.jpg',
alt: 'Above The City II'
},
- {
+ {
url: 'http://farm5.static.flickr.com/4114/4801461321_1373a0ef89.jpg',
alt: 'Walls and Canyon'
},
@@ -96,28 +99,51 @@ photo URLs and the text for the image ``alt`` attribute is passed to the
});
}
};
- }, '0.0.1', {requires: ['mojito']});
+ }, '0.0.1', {requires: []});
+
+
+In the binder ``index.js`` below, the YUI ScrollView module is required
+by adding the string ``scrollview`` to the ``required`` array. To create the scrolling
+content widget, you need to instantiate a ScrollView object by passing an object
+containing parameters for the container (``srcNode``), an ID, dimensions, and
+scroll behavior (``flick``) and then use the method ``render`` to attach the scroll
+view to the HTML DOM.
+
+.. code-block:: javascript
-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
-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.
+ YUI.add('scrollBinderIndex', function (Y, NAME) {
+
+ Y.namespace('mojito.binders')[NAME] = {
+ init: function (mojitProxy) {
+ this.mojitProxy = mojitProxy;
+ },
+ bind: function (node) {
+ var scrollView = new Y.ScrollView({
+ id: 'scrollview',
+ srcNode: node.one('#scrollview-content'),
+ width: 320,
+ flick: {
+ minDistance:10,
+ minVelocity:0.3,
+ axis: "x"
+ }
+ });
+ scrollView.render();
+
+ // Prevent default image drag behavior
+ scrollView.get("contentBox").delegate("mousedown", function(e) {
+ e.preventDefault();
+ }, "img");
+ }
+ };
+ }, '0.0.1', {requires: ['scrollview']});
+
+The container (value for ``srcNode``) for the scroll view must be an existing HTML
+node, so the template ``index.hb.html`` must have a ``div`` element with the
+``id`` attribute of ``scrollview-content`` as shown below.
.. code-block:: html
- <style>
- /* Avoid resource latency for these, since they
- hide unenhanced content
- */
- .yui3-js-enabled .yui3-scrollview-loading {
- visibility:hidden;
- }
- #additional-content {
- display:none;
- }
- </style>
<div id="{{mojit_view_id}}" class="mojit">
<div id="scrollview-container">
<div id="scrollview-header">
@@ -132,24 +158,9 @@ on the YUI 3: ScrollView page.
</div>
</div>
</div>
- <script type="text/javascript" charset="utf-8">
- YUI().use('scrollview', function(Y, NAME) {
- var scrollView = new Y.ScrollView({
- id: 'scrollview',
- srcNode: '#scrollview-content',
- width: 320,
- flick: {
- minDistance:10,
- minVelocity:0.3,
- axis: "x"
- }
- });
- scrollView.render();
- // Prevent default image drag behavior
- scrollView.get("contentBox").delegate("mousedown", function(e) {
- e.preventDefault();
- }, "img");});
- </script>
+
+For detailed instructions about YUI ScrollView, see
+`ScrollView: Getting Started <http://developer.yahoo.com/yui/3/scrollview/#start>`_.
.. _code_exs_yui_views-setup:
@@ -179,7 +190,7 @@ To set up and run ``scroll_views``:
"config": {
"deploy": true,
"child" : {
- "type" : "scroll"
+ "type" : "scroll"
},
"assets": {
"top": {
@@ -191,6 +202,10 @@ To set up and run ``scroll_views``:
}
}
}
+ },
+ {
+ "settings": [ "device:iphone" ],
+ "selector": "iphone"
}
]
@@ -217,10 +232,10 @@ To set up and run ``scroll_views``:
.. code-block:: javascript
- YUI.add('scroll', function(Y, NAME) {
- Y.namespace('mojito.controllers')[NAME] = {
+ YUI.add('scroll', function (Y, NAME) {
- index: function(ac) {
+ Y.namespace('mojito.controllers')[NAME] = {
+ index: function (ac) {
// Populate Template
ac.done({
title: 'Scroll View',
@@ -247,15 +262,45 @@ To set up and run ``scroll_views``:
};
}, '0.0.1', {requires: []});
+#. To instantiate a ScrollView and have it rendered in the DOM, replace the
+ code in ``binders/index.js`` with the following:
+
+ .. code-block:: javascript
+
+ YUI.add('scrollBinderIndex', function (Y, NAME) {
+
+ Y.namespace('mojito.binders')[NAME] = {
+ init: function (mojitProxy) {
+ this.mojitProxy = mojitProxy;
+ },
+ bind: function (node) {
+ var scrollView = new Y.ScrollView({
+ id: 'scrollview',
+ srcNode: node.one('#scrollview-content'),
+ width: 320,
+ flick: {
+ minDistance:10,
+ minVelocity:0.3,
+ axis: "x"
+ }
+ });
+ scrollView.render();
+
+ // Prevent default image drag behavior
+ scrollView.get("contentBox").delegate("mousedown", function(e) {
+ e.preventDefault();
+ }, "img");
+ }
+ };
+ }, '0.0.1', {requires: ['scrollview']});
+
#. To modify the ``index`` template, replace the code in ``views/index.hb.html`` with the
following:
.. code-block:: html
<style>
- /* Avoid resource latency for these, since they
- hide unenhanced content
- */
+ /* Avoid resource latency for these, since they hide unenhanced content */
.yui3-js-enabled .yui3-scrollview-loading {
visibility:hidden;
}
@@ -271,30 +316,12 @@ To set up and run ``scroll_views``:
<div id="scrollview-content" class="yui3-scrollview-loading">
<ul>
{{#photos}}
- <li><img src="{{url}}" alt="{{alt}}"></li>
+ <li><img src="{{url}}" alt="{{alt}}"></li>
{{/photos}}
</ul>
</div>
</div>
</div>
- <script type="text/javascript" charset="utf-8">
- YUI().use('scrollview', function(Y, NAME) {
- var scrollView = new Y.ScrollView({
- id: 'scrollview',
- srcNode: '#scrollview-content',
- width: 320,
- flick: {
- minDistance:10,
- minVelocity:0.3,
- axis: "x"
- }
- });
- scrollView.render();
- // Prevent default image drag behavior
- scrollView.get("contentBox").delegate("mousedown", function(e) {
- e.preventDefault();
- }, "img");});
- </script>
#. To add CSS for the ``index`` template, replace the contents of ``assets/index.css``
with the following:
View
221 docs/dev_guide/code_exs/simple_logging.rst
@@ -12,13 +12,15 @@ Summary
=======
This example shows how to configure the log levels for the client and the
-server in Mojito.
+server in Mojito. Also, see `Logging <../topics/mojito_logging.html>`_
+for more information such as including and excluding log messages from
+specified modules.
The following topics will be covered:
- configuring the logging levels
-- displaying client-side and server-side logging
-- using ``Y.log`` to set log levels
+- configuring client-side and server-side logging
+- using ``Y.log`` to set log levels, specify reporting modules
.. _code_exs_logging-notes:
@@ -30,67 +32,112 @@ Implementation Notes
Log Configuration
-----------------
-Logging is configured in the ``application.json`` file with the ``log``
-object. The ``log`` object can contain a ``client`` object and/or a
-``server`` object to configure logging for the client and server respectively.
-In the example ``log`` object below, you can see that you can configure the
-levels and some elements of the output for logs. See
-`Log Defaults <../topics/mojito_logging.html#log-defaults>`_ for the list of configuration
-properties and their default values.
+Logging is configured in the ``application.json`` file with the ``yui.config``
+object. With the ``yui.config`` object, you can configure the log levels and some
+elements of the output for logs. See the
+`config object <intro/mojito_configuring.html#yui_config>`_ for the
+configurations that can be set.
-.. code-block:: javascript
-
- "log":{
- "client":{
- "level":"debug",
- "yui":true,
- "timestamp": false
- },
- "server":{
- "level":"debug",
- "yui":true,
- "timestamp": true
- }
- }
.. _logging_notes-levels:
Log Levels
----------
-Mojito has the following five log levels that you configure in
-``application.json`` or set with ``Y.log``.
+Mojito offers the log levels below that you configure in
+``application.json`` or set with ``Y.log``. The default
+log level is ``debug``.
+
+- ``debug``
+- ``info``
+- ``warn``
+- ``error``
+- ``mojito``
+- ``none``
+
+Setting a log level of ``warn`` will filter out all ``debug`` and ``info``
+messages, while ``warn``, ``error``, and ``mojito`` log messages will be
+processed. To see all log messages, set the log level to ``debug``. The
+``mojito`` log level is for showing Mojito framework-level logging that
+indicate important framework events are occurring.
+
+
+.. _logging_notes-levels:
+
+Example Log Configuration
+-------------------------
+
+In the example, you can see that you use the ``yui.config``
+object to configure the log level.
+
+.. code-block:: javascript
+
+ "yui": {
+ "config": {
+ "debug": true,
+ "logLevel": "info"
+ }
+ }
+
+To configure log levels, the property ``debug`` must be set to ``true``, which
+is the default value. For example, if ``yui.config`` contained ``debug: false``,
+then the ``logLevel`` property would be ignored.
+
+.. _logging_notes-client_server:
-- ``DEBUG``
-- ``INFO``
-- ``WARN``
-- ``ERROR``
-- ``MOJITO``
+Configuring Client and Server Logging
+-------------------------------------
+
+You can use context configurations to set different logging configurations
+for the client and server. More specifically, you use the
+the ``master`` and ``runtime:client`` contexts, each with their
+own ``yui.config`` object as shown below:
+
+.. code-block:: javascript
+
+ [
+ {
+ "settings": [ "master" ],
+ "yui": {
+ "config": {
+ "logLevel": "debug"
+ }
+ }
+ },
+ {
+ "settings": [ "runtime:client" ],
+ "yui": {
+ "config": {
+ "logLevel": "info"
+ }
+ }
+ }
+ ]
-Setting a log level of ``WARN`` will filter out all ``DEBUG`` and ``INFO``
-messages, while ``WARN``, ``ERROR``, and ``MOJITO`` log messages will be processed.
-To see all log messages, set the log level to ``DEBUG``. The ``MOJITO`` log level
-is for showing Mojito framework-level logging that indicate important framework
-events are occurring.
.. _logging_notes-set_levels:
-Setting Log Level with Y.log
-----------------------------
+Using Y.log
+-----------
-The function ``Y.log`` takes two parameters. The first parameter is the log
-message, and the second parameter is used to indicate the log level. When the
-second parameter is omitted, the log message will be reported at the default
-or configured log level.
+The function ``Y.log`` allows you to not only log messages,
+but to also set the log level, specify the reporting module,
+and suppress a logging event. See the YUI API documentation for
+`log <http://yuilibrary.com/yui/docs/api/classes/YUI.html#method_log>`_ for
+more information.
-For example, the first use of ``Y.log`` below will report the message at the
-log level that is configured in ``application.json`` or use the default. The
-second use of ``Y.log`` will use the log level ``INFO``.
+In Mojito applications, we recommend that you specify the log level and
+the reporting module. For example, the first use of ``Y.log``
+below will report the message at the log level that is configured in
+``application.json`` or use the default (``debug``) if
+no log level is set with ``logLevel``. The second use of ``Y.log`` will
+use the log level ``info``. Both statements specify the reporting module
+``logBinderIndex``.
.. code-block:: javascript
- Y.log("This message will be reported at the log level set in application.json or the default level.");
- Y.log("This log message will be reported at the INFO log level.", "info");
+ Y.log("This message will be reported at the log level set in application.json or the default level.", null, "logBinderIndex");
+ Y.log("This log message will be reported at the INFO log level.", "info", "logBinderIndex");
.. _code_exs_logging-setup:
@@ -125,16 +172,19 @@ To set up and run ``simple_logging``:
}
}
},
- "log":{
- "client":{
- "level":"debug",
- "yui":true,
- "timestamp": false
- },
- "server":{
- "level":"debug",
- "yui":true,
- "timestamp": true
+ "yui": {
+ "config": {
+ "debug": true,
+ "logLevel": "debug"
+ }
+ }
+ },
+ {
+ "settings": [ "runtime:client" ],
+ "yui": {
+ "config": {
+ "debug": true,
+ "logLevel": "info"
}
}
}
@@ -164,38 +214,16 @@ To set up and run ``simple_logging``:
YUI.add('log', function(Y, NAME) {
Y.namespace('mojito.controllers')[NAME] = {
-
index: function(ac) {
- Y.log('[CONTROLLER]: entering into controller index (...)',"info");
- var today = new Date(),
- data = {
- type : 'simple',
- time : {
- hours: today.getHours()%12,
- minutes: today.getMinutes()<10 ? "0" + today.getMinutes() : today.getMinutes(),
- period: today.getHours()>=12 ? "p.m." : "a.m."
- },
- show : true,
- hide : false,
- list : [
- {
- id: 2
- },
- {
- id: 1
- },
- {
- id: 3
- }
- ],
- hole : null,
- html : "<h3 style='color:red;'>simple html</h3>"
+ Y.log('[CONTROLLER]: Default log-level message with date: ' + new Date(), null NAME);
+ Y.log('[CONTROLLER]: Warn message.','warn', NAME);
+ var data = {
+ log_config: Y.config.logLevel,
};
- Y.log('[CONTROLLER]: Today ' +today);
ac.done(data);
}
};
- }, '0.0.1', { requires: ['mojito']});
+ }, '0.0.1', { requires: ['mojito','mojito-config-addon']});
#. To display your client logging, replace the content of ``binders/index.js`` with the
following:
@@ -205,46 +233,51 @@ To set up and run ``simple_logging``:
YUI.add('logBinderIndex', function(Y, NAME) {
Y.namespace('mojito.binders')[NAME] = {
init: function(mojitProxy) {
- Y.log('[BINDER]: Log message from init.',"info");
this.mojitProxy = mojitProxy;
},
bind: function(node) {
- Y.log('[BINDER]: Log message from bind.',"info");
+ Y.log("[BINDER]: Default Log level: " + Y.config.logLevel, null, NAME);
+ Y.log('[BINDER]: Error log message.', "error", NAME);
+ Y.one("#client_config").all("b").item(0).insert(Y.config.logLevel,"after");
this.node = node;
}
};
}, '0.0.1', {requires: ['mojito-client']});
+
#. Modify the default template by replacing the code in ``views/index.hb.html`` with the
following:
.. code-block:: html
<div id="{{mojit_view_id}}" class="mojit">
<h2 style="color: #606; font-weight:bold;">Simple Log Configuration </h2>
- <div>This app is to demonstrate the the logging level and its configuration.
+ This app is to demonstrate the the logging level and its configuration.
+ <div id="server_config">
<h3> Server Configuration </h3>
- <b>Log level: </b> DEBUG <br/>
- <b>Timestamp: </b> TRUE <br/>
+ <b>Log level: </b>{{log_config}}<br/>
+ </div>
+ <div id="client_config">
<h3> Client Configuration </h3>
- <b>Log level: </b> INFO <br/>
- <b>Timestamp: </b> FALSE <br/>
+ <b>Log level: </b> <br/>
</div>
- </div>
+ </div>
#. From the application directory, run the server.
``$ mojito start``
#. Open the URL below in a browser and look at the output from the Mojito
server. You should see the log messages from the controller that start
with the string "\[CONTROLLER]:". Notice that the two messages have
- different log levels.
+ different log levels: one is the default (``debug``) and the other sets
+ the log level ``warn`` with ``Y.log``.
http://localhost:8666/
#. Open your browser's developer console, such as Firebug, and view the console
logs. You should see the client log messages from the binder that start with
- the string "\[BINDER]".
+ the string "\[BINDER]". Again, you will see log messages using different log
+ levels.
.. _code_exs_logging-src:
View
5 docs/dev_guide/code_exs/views_multiple_devices.rst
@@ -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,
@@ -198,7 +198,6 @@ To set up and run ``device_views``:
#. Create your mojit.
``$ mojito create mojit device``
-
#. To configure you application, replace the code in ``application.json``
with the following:
@@ -228,7 +227,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
View
78 docs/dev_guide/code_exs/yui_modules.rst
@@ -19,7 +19,7 @@ page views and browser sessions.
The following topics will be covered:
-- adding YUI modules to the ``autoload`` directory
+- adding YUI modules to the ``yui_modules`` directory
- accessing YUI modules from a mojit
.. _code_exs-incl_yui_mods-notes:
@@ -38,9 +38,9 @@ Location
########
To add YUI modules that all your mojits can access, place the modules in the
-``autoload`` directory under the application directory. For example, YUI
+``yui_modules`` directory under the application directory. For example, YUI
modules in the ``hello_world`` application would be placed in
-``hello_world/autoload``.
+``hello_world/yui_modules``.
.. _yui_mod_impl_add-naming:
@@ -70,15 +70,15 @@ the module identified by the string ``'gallery-storage-lite'``.
YUI.add('gallery-storage-lite', function (Y) {
...
- }, '1.0.0', { requires: ['event-base', 'event-custom', 'event-custom-complex', 'json']});
+ }, '1.0.0', { requires: [ 'event-base', 'event-custom', 'event-custom-complex', 'json']});
.. _yui_mod_impl-using:
Using a YUI Module from Mojits
------------------------------
-After registered YUI modules have been added to the ``autoload`` directory, you
+After registered YUI modules have been added to the ``yui_modules`` directory, you
can load them into your mojit code by listing them as dependencies in the
``requires`` array. In the binder ``index.js`` below, you can see that the
Storage Lite module that we created and registered in :ref:`registering_module`
@@ -95,7 +95,7 @@ is listed as a dependency in the ``requires`` array.
...
}
};
- // See autoload/storage-lite.client.js
+ // See yui_modules/storage-lite.client.js
}, '0.0.1', {requires: [ 'gallery-storage-lite' ]});
In the ``bind`` method, ``Y.StorageLite.getItem`` and ``Y.StorageLite.setItem``
@@ -105,17 +105,22 @@ instance to access the module.
.. code-block:: javascript
...
- bind: function(node) {
+ bind: function (node) {
+
// Based on http://yuilibrary.com/gallery/show/storage-lite
- 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
- // each keystroke.
- notes.on('keyup', function() {
- Y.StorageLite.setItem(keyname, notes.get('value'));
+ 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 each keystroke.
+ notes.on('keyup', function () {
+ Y.StorageLite.setItem(keyname, notes.get('value'));
});
+
+ // adding a classname to the notes element to facilitate func tests
+ notes.addClass('ready');
}
...
@@ -172,12 +177,12 @@ To set up and run ``yui_module``:
}
]
-#. Create the autoload directory for storing the Storage Lite module.
+#. Create the ``yui_modules`` directory for storing the Storage Lite module.
- ``$ mkdir autoload``
-#. Get the Storage Lite module and place it in the ``autoload`` directory.
+ ``$ mkdir yui_modules``
+#. Get the Storage Lite module and place it in the ``yui_modules`` directory.
- ``$ wget -O autoload/storage-lite.client.js https://raw.github.com/rgrove/storage-lite/master/src/storage-lite.js --no-check-certificate``
+ ``$ wget -O yui_modules/storage-lite.client.js https://raw.github.com/rgrove/storage-lite/master/src/storage-lite.js --no-check-certificate``
#. Change to ``mojits/Notepad``.
#. Replace the code in ``controller.server.js`` with the following:
@@ -197,29 +202,34 @@ To set up and run ``yui_module``:
.. code-block:: javascript
YUI.add('NotepadBinderIndex', function (Y, NAME) {
+
Y.namespace('mojito.binders')[NAME] = {
- init: function(mojitProxy) {
+ init: function (mojitProxy) {
this.mp = mojitProxy;
},
- /**
- * @method bind
- * @param {Node} YUI Node
- */
- bind: function(node) {
+ bind: function (node) {
+
// Based on http://yuilibrary.com/gallery/show/storage-lite
- var keyname = 'storage-lite-example', notes = node.one('#notes');
- // Populate the textarea with the stored
- // note text on page load.
+ 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
- // each keystroke.
- notes.on('keyup', function() {
- Y.StorageLite.setItem(keyname, notes.get('value'));
+
+ // Save the contents of the textarea after each keystroke.
+ notes.on('keyup', function () {
+ Y.StorageLite.setItem(keyname, notes.get('value'));
});
+
+ // adding a classname to the notes element to facilitate func tests
+ notes.addClass('ready');
}
};
- // See autoload/storage-lite.client.js
- }, '0.0.1', {requires: [ 'gallery-storage-lite' ]});
+ }, '0.0.1', {
+ requires: [
+ 'gallery-storage-lite' //see yui_modules/storage-lite.client.js
+ ]
+ });
#. To display a form that allows users to input text, replace the code in
``views/index.hb.html`` with the following:
View
97 docs/dev_guide/faq/index.rst
@@ -104,9 +104,9 @@ General
.. _moj_langs:
.. topic:: **What languages can I use to develop mojits?**
- JavaScript is the programming language of Cocktails. All modules are written in JavaScript,
- and JavaScript only. Modules that require server-side execution do so through a server-side
- JavaScript execution engine.
+ JavaScript is the programming language of Cocktails. All modules are written in
+ JavaScript, and JavaScript only. Modules that require server-side execution do so
+ through a server-side JavaScript execution engine.
------------
@@ -115,7 +115,7 @@ General