luca 0.9.7 → 0.9.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (377) hide show
  1. data/CHANGELOG +38 -0
  2. data/Gemfile +1 -0
  3. data/Gemfile.lock +27 -0
  4. data/README.md +45 -42
  5. data/ROADMAP +6 -29
  6. data/{assets → app/assets}/images/glyphicons-halflings-white.png +0 -0
  7. data/{assets → app/assets}/images/glyphicons-halflings.png +0 -0
  8. data/app/assets/javascripts/luca/basic.coffee +8 -0
  9. data/{src → app/assets/javascripts/luca}/components/application.coffee +153 -40
  10. data/{src → app/assets/javascripts/luca}/components/base_toolbar.coffee +2 -2
  11. data/{src → app/assets/javascripts/luca}/components/collection_loader_view.coffee +0 -0
  12. data/{src → app/assets/javascripts/luca}/components/collection_view.coffee +45 -104
  13. data/app/assets/javascripts/luca/components/controller.coffee +99 -0
  14. data/{src/core/field.coffee → app/assets/javascripts/luca/components/fields/base.coffee} +1 -1
  15. data/{src → app/assets/javascripts/luca}/components/fields/button_field.coffee +1 -2
  16. data/{src → app/assets/javascripts/luca}/components/fields/checkbox_array.coffee +0 -0
  17. data/{src → app/assets/javascripts/luca}/components/fields/checkbox_field.coffee +0 -0
  18. data/{src → app/assets/javascripts/luca}/components/fields/file_upload_field.coffee +0 -0
  19. data/{src → app/assets/javascripts/luca}/components/fields/hidden_field.coffee +0 -0
  20. data/{src → app/assets/javascripts/luca}/components/fields/label_field.coffee +0 -0
  21. data/{src → app/assets/javascripts/luca}/components/fields/select_field.coffee +8 -4
  22. data/{src → app/assets/javascripts/luca}/components/fields/text_area_field.coffee +3 -2
  23. data/{src → app/assets/javascripts/luca}/components/fields/text_field.coffee +2 -3
  24. data/{src → app/assets/javascripts/luca}/components/fields/type_ahead_field.coffee +0 -0
  25. data/{src → app/assets/javascripts/luca}/components/form_button_toolbar.coffee +0 -0
  26. data/{src → app/assets/javascripts/luca}/components/form_view.coffee +111 -44
  27. data/{src → app/assets/javascripts/luca}/components/grid_view.coffee +6 -6
  28. data/{src → app/assets/javascripts/luca}/components/index.coffee +0 -0
  29. data/app/assets/javascripts/luca/components/load_mask.coffee +8 -0
  30. data/app/assets/javascripts/luca/components/multi_collection_view.coffee +92 -0
  31. data/{src → app/assets/javascripts/luca}/components/nav_bar.coffee +5 -1
  32. data/app/assets/javascripts/luca/components/page_controller.coffee +7 -0
  33. data/{src → app/assets/javascripts/luca}/components/pagination_control.coffee +13 -13
  34. data/{src → app/assets/javascripts/luca}/components/record_manager.coffee +0 -0
  35. data/{src → app/assets/javascripts/luca}/components/router.coffee +6 -1
  36. data/app/assets/javascripts/luca/components/table_view.coffee +89 -0
  37. data/{src → app/assets/javascripts/luca}/components/template.coffee +0 -0
  38. data/{src → app/assets/javascripts/luca}/components/toolbar_dialog.coffee +0 -0
  39. data/{src → app/assets/javascripts/luca}/concerns/application_event_bindings.coffee +1 -1
  40. data/app/assets/javascripts/luca/concerns/collection_event_bindings.coffee +44 -0
  41. data/{src → app/assets/javascripts/luca}/concerns/deferrable.coffee +1 -2
  42. data/{src/plugins → app/assets/javascripts/luca/concerns}/development_tool_helpers.coffee +1 -1
  43. data/{src → app/assets/javascripts/luca}/concerns/dom_helpers.coffee +10 -7
  44. data/{src → app/assets/javascripts/luca}/concerns/enhanced_properties.coffee +0 -0
  45. data/app/assets/javascripts/luca/concerns/filterable.coffee +104 -0
  46. data/{src → app/assets/javascripts/luca}/concerns/grid_layout.coffee +0 -0
  47. data/{src → app/assets/javascripts/luca}/concerns/loadmaskable.coffee +17 -11
  48. data/{src → app/assets/javascripts/luca}/concerns/local_storage.coffee +0 -0
  49. data/{src → app/assets/javascripts/luca}/concerns/modal_view.coffee +0 -0
  50. data/{src → app/assets/javascripts/luca}/concerns/model_presenter.coffee +0 -0
  51. data/{src → app/assets/javascripts/luca}/concerns/paginatable.coffee +6 -14
  52. data/app/assets/javascripts/luca/concerns/query_collection_bindings.coffee +46 -0
  53. data/app/assets/javascripts/luca/concerns/sortable.coffee +69 -0
  54. data/app/assets/javascripts/luca/concerns/state_model.coffee +44 -0
  55. data/{src → app/assets/javascripts/luca}/concerns/templating.coffee +4 -1
  56. data/app/assets/javascripts/luca/config.coffee +49 -0
  57. data/{src → app/assets/javascripts/luca}/containers/card_view.coffee +30 -13
  58. data/{src/core → app/assets/javascripts/luca/containers}/container.coffee +57 -18
  59. data/app/assets/javascripts/luca/containers/index.coffee +2 -0
  60. data/{src → app/assets/javascripts/luca}/containers/modal_view.coffee +1 -1
  61. data/{src → app/assets/javascripts/luca}/containers/panel_toolbar.coffee +1 -1
  62. data/{src → app/assets/javascripts/luca}/containers/tab_view.coffee +1 -1
  63. data/{src → app/assets/javascripts/luca}/containers/viewport.coffee +4 -4
  64. data/{src → app/assets/javascripts/luca}/core/collection.coffee +58 -49
  65. data/{src/plugins → app/assets/javascripts/luca/core}/events.coffee +34 -2
  66. data/app/assets/javascripts/luca/core/index.coffee +12 -0
  67. data/{src → app/assets/javascripts/luca}/core/model.coffee +1 -1
  68. data/{src → app/assets/javascripts/luca}/core/observer.coffee +0 -0
  69. data/app/assets/javascripts/luca/core/panel.coffee +112 -0
  70. data/app/assets/javascripts/luca/core/registry/component_definition.coffee +318 -0
  71. data/{src → app/assets/javascripts/luca/core/registry}/concerns.coffee +0 -0
  72. data/app/assets/javascripts/luca/core/registry/index.coffee +4 -0
  73. data/app/assets/javascripts/luca/core/registry/meta_data.coffee +97 -0
  74. data/{src/core → app/assets/javascripts/luca/core/registry}/registry.coffee +10 -6
  75. data/app/assets/javascripts/luca/core/templates.coffee +47 -0
  76. data/{src → app/assets/javascripts/luca}/core/view.coffee +69 -11
  77. data/app/assets/javascripts/luca/dependencies.coffee +7 -0
  78. data/{src/tools → app/assets/javascripts/luca/development}/code_mirror_field.coffee +2 -1
  79. data/{src/tools → app/assets/javascripts/luca/development}/console.coffee +6 -5
  80. data/app/assets/javascripts/luca/development/index.coffee +2 -0
  81. data/{src → app/assets/javascripts/luca}/framework.coffee +74 -90
  82. data/app/assets/javascripts/luca/index.coffee +8 -0
  83. data/{src → app/assets/javascripts/luca}/managers/collection_manager.coffee +16 -7
  84. data/app/assets/javascripts/luca/managers/index.coffee +2 -0
  85. data/app/assets/javascripts/luca/managers/socket_manager.coffee +66 -0
  86. data/{src → app/assets/javascripts/luca}/templates/components/bootstrap_form_controls.jst.ejs +0 -0
  87. data/{src → app/assets/javascripts/luca}/templates/components/collection_loader_view.jst.ejs +0 -0
  88. data/{src → app/assets/javascripts/luca}/templates/components/form_alert.jst.ejs +0 -0
  89. data/{src → app/assets/javascripts/luca}/templates/components/grid_view.jst.ejs +0 -0
  90. data/{src → app/assets/javascripts/luca}/templates/components/grid_view_empty_text.jst.ejs +0 -0
  91. data/{src → app/assets/javascripts/luca}/templates/components/load_mask.jst.ejs +0 -0
  92. data/{src → app/assets/javascripts/luca}/templates/components/nav_bar.jst.ejs +0 -0
  93. data/{src → app/assets/javascripts/luca}/templates/components/pagination.jst.ejs +0 -0
  94. data/{src/templates → app/assets/javascripts/luca/templates/components}/table_view.jst.ejs +0 -0
  95. data/{src → app/assets/javascripts/luca}/templates/containers/basic.jst.ejs +0 -0
  96. data/{src → app/assets/javascripts/luca}/templates/containers/tab_selector_container.jst.ejs +0 -0
  97. data/{src → app/assets/javascripts/luca}/templates/containers/tab_view.jst.ejs +0 -0
  98. data/{src → app/assets/javascripts/luca}/templates/containers/toolbar_wrapper.jst.ejs +0 -0
  99. data/{src → app/assets/javascripts/luca}/templates/fields/button_field.jst.ejs +0 -0
  100. data/{src → app/assets/javascripts/luca}/templates/fields/button_field_link.jst.ejs +0 -0
  101. data/{src → app/assets/javascripts/luca}/templates/fields/checkbox_array.jst.ejs +0 -0
  102. data/{src → app/assets/javascripts/luca}/templates/fields/checkbox_array_item.jst.ejs +0 -0
  103. data/{src → app/assets/javascripts/luca}/templates/fields/checkbox_field.jst.ejs +0 -0
  104. data/{src → app/assets/javascripts/luca}/templates/fields/file_upload_field.jst.ejs +0 -0
  105. data/{src → app/assets/javascripts/luca}/templates/fields/hidden_field.jst.ejs +0 -0
  106. data/{src → app/assets/javascripts/luca}/templates/fields/select_field.jst.ejs +0 -0
  107. data/{src → app/assets/javascripts/luca}/templates/fields/text_area_field.jst.ejs +1 -1
  108. data/{src → app/assets/javascripts/luca}/templates/fields/text_field.jst.ejs +1 -1
  109. data/app/assets/javascripts/luca/util/deprecations.coffee +18 -0
  110. data/app/assets/javascripts/luca/util/index.coffee +3 -0
  111. data/app/assets/javascripts/luca/util/logging.coffee +15 -0
  112. data/{src/util.coffee → app/assets/javascripts/luca/util/luca.coffee} +20 -4
  113. data/{src/core → app/assets/javascripts/luca/util}/script_loader.coffee +0 -0
  114. data/app/assets/javascripts/luca-ui.js +1 -0
  115. data/{src/stylesheets → app/assets/stylesheets/luca}/components/checkbox_array.scss +0 -0
  116. data/app/assets/stylesheets/luca/components/form_view.scss +7 -0
  117. data/{src/stylesheets → app/assets/stylesheets/luca}/components/grid_view.scss +0 -0
  118. data/{src/stylesheets → app/assets/stylesheets/luca}/components/load_mask.scss +0 -0
  119. data/{src/stylesheets → app/assets/stylesheets/luca}/components/viewport.scss +0 -0
  120. data/{src/stylesheets → app/assets/stylesheets/luca}/containers/container.scss +0 -0
  121. data/{src/stylesheets → app/assets/stylesheets/luca}/containers/modal_view.scss +0 -0
  122. data/{src/stylesheets → app/assets/stylesheets/luca}/containers/panels.scss +0 -0
  123. data/{src/stylesheets → app/assets/stylesheets/luca}/containers/tab_view.scss +0 -0
  124. data/{src/stylesheets/tools → app/assets/stylesheets/luca/development}/console.scss +0 -0
  125. data/app/assets/stylesheets/luca/development/index.css +3 -0
  126. data/app/assets/stylesheets/luca/index.css +4 -0
  127. data/{src/stylesheets → app/assets/stylesheets/luca}/normalize.scss +0 -0
  128. data/app.rb +2 -4
  129. data/lib/generators/luca/application/application_generator.rb +12 -8
  130. data/lib/generators/luca/application/templates/controller.rb +0 -2
  131. data/lib/generators/luca/application/templates/index.html.erb +12 -0
  132. data/lib/generators/luca/application/templates/index.html.haml +1 -0
  133. data/lib/generators/luca/application/templates/javascripts/application.coffee +18 -0
  134. data/lib/generators/luca/application/templates/javascripts/collection_manager.coffee +2 -0
  135. data/lib/generators/luca/application/templates/javascripts/config.coffee +3 -0
  136. data/lib/generators/luca/application/templates/javascripts/{dependencies.js.coffee → dependencies.coffee} +1 -0
  137. data/lib/generators/luca/application/templates/javascripts/home.jst.ejs +2 -0
  138. data/lib/generators/luca/application/templates/javascripts/index.coffee +15 -0
  139. data/lib/generators/luca/application/templates/javascripts/router.coffee +4 -0
  140. data/lib/luca/component_documentation.rb +72 -0
  141. data/lib/luca/rails/engine.rb +4 -0
  142. data/lib/luca/rails/version.rb +1 -1
  143. data/lib/luca.rb +1 -1
  144. data/lib/railties/luca/tasks.rake +31 -0
  145. data/luca.gemspec +1 -0
  146. data/spec/components/controller_spec.coffee +62 -0
  147. data/spec/components/form_view_spec.coffee +4 -0
  148. data/spec/concerns/collection_event_bindings_spec.coffee +15 -0
  149. data/spec/concerns/dom_helpers_spec.coffee +2 -2
  150. data/spec/concerns/filterable_spec.coffee +4 -4
  151. data/spec/concerns/state_model_spec.coffee +50 -0
  152. data/spec/core/collection_spec.coffee +25 -0
  153. data/spec/{concerns_spec.coffee → core/concerns_spec.coffee} +0 -0
  154. data/spec/core/container_spec.coffee +57 -5
  155. data/spec/core/define_spec.coffee +116 -0
  156. data/spec/core/events_spec.coffee +26 -0
  157. data/spec/core/field_spec.coffee +4 -0
  158. data/spec/{framework_spec.coffee → core/framework_spec.coffee} +31 -2
  159. data/spec/{util_spec.coffee → core/util_spec.coffee} +2 -2
  160. data/spec/core/view_spec.coffee +65 -1
  161. data/spec/dependencies/index.coffee +3 -0
  162. data/{assets/javascripts → spec}/dependencies/jasmine-html.js +0 -0
  163. data/{assets/javascripts → spec}/dependencies/jasmine.js +0 -0
  164. data/{assets/javascripts → spec}/dependencies/sinon.js +0 -0
  165. data/spec/luca-spec.coffee +9 -0
  166. data/vendor/assets/javascripts/backbone-ext.js +21 -0
  167. data/vendor/assets/javascripts/backbone-min.js +38 -0
  168. data/vendor/assets/javascripts/backbone-query.min.js +1 -0
  169. data/vendor/assets/javascripts/bootstrap.min.js +7 -0
  170. data/{assets/javascripts/dependencies → vendor/assets/javascripts}/codemirror-coffeescript.js +0 -0
  171. data/{assets/javascripts/dependencies → vendor/assets/javascripts}/codemirror-css.js +0 -0
  172. data/{assets/javascripts/dependencies → vendor/assets/javascripts}/codemirror-html.js +0 -0
  173. data/{assets/javascripts/dependencies → vendor/assets/javascripts}/codemirror-javascript.js +0 -0
  174. data/{assets/javascripts/dependencies → vendor/assets/javascripts}/codemirror-less.js +0 -0
  175. data/vendor/assets/javascripts/codemirror-ui.js +503 -0
  176. data/{assets/javascripts/dependencies → vendor/assets/javascripts}/codemirror-vim.js +0 -0
  177. data/{assets/javascripts/dependencies → vendor/assets/javascripts}/codemirror.js +0 -0
  178. data/vendor/assets/javascripts/inflections.js +656 -0
  179. data/vendor/assets/javascripts/jasmine-html.js +190 -0
  180. data/vendor/assets/javascripts/jasmine.js +2476 -0
  181. data/{assets/javascripts/dependencies → vendor/assets/javascripts}/jquery.js +0 -0
  182. data/vendor/assets/javascripts/luca-spec.js +11 -0
  183. data/{assets/javascripts/dependencies → vendor/assets/javascripts}/modal.js +0 -0
  184. data/{assets/javascripts/dependencies → vendor/assets/javascripts}/modernizr.min.js +0 -0
  185. data/{assets/javascripts/dependencies → vendor/assets/javascripts}/prettify.js +0 -0
  186. data/vendor/assets/javascripts/sinon.js +3469 -0
  187. data/{assets/javascripts/dependencies → vendor/assets/javascripts}/spin-min.js +0 -0
  188. data/{assets/javascripts/dependencies → vendor/assets/javascripts}/underscore-min.js +0 -0
  189. data/vendor/assets/javascripts/underscore-string.min.js +1 -0
  190. data/vendor/assets/stylesheets/bootstrap-responsive.min.css +9 -0
  191. data/vendor/assets/stylesheets/bootstrap.min.css +9 -0
  192. data/{assets → vendor/assets}/stylesheets/codemirror-blackboard.css +0 -0
  193. data/{assets → vendor/assets}/stylesheets/codemirror-monokai.css +0 -0
  194. data/{assets → vendor/assets}/stylesheets/codemirror.css +0 -0
  195. data/{assets → vendor/assets}/stylesheets/jasmine.css +0 -0
  196. data/vendor/assets/stylesheets/luca-ui.css +0 -601
  197. data/views/jasmine.erb +2 -2
  198. metadata +190 -299
  199. data/assets/javascripts/dependencies/backbone-min.js +0 -37
  200. data/assets/javascripts/dependencies/backbone-query.min.js +0 -1
  201. data/assets/javascripts/dependencies/bootstrap.min.js +0 -7
  202. data/assets/javascripts/dependencies/coffee-script.js +0 -12189
  203. data/assets/javascripts/dependencies/underscore-string.min.js +0 -14
  204. data/assets/javascripts/dependencies.coffee +0 -5
  205. data/assets/javascripts/luca/index.coffee +0 -1
  206. data/assets/javascripts/luca-templates.js +0 -1
  207. data/assets/javascripts/luca-ui-base.coffee +0 -1
  208. data/assets/javascripts/luca-ui-bootstrap.js +0 -1
  209. data/assets/javascripts/luca-ui-development-tools.coffee +0 -9
  210. data/assets/javascripts/luca-ui-full.js +0 -3
  211. data/assets/javascripts/luca-ui-spec.coffee +0 -2
  212. data/assets/javascripts/luca-ui.js +0 -3
  213. data/assets/javascripts/sandbox/application.coffee +0 -57
  214. data/assets/javascripts/sandbox/config.coffee +0 -7
  215. data/assets/javascripts/sandbox/router.coffee +0 -24
  216. data/assets/javascripts/sandbox/templates/builder/component_list.luca +0 -1
  217. data/assets/javascripts/sandbox/templates/builder.luca +0 -2
  218. data/assets/javascripts/sandbox/templates/main.luca +0 -53
  219. data/assets/javascripts/sandbox/templates/sandbox/docs_index.luca +0 -1
  220. data/assets/javascripts/sandbox/templates/sandbox/navigation.luca +0 -8
  221. data/assets/javascripts/sandbox/templates/sandbox/readme.luca +0 -30
  222. data/assets/javascripts/sandbox/templates/sandbox.luca +0 -1
  223. data/assets/javascripts/sandbox/views/builder/builder_canvas.coffee +0 -3
  224. data/assets/javascripts/sandbox/views/builder/builder_editor.coffee +0 -6
  225. data/assets/javascripts/sandbox/views/builder/component_list.coffee +0 -38
  226. data/assets/javascripts/sandbox/views/builder/project_browser.coffee +0 -14
  227. data/assets/javascripts/sandbox/views/builder.coffee +0 -133
  228. data/assets/javascripts/sandbox/views/docs_controller.coffee +0 -7
  229. data/assets/javascripts/sandbox/views/inspector/instance_filter.coffee +0 -18
  230. data/assets/javascripts/sandbox/views/inspector/instance_list.coffee +0 -0
  231. data/assets/javascripts/sandbox/views/inspector.coffee +0 -11
  232. data/assets/javascripts/sandbox/views/top_navigation.coffee +0 -4
  233. data/assets/javascripts/sandbox.coffee +0 -7
  234. data/assets/javascripts/spec-dependencies.coffee +0 -4
  235. data/assets/stylesheets/bootstrap-responsive.min.css +0 -2
  236. data/assets/stylesheets/bootstrap.min.css +0 -727
  237. data/assets/stylesheets/luca-ui-bootstrap.css +0 -4
  238. data/assets/stylesheets/luca-ui-development-tools.css +0 -5
  239. data/assets/stylesheets/luca-ui-full.css +0 -3
  240. data/assets/stylesheets/luca-ui-spec.css +0 -3
  241. data/assets/stylesheets/luca-ui.css +0 -3
  242. data/assets/stylesheets/prettify.css +0 -40
  243. data/assets/stylesheets/sandbox/builder.scss +0 -79
  244. data/assets/stylesheets/sandbox/sandbox.scss +0 -18
  245. data/assets/stylesheets/sandbox.css +0 -3
  246. data/assets/stylesheets/themes/amelia-bootstrap.css +0 -826
  247. data/assets/stylesheets/themes/slate-bootstrap.css +0 -797
  248. data/assets/stylesheets/themes/superhero-bootstrap.css +0 -830
  249. data/lib/generators/luca/application/templates/javascripts/application.js +0 -28
  250. data/lib/generators/luca/application/templates/javascripts/application.js.coffee +0 -20
  251. data/lib/generators/luca/application/templates/javascripts/config.js +0 -15
  252. data/lib/generators/luca/application/templates/javascripts/config.js.coffee +0 -9
  253. data/lib/generators/luca/application/templates/javascripts/dependencies.js +0 -5
  254. data/lib/generators/luca/application/templates/javascripts/index.js +0 -9
  255. data/lib/generators/luca/application/templates/javascripts/index.js.coffee +0 -9
  256. data/lib/generators/luca/application/templates/javascripts/main.js +0 -8
  257. data/lib/generators/luca/application/templates/javascripts/main.js.coffee +0 -3
  258. data/lib/generators/luca/application/templates/javascripts/main.jst.ejs +0 -1
  259. data/lib/generators/luca/application/templates/javascripts/router.js +0 -12
  260. data/lib/generators/luca/application/templates/javascripts/router.js.coffee +0 -7
  261. data/spec/containers/column_view_spec.coffee +0 -0
  262. data/spec/containers/split_view_spec.coffee +0 -0
  263. data/spec/define_spec.coffee +0 -13
  264. data/src/components/controller.coffee +0 -65
  265. data/src/components/load_mask.coffee +0 -3
  266. data/src/components/multi_collection_view.coffee +0 -121
  267. data/src/components/page_controller.coffee +0 -2
  268. data/src/components/table_view.coffee +0 -62
  269. data/src/concerns/collection_event_bindings.coffee +0 -26
  270. data/src/concerns/filterable.coffee +0 -82
  271. data/src/concerns/state_model.coffee +0 -16
  272. data/src/containers/column_view.coffee +0 -42
  273. data/src/containers/page_view.coffee +0 -2
  274. data/src/containers/panel_view.coffee +0 -23
  275. data/src/containers/split_view.coffee +0 -8
  276. data/src/core/core.coffee +0 -0
  277. data/src/core/meta_data.coffee +0 -37
  278. data/src/core/panel.coffee +0 -118
  279. data/src/define.coffee +0 -170
  280. data/src/index.coffee +0 -25
  281. data/src/managers/socket_manager.coffee +0 -54
  282. data/src/samples/definition.coffee +0 -49
  283. data/src/stylesheets/base.scss +0 -0
  284. data/src/stylesheets/components/form_view.scss +0 -59
  285. data/src/stylesheets/components/toolbar.scss +0 -0
  286. data/src/stylesheets/tools/class_browser.scss +0 -32
  287. data/src/stylesheets/tools/code_editor.scss +0 -24
  288. data/src/stylesheets/tools/component_tester.scss +0 -26
  289. data/src/tools/application_inspector.coffee +0 -2
  290. data/src/tools/code_editor.coffee +0 -258
  291. data/src/tools/coffee_script_editor.coffee +0 -82
  292. data/src/tools/collection_inspector.coffee +0 -4
  293. data/src/tools/collections/components.coffee +0 -59
  294. data/src/tools/collections/instances.coffee +0 -15
  295. data/src/tools/component_tester.coffee +0 -462
  296. data/src/tools/models/components.coffee +0 -25
  297. data/src/tools/models/instance.coffee +0 -2
  298. data/src/tools/templates/component_tester/help.luca +0 -14
  299. data/vendor/assets/javascripts/luca-ui-base.js +0 -5304
  300. data/vendor/assets/javascripts/luca-ui-bootstrap.js +0 -9
  301. data/vendor/assets/javascripts/luca-ui-development-tools.js +0 -18561
  302. data/vendor/assets/javascripts/luca-ui-development-tools.min.js +0 -15
  303. data/vendor/assets/javascripts/luca-ui-full.js +0 -6319
  304. data/vendor/assets/javascripts/luca-ui-full.min.js +0 -9
  305. data/vendor/assets/javascripts/luca-ui-spec.js +0 -6815
  306. data/vendor/assets/javascripts/luca-ui-templates.js +0 -92
  307. data/vendor/assets/javascripts/luca-ui.js +0 -6234
  308. data/vendor/assets/javascripts/luca-ui.min.js +0 -5
  309. data/vendor/assets/luca-ui/base.css +0 -85
  310. data/vendor/assets/luca-ui/components/application.js +0 -91
  311. data/vendor/assets/luca-ui/components/base_toolbar.js +0 -23
  312. data/vendor/assets/luca-ui/components/controller.js +0 -38
  313. data/vendor/assets/luca-ui/components/fields/button_field.js +0 -45
  314. data/vendor/assets/luca-ui/components/fields/checkbox_field.js +0 -43
  315. data/vendor/assets/luca-ui/components/fields/file_upload_field.js +0 -20
  316. data/vendor/assets/luca-ui/components/fields/hidden_field.js +0 -20
  317. data/vendor/assets/luca-ui/components/fields/select_field.js +0 -97
  318. data/vendor/assets/luca-ui/components/fields/text_area_field.js +0 -48
  319. data/vendor/assets/luca-ui/components/fields/text_field.js +0 -46
  320. data/vendor/assets/luca-ui/components/fields/type_ahead_field.js +0 -13
  321. data/vendor/assets/luca-ui/components/form_button_toolbar.js +0 -32
  322. data/vendor/assets/luca-ui/components/form_view.css +0 -32
  323. data/vendor/assets/luca-ui/components/form_view.js +0 -207
  324. data/vendor/assets/luca-ui/components/grid_view.css +0 -76
  325. data/vendor/assets/luca-ui/components/grid_view.js +0 -202
  326. data/vendor/assets/luca-ui/components/record_manager.js +0 -207
  327. data/vendor/assets/luca-ui/components/router.js +0 -36
  328. data/vendor/assets/luca-ui/components/template.js +0 -26
  329. data/vendor/assets/luca-ui/components/toolbar.css +0 -11
  330. data/vendor/assets/luca-ui/containers/card_view.js +0 -98
  331. data/vendor/assets/luca-ui/containers/column_view.js +0 -52
  332. data/vendor/assets/luca-ui/containers/container.css +0 -3
  333. data/vendor/assets/luca-ui/containers/modal_view.css +0 -0
  334. data/vendor/assets/luca-ui/containers/modal_view.js +0 -87
  335. data/vendor/assets/luca-ui/containers/panel_view.js +0 -34
  336. data/vendor/assets/luca-ui/containers/split_view.js +0 -13
  337. data/vendor/assets/luca-ui/containers/tab_view.css +0 -16
  338. data/vendor/assets/luca-ui/containers/tab_view.js +0 -80
  339. data/vendor/assets/luca-ui/containers/viewport.js +0 -18
  340. data/vendor/assets/luca-ui/core/collection.js +0 -221
  341. data/vendor/assets/luca-ui/core/container.js +0 -205
  342. data/vendor/assets/luca-ui/core/field.js +0 -59
  343. data/vendor/assets/luca-ui/core/observer.js +0 -42
  344. data/vendor/assets/luca-ui/core/view.js +0 -127
  345. data/vendor/assets/luca-ui/framework.js +0 -110
  346. data/vendor/assets/luca-ui/index.js +0 -5
  347. data/vendor/assets/luca-ui/managers/collection_manager.js +0 -98
  348. data/vendor/assets/luca-ui/managers/socket_manager.js +0 -52
  349. data/vendor/assets/luca-ui/modules/deferrable.js +0 -21
  350. data/vendor/assets/luca-ui/modules/local_storage.js +0 -81
  351. data/vendor/assets/luca-ui/normalize.css +0 -359
  352. data/vendor/assets/luca-ui/stylesheets/base.css +0 -85
  353. data/vendor/assets/luca-ui/stylesheets/components/form_view.css +0 -32
  354. data/vendor/assets/luca-ui/stylesheets/components/grid_view.css +0 -76
  355. data/vendor/assets/luca-ui/stylesheets/components/toolbar.css +0 -11
  356. data/vendor/assets/luca-ui/stylesheets/containers/container.css +0 -3
  357. data/vendor/assets/luca-ui/stylesheets/containers/modal_view.css +0 -0
  358. data/vendor/assets/luca-ui/stylesheets/containers/tab_view.css +0 -16
  359. data/vendor/assets/luca-ui/stylesheets/normalize.css +0 -359
  360. data/vendor/assets/luca-ui/templates/components/bootstrap_form_controls.js +0 -4
  361. data/vendor/assets/luca-ui/templates/components/form_view.js +0 -4
  362. data/vendor/assets/luca-ui/templates/components/grid_view.js +0 -4
  363. data/vendor/assets/luca-ui/templates/components/grid_view_empty_text.js +0 -4
  364. data/vendor/assets/luca-ui/templates/containers/basic.js +0 -4
  365. data/vendor/assets/luca-ui/templates/containers/tab_selector_container.js +0 -4
  366. data/vendor/assets/luca-ui/templates/containers/tab_view.js +0 -4
  367. data/vendor/assets/luca-ui/templates/containers/toolbar_wrapper.js +0 -4
  368. data/vendor/assets/luca-ui/templates/fields/button_field.js +0 -4
  369. data/vendor/assets/luca-ui/templates/fields/button_field_link.js +0 -4
  370. data/vendor/assets/luca-ui/templates/fields/checkbox_field.js +0 -4
  371. data/vendor/assets/luca-ui/templates/fields/file_upload_field.js +0 -4
  372. data/vendor/assets/luca-ui/templates/fields/hidden_field.js +0 -4
  373. data/vendor/assets/luca-ui/templates/fields/select_field.js +0 -4
  374. data/vendor/assets/luca-ui/templates/fields/text_area_field.js +0 -4
  375. data/vendor/assets/luca-ui/templates/fields/text_field.js +0 -4
  376. data/vendor/assets/luca-ui/templates/sample/contents.js +0 -4
  377. data/vendor/assets/luca-ui/templates/sample/welcome.js +0 -4
data/CHANGELOG CHANGED
@@ -200,3 +200,41 @@
200
200
  - Renaming 'mixin' and 'module' functionality to 'concern'
201
201
  - Luca.concerns now follow the active support concern in spirit, with __included hooks, ClassMethods handling, etc
202
202
  - Introducing an optional Concern for Luca.Model classes, called ModelPresenter.
203
+ - The callback argument passed to CardView activate, now gets called in the context of the activated component
204
+
205
+ 0.9.75
206
+ - Component registration is now beautifully readable and self documenting,
207
+ and flexible. Minimally only requires one call to Luca.register().
208
+ This allows you to be as descriptive as you like when defining a component,
209
+ and does not require you to call any definition methods which do not
210
+ make literary sense in your component description.
211
+
212
+ - Component definition now supports specifying class methods.
213
+
214
+ - Luca.initialize('Namespace') will setup a complete namespace for
215
+ your application, and give you a Namespace() method which works similar
216
+ to the Luca() helper.
217
+
218
+ - Added Luca.config.modelBootrstrap and Luca.config.baseParams as pointers
219
+ to either properties, or methods, which can be used to configure Luca.Collection behavior
220
+ - Luca.onReady is now the preferred way of launching the application.
221
+ - Added Luca.Application.routeTo, Luca.Application.controller
222
+ route building helpers
223
+
224
+ 0.9.78
225
+ - Added experimental ability to integrate router into the application itself, via the @routes property
226
+ - Temporary fix for double rendering bug in containers which had css class based assignments on their containers.
227
+ - Added experimental support for Luca.SocketManager
228
+ - Introducing @stateChangeEvents property for views which mixin the StateModel concern.
229
+ - Added additional ComponentDefinition methods: public, private, configuration, methods
230
+ - Component MetaData tracks descendants()
231
+ - SelectField defaults to valueType integer when valueField is "id"
232
+
233
+ 0.9.8
234
+ - Luca follows Sprockets / Asset Pipeline Conventions
235
+ - Renamed
236
+ - Luca.core.Container to Luca.Container
237
+ - Luca.components.Panel to Luca.Panel
238
+ - Added Sortable Concern
239
+ - Added Luca.log()
240
+ - Added ability to create aliases / deprecations of components with warning messages
data/Gemfile CHANGED
@@ -15,4 +15,5 @@ group :test, :development do
15
15
  gem 'rb-fsevent', '>= 0.9.1'
16
16
  gem 'pry'
17
17
  gem 'guard-jasmine'
18
+ gem 'jasmine'
18
19
  end
data/Gemfile.lock CHANGED
@@ -1,6 +1,7 @@
1
1
  GEM
2
2
  remote: http://rubygems.org/
3
3
  specs:
4
+ addressable (2.3.2)
4
5
  childprocess (0.3.1)
5
6
  ffi (~> 1.0.6)
6
7
  coderay (0.9.8)
@@ -8,6 +9,7 @@ GEM
8
9
  coffee-script-source
9
10
  execjs
10
11
  coffee-script-source (1.2.0)
12
+ diff-lcs (1.1.3)
11
13
  ejs (1.0.0)
12
14
  execjs (1.2.13)
13
15
  multi_json (~> 1.0)
@@ -28,6 +30,15 @@ GEM
28
30
  haml (3.1.4)
29
31
  hike (1.2.1)
30
32
  i18n (0.6.0)
33
+ jasmine (1.3.0)
34
+ jasmine-core (>= 1.3.0)
35
+ rack (~> 1.0)
36
+ rspec (>= 1.3.1)
37
+ selenium-webdriver (>= 0.1.3)
38
+ jasmine-core (1.3.0)
39
+ libwebsocket (0.1.7.1)
40
+ addressable
41
+ websocket
31
42
  method_source (0.6.7)
32
43
  ruby_parser (>= 2.3.1)
33
44
  multi_json (1.0.4)
@@ -41,9 +52,23 @@ GEM
41
52
  rack
42
53
  rake (0.9.2.2)
43
54
  rb-fsevent (0.9.1)
55
+ rspec (2.12.0)
56
+ rspec-core (~> 2.12.0)
57
+ rspec-expectations (~> 2.12.0)
58
+ rspec-mocks (~> 2.12.0)
59
+ rspec-core (2.12.0)
60
+ rspec-expectations (2.12.0)
61
+ diff-lcs (~> 1.1.3)
62
+ rspec-mocks (2.12.0)
44
63
  ruby_parser (2.3.1)
45
64
  sexp_processor (~> 3.0)
65
+ rubyzip (0.9.9)
46
66
  sass (3.1.12)
67
+ selenium-webdriver (2.26.0)
68
+ childprocess (>= 0.2.5)
69
+ libwebsocket (~> 0.1.3)
70
+ multi_json (~> 1.0)
71
+ rubyzip
47
72
  sexp_processor (3.0.9)
48
73
  sinatra (1.3.1)
49
74
  rack (~> 1.3, >= 1.3.4)
@@ -59,6 +84,7 @@ GEM
59
84
  uglifier (1.2.0)
60
85
  execjs (>= 0.3.0)
61
86
  multi_json (>= 1.0.2)
87
+ websocket (1.0.4)
62
88
 
63
89
  PLATFORMS
64
90
  ruby
@@ -70,6 +96,7 @@ DEPENDENCIES
70
96
  guard-jasmine
71
97
  guard-sprockets2
72
98
  haml
99
+ jasmine
73
100
  pry
74
101
  rake
75
102
  rb-fsevent (>= 0.9.1)
data/README.md CHANGED
@@ -7,21 +7,6 @@ and clean single page applications.
7
7
  It uses twitter bootstrap compatible markup and css naming conventions,
8
8
  making it possible to generate completely styled user interfaces with JSON alone.
9
9
 
10
- Luca combines the functionality of other open source libraries as well, but you are not
11
- required to use any of them if you don't like.
12
-
13
- ### Dependencies
14
-
15
- - [Bootstrap by Twitter](https://twitter.github.com/bootstrap)
16
- - [Backbone-Query by David Tonge](https://github.com/davidgtonge/backbone_query)
17
- - [Underscore String by Esa-Matti Suuronen](https://github.com/epeli/underscore.string)
18
-
19
- ### Development Tool Dependencies:
20
-
21
- - [CodeMirror IDE](https://codemirror.net)
22
- - [CoffeeScript Compiler](https://coffeescript.org)
23
-
24
-
25
10
  ### Using With Rails Asset Pipeline
26
11
 
27
12
  ```ruby
@@ -33,41 +18,59 @@ In your css manifest:
33
18
 
34
19
  ```css
35
20
  /*
36
- *= require 'luca-ui-full'
37
- *= require 'luca-ui-development-tools'
21
+ *= require 'luca'
38
22
  */
39
23
  ```
40
24
 
41
25
  All Javascript Dependencies:
42
26
 
43
27
  ```javascript
44
- //= require 'underscore'
45
- //= require 'underscore-string.min'
46
- //= require 'jquery'
47
- //= require 'backbone'
48
- //= require 'bootstrap.min.js'
49
- //= require 'luca-ui.min.js'
50
- //= require 'luca-ui-development-tools.min.js'
28
+ //= require 'luca/dependencies'
29
+ //= require 'luca'
51
30
  ```
52
31
 
53
- Or you can just use the dependencies we rely on. Latest backbone.js, underscore.js, underscore.string.js, twitter boostrap js and css:
54
-
55
- ```
56
- //= require 'luca-ui-full.min.js'
57
- ```
58
-
59
- ## Standalone With Twitter Bootstrap ( development tools are optional )
60
- ```html
61
- <html>
62
- <head>
63
- <link rel="stylesheet" href='luca-ui-full.css' />
64
- <link rel="stylesheet" href='luca-ui-development-tools.css' />
65
- </head>
66
- <body>
67
- <script type='text/javascript' src="luca-ui-full.min.js" />
68
- <script type='text/javascript' src="luca-ui-development-tools.min.js" />
69
- </body>
70
- </html>
32
+ Your App:
33
+ ```javascript
34
+ Luca.initialize('App', {
35
+ // will look in window.AppBootstrap for an object
36
+ // keyed on your collection's cache_keys() for automatically
37
+ // populating collections on page load
38
+ modelBootstrap: true,
39
+ // will look in window.AppBaseParams for an object
40
+ // or function used to determine the query parameters to
41
+ // be sent on every request
42
+ baseParams: true
43
+ });
44
+
45
+ JST['home'] = function() {
46
+ // content
47
+ };
48
+
49
+ App.register('App.views.Home').extends('Luca.View').defines({
50
+ template: "home",
51
+ events: {
52
+ "click .menu-handler" : "clickMenuHandler"
53
+ },
54
+ clickMenuHandler: function(e){
55
+
56
+ }
57
+ });
58
+
59
+ App.register('App.Application').extends('Luca.Application').defines({
60
+ // will use the Application classes internal controller
61
+ // to make the home 'page' active in the viewport
62
+ routes:{
63
+ "" : "home"
64
+ }
65
+ components:[
66
+ name: "home"
67
+ type: "home"
68
+ ]
69
+ });
70
+
71
+ AppNamespace.onReady(function(){
72
+ (new AppNamespace.Application).boot()
73
+ })
71
74
  ```
72
75
 
73
76
  ## Rails Generator
data/ROADMAP CHANGED
@@ -1,33 +1,10 @@
1
- Framework
2
- ---------
3
- Extract hooks into module
1
+ Luca.Collection.query
2
+ - add function pipeline to run filter, and options
3
+ objects through. anything can inject itself
4
+ into the pipeline.
4
5
 
5
- General
6
- -------
7
- - Make development mode options easily disabled
8
- - Integrate with requireJs or some other AMD system
9
- - Move to node.js for build / testing
10
- - Replace .luca template with standard jst
11
- - Eliminate underscore-string dependency. just copy necessary functions.
12
- - Eliminate pointless CSS selectors
6
+ basically, remove this from the view.
13
7
 
14
- - Rely on data attributes for functionality instead of css selectors
15
- - BUT in general don't tie views to the DOM anyway
8
+ - write a backbone-query -> squeel -> activerecord bridge
16
9
 
17
- Luca.View
18
- ---------
19
- - Add StateMachine model to all instances of Luca.View
20
10
 
21
- Containers
22
- ----------
23
- - Luca.core.Container should relay all activation events to @components
24
-
25
- Luca.CollectionManager
26
- ----------------------
27
- - Add concept of base params for a given scope of the collection manager
28
-
29
- Luca.Application
30
- ----------------
31
- - Modify boot sequence so that rendering can happen on DOM ready, but all other
32
- operations, such as fetching collections, etc, can happen immediately upon
33
- initialization
@@ -0,0 +1,8 @@
1
+ #= require_tree ./templates
2
+ #= require_self
3
+ #= require ./config
4
+ #= require ./util
5
+ #= require ./managers
6
+ #= require ./core
7
+ #= require ./containers
8
+ #= require ./framework
@@ -1,22 +1,14 @@
1
- application = Luca.register "Luca.Application"
2
- application.extends "Luca.containers.Viewport"
3
-
4
1
  # Luca.Application
5
2
  #
6
3
  # The Application class is the global state tracking mechanism
7
4
  # for your single page application, as well as the entry point.
8
- #
9
- # By default it contains a main controller which is a Luca.components.Controller instance.
10
- #
11
- # In a typical Luca application, the router will use the applications @navigate_to() method to switch
12
- # from page to page on the main controller, or any other controllers nested inside of it.
13
- #
14
- # You would control flow when the controller fires activation events on the nested view components inside of it.
15
- #
16
- # Decoupling application control flow from the URL Fragment from Backbone.History and preventing
17
- # your components from directly caring about the URL Fragment, allows you to build applications as
18
- # isolated components which can run separately or nested inside of other applications.
19
- application.defines
5
+ application = Luca.register "Luca.Application"
6
+ application.extends "Luca.containers.Viewport"
7
+
8
+ application.triggers "controller:change",
9
+ "action:change"
10
+
11
+ application.publicInterface
20
12
  name: "MyApp"
21
13
 
22
14
  # The Application uses a Backbone.Model as a state machine, which
@@ -49,6 +41,7 @@ application.defines
49
41
  # just pass a reference to the class you would like to use.
50
42
  collectionManagerClass: "Luca.CollectionManager"
51
43
 
44
+
52
45
  # Luca plugin apps are apps which mount onto existing
53
46
  # luca apps, and will not have the behavior of a main
54
47
  # app which acts as a singleton
@@ -90,34 +83,46 @@ application.defines
90
83
  # will get wrapped by the main controller unless you
91
84
  # set useController = false
92
85
  components:[
93
- ctype: 'template'
86
+ type: 'template'
94
87
  name: 'welcome'
95
88
  template: 'sample/welcome'
96
89
  templateContainer: "Luca.templates"
97
90
  ]
98
91
 
92
+ # DOCUMENT
93
+ createRoleBasedGetters: false
94
+ useSocketManager: false
95
+ socketManagerOptions: {}
96
+
97
+ # Don't create getters on this component
98
+ # for the nested components
99
99
  initialize: (@options={})->
100
100
  app = @
101
101
  appName = @name
102
102
  alreadyRunning = Luca.getApplication?()
103
103
 
104
- Luca.Application.instances ||= {}
105
- Luca.Application.instances[ appName ] = app
104
+ Luca.Application.registerInstance(@)
106
105
 
107
- Luca.containers.Viewport::initialize.apply @, arguments
106
+ Luca.concerns.StateModel.__initializer.call(@)
107
+
108
+ # The Collection Manager is responsible for managing instances
109
+ # of collections, usually to guarantee only a single collection is
110
+ # instantiated for a given resource, to maintain 'authoritative'
111
+ # representations of models.
112
+ @setupCollectionManager()
108
113
 
109
- @state = new Luca.Model( @defaultState )
114
+ # Socket Manager provides a bridge between remote pub/sub providers and
115
+ # the backbone.events interface on various components in the system.
116
+ @setupSocketManager()
117
+
118
+ Luca.containers.Viewport::initialize.apply @, arguments
110
119
 
111
120
  # The Controller is the piece of the application that handles showing
112
121
  # and hiding 'pages' of the app. The Application has a navigate_to
113
122
  # method which delegates to the controller, and allows you to navigate
114
123
  # to a given page, or component, by its name. The controller integrates
115
124
  # with the state machine of the application
116
- @setupMainController() if @useController is true
117
-
118
- # The Collection Manager is responsible
119
- @setupCollectionManager()
120
-
125
+ @setupMainController() if @useController is true
121
126
  # we will render when all of the various components
122
127
  # which handle our data dependencies determine that
123
128
  # we are ready
@@ -156,6 +161,8 @@ application.defines
156
161
  window[ appName ] = app
157
162
  app.boot()
158
163
 
164
+ Luca.trigger "application:available", @
165
+
159
166
  # @activeView() returns a reference to the instance of the view
160
167
  # which is currently monopolizing the viewport.
161
168
  #
@@ -191,6 +198,9 @@ application.defines
191
198
  # of the views
192
199
  boot: ()->
193
200
  @trigger "ready"
201
+ for service in [@collectionManager, @socket, @router]
202
+ console.log "Trigggering Ready On", service
203
+ service?.trigger("ready")
194
204
 
195
205
  # delegate to the collection manager's get or create function.
196
206
  # use App.collection() to create or access existing collections
@@ -212,11 +222,7 @@ application.defines
212
222
  navigate_to: (component_name, callback)->
213
223
  @getMainController().navigate_to(component_name, callback)
214
224
 
215
- getMainController: ()->
216
- return @components[0] if @useController is true
217
- Luca.cache('main_controller')
218
-
219
- #
225
+ application.privateInterface
220
226
  keyHandler: (e)->
221
227
  return unless e and @keyEvents
222
228
 
@@ -248,16 +254,16 @@ application.defines
248
254
  # the active card on the global state chart
249
255
  @getMainController()?.bind "after:card:switch", (previous,current)=>
250
256
  @state.set(active_section:current.name)
251
- app.trigger "page:change"
257
+ app.trigger "controller:change", previous.name, current.name
252
258
 
253
259
  # any time the card switches on one of the sub controllers
254
260
  # then we should track the active sub section on the global state chart
255
261
  @getMainController()?.each (component)=>
256
- type = component.type || component.type
262
+ type = component.type || component.ctype
257
263
  if type.match(/controller$/)
258
264
  component.bind "after:card:switch", (previous,current)=>
259
265
  @state.set(active_sub_section:current.name)
260
- app.trigger "sub:page:change"
266
+ app.trigger "action:change", previous.name, current.name
261
267
 
262
268
  setupMainController: ()->
263
269
  if @useController is true
@@ -266,8 +272,11 @@ application.defines
266
272
  @components = [
267
273
  type: 'controller'
268
274
  name: "main_controller"
275
+ role: "main_controller"
269
276
  components: definedComponents
270
277
  ]
278
+
279
+ @getMainController = ()=> @findComponentByRole('main_controller')
271
280
 
272
281
  @defer( @setupControllerBindings, false ).until("after:components")
273
282
 
@@ -296,26 +305,46 @@ application.defines
296
305
  collectionManagerOptions =
297
306
  name: @collectionManager
298
307
 
308
+
299
309
  # let's try and get the collection manager by name if we can
300
310
  @collectionManager = Luca.CollectionManager.get?( collectionManagerOptions.name )
301
311
 
302
312
  # if we can't, then we will have to create one ourselves
303
313
  unless _.isFunction(@collectionManager?.get)
314
+ collectionManagerOptions.autoStart = false
304
315
  @collectionManager = new @collectionManagerClass( collectionManagerOptions )
305
316
 
317
+ setupSocketManager: ()->
318
+ return if _.isEmpty(@socketManagerOptions)
319
+ _.extend(@socketManagerOptions, autoStart: false)
320
+
321
+ @socket = new Luca.SocketManager(@socketManagerOptions)
322
+
306
323
  setupRouter: ()->
307
- app = @
324
+ return if not @router? and not @routes?
325
+
326
+ routerClass = Luca.Router
327
+ routerClass = Luca.util.resolve(@router) if _.isString(@router)
328
+
329
+ routerConfig = routerClass.prototype
330
+ routerConfig.routes ||= {}
331
+ routerConfig.app = @
308
332
 
309
- if _.isString( @router )
310
- routerClass = Luca.util.resolve(@router)
311
- @router = new routerClass({app})
333
+ if _.isObject( @routes )
334
+ for routePattern, endpoint of @routes
335
+ [page, action] = endpoint.split(' ')
336
+ fn = _.uniqueId(page)
337
+ routerConfig[fn] = Luca.Application.routeTo(page).action(action)
338
+ routerConfig.routes[ routePattern ] = fn
339
+
340
+ @router = new routerClass(routerConfig)
312
341
 
313
342
  # if this application has a router associated with it
314
343
  # then we need to start backbone history on a certain event.
315
344
  # you can control which by setting the @startHistoryOn property
316
345
  if @router and @autoStartHistory
317
346
  @autoStartHistory = "before:render" if @autoStartHistory is true
318
- @defer( Luca.util.startHistory, false).until(@, @autoStartHistory)
347
+ @defer( Luca.Application.startHistory, false).until(@, @autoStartHistory)
319
348
 
320
349
  setupKeyHandler: ()->
321
350
  return unless @keyEvents
@@ -330,5 +359,89 @@ application.defines
330
359
  for keyEvent in (@keypressEvents || ["keydown"])
331
360
  $( document ).on( keyEvent, handler )
332
361
 
333
- Luca.util.startHistory = ()->
334
- Backbone.history.start()
362
+ application.classInterface
363
+ instances:{}
364
+
365
+ # Public: For purely informational purposes, describes the structure
366
+ # of the Application's controller views, and their nested controllers views.
367
+ pageHierarchy: ()->
368
+ app = Luca()
369
+ mainController = app.getMainController()
370
+
371
+ getTree = (node)->
372
+ return {} unless node.components? or node.pages?
373
+
374
+ _( node.components || node.pages ).reduce (memo, page)->
375
+ memo[ page.name ] = page.name
376
+ memo[ page.name ] = getTree(page) if page.navigate_to?
377
+ memo
378
+ , {}
379
+
380
+ getTree( mainController )
381
+
382
+ # Private: registers the instance of the Luca.Appliction
383
+ # so that it is available via the Luca() helper, or through
384
+ # a call to Luca.Application.get() or Luca.getAppliction()
385
+ registerInstance: (app)->
386
+ Luca.Application.instances[ app.name ] = app
387
+
388
+ # Private: Recursively navigates down the controller page hierarchy
389
+ # to the page you specify by name. You can specify the
390
+ # method which is to be called at the end of the chain.
391
+ #
392
+ # This is used internally by the Application as it sets up
393
+ # the @routes property and uses it to configure the Luca.Router
394
+ # instance for your app.
395
+ routeTo: (pages...)->
396
+ last = _( pages ).last()
397
+ first = _( pages ).first()
398
+
399
+ callback = undefined
400
+ specifiedAction = undefined
401
+
402
+ routeHelper = (args...)->
403
+ path = @app || Luca()
404
+ index = 0
405
+
406
+ # we can specify a page by name, and not have to know its full path
407
+ if pages.length is 1 and target = Luca(first)
408
+ pages = target.controllerPath()
409
+
410
+ # when we do know the full path
411
+ for page in pages when _.isString(page)
412
+ nextItem = pages[++index]
413
+ target = Luca(page)
414
+
415
+ if page is last
416
+ callback = if specifiedAction? and target[ specifiedAction ]?
417
+ _.bind(target[ specifiedAction ], target)
418
+ else if target.routeHandler?
419
+ target.routeHandler
420
+
421
+ callback ||= if _.isFunction(nextItem)
422
+ _.bind(nextItem, target)
423
+ else if _.isObject(nextItem)
424
+ if action = nextItem.action and target[action]?
425
+ _.bind(target[action], target)
426
+
427
+ path = path.navigate_to page, ()->
428
+ callback?.apply(target, args)
429
+
430
+ routeHelper.action = (action)->
431
+ specifiedAction = action
432
+ routeHelper
433
+
434
+ routeHelper
435
+
436
+ # Public: you can override Luca.Application.startHistory to
437
+ # modify how Backbone.history.start is called. This will get called
438
+ # by the Application instance in response to the @autoStartHistory property.
439
+ startHistory: ()->
440
+ Backbone.history.start()
441
+
442
+
443
+
444
+ application.afterDefinition ()->
445
+ Luca.routeHelper = Luca.Application.routeTo
446
+
447
+ application.register()
@@ -1,7 +1,7 @@
1
- _.def('Luca.components.Toolbar').extends('Luca.core.Container').with
1
+ _.def('Luca.components.Toolbar').extends('Luca.Container').with
2
2
 
3
3
  toolbar = Luca.register "Luca.components.Toolbar"
4
- toolbar.extends "Luca.core.Container"
4
+ toolbar.extends "Luca.Container"
5
5
 
6
6
  toolbar.defines
7
7
  className: 'luca-ui-toolbar toolbar'