luca 0.9.8 → 0.9.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (310) hide show
  1. data/CHANGELOG +49 -0
  2. data/Gemfile +8 -1
  3. data/Gemfile.lock +97 -53
  4. data/Guardfile +3 -25
  5. data/README.md +5 -16
  6. data/ROADMAP +15 -9
  7. data/Rakefile +24 -75
  8. data/app.rb +10 -42
  9. data/app/assets/javascripts/luca/basic.coffee +1 -1
  10. data/app/assets/javascripts/luca/components/application.coffee +187 -104
  11. data/app/assets/javascripts/luca/components/collection_view.coffee +115 -51
  12. data/app/assets/javascripts/luca/components/controller.coffee +87 -10
  13. data/app/assets/javascripts/luca/components/fields/base.coffee +74 -13
  14. data/app/assets/javascripts/luca/components/fields/button_field.coffee +60 -13
  15. data/app/assets/javascripts/luca/components/fields/checkbox_array.coffee +12 -7
  16. data/app/assets/javascripts/luca/components/fields/select_field.coffee +82 -23
  17. data/app/assets/javascripts/luca/components/fields/text_area_field.coffee +25 -10
  18. data/app/assets/javascripts/luca/components/fields/text_field.coffee +9 -3
  19. data/app/assets/javascripts/luca/components/form_view.coffee +105 -33
  20. data/app/assets/javascripts/luca/components/grid_layout_view.coffee +42 -0
  21. data/app/assets/javascripts/luca/components/index.coffee +6 -0
  22. data/app/assets/javascripts/luca/components/nav_bar.coffee +60 -6
  23. data/app/assets/javascripts/luca/components/page.coffee +70 -0
  24. data/app/assets/javascripts/luca/components/simple_collection_view.coffee +10 -0
  25. data/app/assets/javascripts/luca/components/table_view.coffee +7 -3
  26. data/app/assets/javascripts/luca/components/table_view_scrollable.coffee +23 -0
  27. data/app/assets/javascripts/luca/concerns/collection_event_bindings.coffee +4 -1
  28. data/app/assets/javascripts/luca/concerns/development_tool_helpers.coffee +23 -14
  29. data/app/assets/javascripts/luca/concerns/dom_helpers.coffee +2 -2
  30. data/app/assets/javascripts/luca/concerns/filterable.coffee +8 -11
  31. data/app/assets/javascripts/luca/concerns/form_model_bindings.coffee +20 -0
  32. data/app/assets/javascripts/luca/concerns/modal_view.coffee +40 -15
  33. data/app/assets/javascripts/luca/concerns/query_collection_bindings.coffee +7 -1
  34. data/app/assets/javascripts/luca/concerns/state_model.coffee +40 -26
  35. data/app/assets/javascripts/luca/concerns/templating.coffee +3 -1
  36. data/app/assets/javascripts/luca/config.coffee +5 -0
  37. data/app/assets/javascripts/luca/containers/card_view.coffee +87 -52
  38. data/app/assets/javascripts/luca/containers/container.coffee +305 -108
  39. data/app/assets/javascripts/luca/containers/modal_view.coffee +9 -9
  40. data/app/assets/javascripts/luca/containers/page_controller.coffee +25 -0
  41. data/app/assets/javascripts/luca/containers/panel_toolbar.coffee +5 -6
  42. data/app/assets/javascripts/luca/containers/tab_view.coffee +19 -10
  43. data/app/assets/javascripts/luca/containers/viewport.coffee +12 -16
  44. data/app/assets/javascripts/luca/core/collection.coffee +19 -5
  45. data/app/assets/javascripts/luca/core/events.coffee +5 -5
  46. data/app/assets/javascripts/luca/core/model.coffee +1 -1
  47. data/app/assets/javascripts/luca/core/panel.coffee +18 -6
  48. data/app/assets/javascripts/luca/core/registry/component_definition.coffee +2 -1
  49. data/app/assets/javascripts/luca/core/registry/meta_data.coffee +2 -0
  50. data/app/assets/javascripts/luca/core/registry/registry.coffee +14 -11
  51. data/app/assets/javascripts/luca/core/templates.coffee +5 -1
  52. data/app/assets/javascripts/luca/core/view.coffee +200 -47
  53. data/app/assets/javascripts/luca/dependencies.coffee +2 -0
  54. data/app/assets/javascripts/luca/development/code_sync_manager.coffee +173 -0
  55. data/app/assets/javascripts/luca/development/component.coffee +76 -0
  56. data/app/assets/javascripts/luca/development/components.coffee +57 -0
  57. data/app/assets/javascripts/luca/development/console.coffee +1 -1
  58. data/app/assets/javascripts/luca/development/index.coffee +4 -1
  59. data/app/assets/javascripts/luca/framework.coffee +7 -3
  60. data/app/assets/javascripts/luca/index.coffee +2 -1
  61. data/app/assets/javascripts/luca/managers/collection_manager.coffee +2 -3
  62. data/app/assets/javascripts/luca/managers/index.coffee +1 -1
  63. data/app/assets/javascripts/luca/managers/socket_manager.coffee +31 -8
  64. data/app/assets/javascripts/luca/templates/components/nav_bar.jst.ejs +16 -1
  65. data/app/assets/javascripts/luca/templates/containers/tab_view.jst.ejs +1 -1
  66. data/app/assets/javascripts/luca/util/index.coffee +1 -0
  67. data/app/assets/javascripts/luca/util/keybindings.coffee +24 -0
  68. data/app/assets/javascripts/luca/util/logging.coffee +15 -0
  69. data/app/assets/javascripts/luca/util/luca.coffee +9 -1
  70. data/app/assets/stylesheets/luca/components/table_view.scss +85 -0
  71. data/app/assets/stylesheets/luca/components/viewport.scss +0 -4
  72. data/app/assets/stylesheets/luca/containers/container.scss +8 -0
  73. data/app/assets/stylesheets/luca/index.css +2 -2
  74. data/bin/luca +14 -0
  75. data/config.ru +1 -2
  76. data/docs/framework.json +1 -0
  77. data/docs/luca-framework-documentation.js +1 -0
  78. data/docs/{application.md → old/application.md} +0 -0
  79. data/docs/{collection.md → old/collection.md} +0 -0
  80. data/docs/{collection_manager.md → old/collection_manager.md} +0 -0
  81. data/docs/{container_philosophy.md → old/container_philosophy.md} +0 -0
  82. data/docs/{event_binding_helpers.md → old/event_binding_helpers.md} +0 -0
  83. data/docs/{method_caching_and_computed_properties.md → old/method_caching_and_computed_properties.md} +0 -0
  84. data/docs/{view.md → old/view.md} +0 -0
  85. data/lib/generators/luca/application/templates/javascripts/dependencies.coffee +2 -5
  86. data/lib/guard/luca.rb +84 -0
  87. data/lib/luca.rb +25 -1
  88. data/lib/luca/asset_compiler.rb +117 -0
  89. data/lib/luca/cli.rb +68 -0
  90. data/lib/luca/cli/generate.rb +37 -0
  91. data/lib/luca/cli/server.rb +20 -0
  92. data/lib/luca/cli/sync.rb +40 -0
  93. data/lib/luca/cli/watch.rb +16 -0
  94. data/lib/luca/collection.rb +64 -0
  95. data/lib/luca/collection/endpoint.rb +38 -0
  96. data/lib/luca/collection/file_backend.rb +121 -0
  97. data/lib/luca/collection/redis_backend.rb +153 -0
  98. data/lib/luca/compiled_asset.rb +61 -0
  99. data/lib/luca/component_definition.rb +356 -0
  100. data/lib/luca/luca_application.rb +258 -0
  101. data/lib/luca/project.rb +73 -0
  102. data/lib/luca/project_harness.rb +96 -0
  103. data/lib/luca/rails.rb +5 -3
  104. data/lib/luca/rails/engine.rb +8 -0
  105. data/lib/luca/rails/version.rb +1 -2
  106. data/lib/luca/server.rb +7 -0
  107. data/lib/luca/stylesheet.rb +35 -0
  108. data/lib/luca/template.rb +2 -0
  109. data/lib/luca/template_asset.rb +64 -0
  110. data/lib/luca/version.rb +3 -0
  111. data/lib/luca/watcher.rb +72 -0
  112. data/lib/railties/luca/tasks.rake +7 -0
  113. data/site/.bundle/config +2 -0
  114. data/site/.gitignore +5 -0
  115. data/site/.rvmrc +1 -0
  116. data/site/CHANGELOG.md +41 -0
  117. data/site/DOCS.md +41 -0
  118. data/site/Gemfile +8 -0
  119. data/site/Gemfile.lock +134 -0
  120. data/site/LICENSE.md +19 -0
  121. data/site/config.rb +84 -0
  122. data/site/helpers/site_helpers.rb +20 -0
  123. data/site/html5bp-docs/README.md +38 -0
  124. data/site/html5bp-docs/contribute.md +104 -0
  125. data/site/html5bp-docs/crossdomain.md +21 -0
  126. data/site/html5bp-docs/css.md +135 -0
  127. data/site/html5bp-docs/extend.md +507 -0
  128. data/site/html5bp-docs/faq.md +77 -0
  129. data/site/html5bp-docs/htaccess.md +323 -0
  130. data/site/html5bp-docs/html.md +170 -0
  131. data/site/html5bp-docs/js.md +31 -0
  132. data/site/html5bp-docs/misc.md +25 -0
  133. data/site/html5bp-docs/usage.md +109 -0
  134. data/site/readme.md +47 -0
  135. data/site/source/.htaccess +540 -0
  136. data/site/source/404.html +157 -0
  137. data/site/source/app/assets/javascripts/dependencies.js.coffee +6 -0
  138. data/site/source/app/assets/javascripts/docs-docs.js +1 -0
  139. data/site/source/app/assets/javascripts/docs/application.coffee +64 -0
  140. data/site/source/app/assets/javascripts/docs/collections/docs_documentation.coffee +17 -0
  141. data/site/source/app/assets/javascripts/docs/collections/github_repositories.coffee +7 -0
  142. data/site/source/app/assets/javascripts/docs/collections/index.coffee +1 -0
  143. data/site/source/app/assets/javascripts/docs/collections/luca_documentation.coffee +17 -0
  144. data/site/source/app/assets/javascripts/docs/collections/public_gists.coffee +4 -0
  145. data/site/source/app/assets/javascripts/docs/config.coffee +5 -0
  146. data/site/source/app/assets/javascripts/docs/index.coffee +12 -0
  147. data/site/source/app/assets/javascripts/docs/lib/router.coffee +3 -0
  148. data/{spec/components/application_spec.coffee → site/source/app/assets/javascripts/docs/lib/util.coffee} +0 -0
  149. data/site/source/app/assets/javascripts/docs/models/component.coffee +99 -0
  150. data/site/source/app/assets/javascripts/docs/models/github_repository.coffee +3 -0
  151. data/site/source/app/assets/javascripts/docs/models/index.coffee +1 -0
  152. data/site/source/app/assets/javascripts/docs/templates/component_documentation.jst.ejs +55 -0
  153. data/site/source/app/assets/javascripts/docs/templates/examples_browser/overview.jst.ejs +4 -0
  154. data/site/source/app/assets/javascripts/docs/templates/examples_browser/selector.jst.ejs +11 -0
  155. data/site/source/app/assets/javascripts/docs/templates/github_repository.jst.ejs +4 -0
  156. data/site/source/app/assets/javascripts/docs/templates/layouts/main.jst.ejs +4 -0
  157. data/site/source/app/assets/javascripts/docs/templates/left_navigation.jst.ejs +5 -0
  158. data/site/source/app/assets/javascripts/docs/templates/pages/getting_started.jst.ejs +78 -0
  159. data/site/source/app/assets/javascripts/docs/templates/pages/home.jst.ejs +57 -0
  160. data/site/source/app/assets/javascripts/docs/views/components/code_editor.coffee +45 -0
  161. data/{spec/components/collection_loader_view_spec.coffee → site/source/app/assets/javascripts/docs/views/components/code_editor/index.coffee} +0 -0
  162. data/site/source/app/assets/javascripts/docs/views/components/component_documentation.coffee +72 -0
  163. data/site/source/app/assets/javascripts/docs/views/index.coffee +3 -0
  164. data/site/source/app/assets/javascripts/docs/views/pages/browse_source.coffee +46 -0
  165. data/site/source/app/assets/javascripts/docs/views/pages/browse_source/details.coffee +37 -0
  166. data/site/source/app/assets/javascripts/docs/views/pages/browse_source/list.coffee +31 -0
  167. data/site/source/app/assets/javascripts/docs/views/pages/component_editor.coffee +10 -0
  168. data/site/source/app/assets/javascripts/docs/views/pages/examples_browser.coffee +102 -0
  169. data/site/source/app/assets/javascripts/docs/views/pages/examples_browser/docs.coffee +12 -0
  170. data/site/source/app/assets/javascripts/docs/views/pages/examples_browser/source.coffee +13 -0
  171. data/site/source/app/assets/javascripts/docs/views/pages/home.coffee +10 -0
  172. data/site/source/app/assets/javascripts/docs/views/views/api_browser/index.coffee +43 -0
  173. data/site/source/app/assets/javascripts/docs/views/views/collection_view_examples/grid_layout_view_example.coffee +14 -0
  174. data/site/source/app/assets/javascripts/docs/views/views/collection_view_examples/table_view_example.coffee +39 -0
  175. data/site/source/app/assets/javascripts/docs/views/views/form_view_examples/basic_example.coffee +38 -0
  176. data/site/source/app/assets/javascripts/docs/views/views/form_view_examples/complex_layout.coffee +110 -0
  177. data/site/source/app/assets/javascripts/docs/views/views/top_navigation.coffee +6 -0
  178. data/site/source/app/assets/javascripts/luca-docs.js +1 -0
  179. data/site/source/app/assets/javascripts/luca-framework-documentation.js +1 -0
  180. data/site/source/app/assets/javascripts/site.js.coffee +4 -0
  181. data/site/source/app/assets/javascripts/vendor/codemirror.js +4786 -0
  182. data/site/source/app/assets/javascripts/vendor/coffeescript.js +346 -0
  183. data/site/source/app/assets/javascripts/vendor/css.js +465 -0
  184. data/site/source/app/assets/javascripts/vendor/htmlmixed.js +84 -0
  185. data/site/source/app/assets/javascripts/vendor/javascript.js +422 -0
  186. data/site/source/app/assets/javascripts/vendor/js-beautify.js +1353 -0
  187. data/site/source/app/assets/javascripts/vendor/modernizr-2.6.1.min.js +4 -0
  188. data/site/source/app/assets/javascripts/vendor/vim.js +2511 -0
  189. data/site/source/app/assets/stylesheets/docs/api-browser.css.scss +5 -0
  190. data/site/source/app/assets/stylesheets/docs/application.css.scss +35 -0
  191. data/site/source/app/assets/stylesheets/docs/browse-source.css.scss +5 -0
  192. data/site/source/app/assets/stylesheets/docs/scrollable-table.css.scss +5 -0
  193. data/site/source/app/assets/stylesheets/site.css.scss +2 -0
  194. data/site/source/app/assets/stylesheets/vendor/codemirror.css +240 -0
  195. data/site/source/app/assets/stylesheets/vendor/prettify-tomorrow-night-bright.css +160 -0
  196. data/site/source/app/assets/stylesheets/vendor/twilight.css +26 -0
  197. data/site/source/crossdomain.xml +15 -0
  198. data/site/source/documentation.html.haml +1 -0
  199. data/site/source/favicon_base.png +0 -0
  200. data/site/source/humans.txt +15 -0
  201. data/site/source/images/background.png +0 -0
  202. data/site/source/images/middleman.png +0 -0
  203. data/site/source/index.html.haml +1 -0
  204. data/site/source/layouts/layout.haml +55 -0
  205. data/site/source/readme.md +63 -0
  206. data/site/source/robots.txt +3 -0
  207. data/spec/{components/grid_view_spec.coffee → javascripts/components/application_spec.coffee} +0 -0
  208. data/spec/{components/pagination_control_spec.coffee → javascripts/components/collection_loader_view_spec.coffee} +0 -0
  209. data/spec/{components → javascripts/components}/collection_view_spec.coffee +1 -1
  210. data/spec/{components → javascripts/components}/controller_spec.coffee +0 -0
  211. data/spec/{components → javascripts/components}/fields/checkbox_array_spec.coffee +0 -0
  212. data/spec/javascripts/components/form_view_spec.coffee +162 -0
  213. data/spec/{components/record_manager_spec.coffee → javascripts/components/grid_view_spec.coffee} +0 -0
  214. data/spec/{components → javascripts/components}/multi_collection_view_spec.coffee +0 -0
  215. data/spec/{components/template_spec.coffee → javascripts/components/pagination_control_spec.coffee} +0 -0
  216. data/spec/{concerns/paginatable_spec.coffee → javascripts/components/record_manager_spec.coffee} +0 -0
  217. data/spec/{components → javascripts/components}/table_view_spec.coffee +0 -0
  218. data/spec/{containers/modal_view_spec.coffee → javascripts/components/template_spec.coffee} +0 -0
  219. data/spec/{concerns → javascripts/concerns}/collection_event_bindings_spec.coffee +0 -0
  220. data/spec/{concerns → javascripts/concerns}/dom_helpers_spec.coffee +0 -0
  221. data/spec/{concerns → javascripts/concerns}/filterable_spec.coffee +0 -0
  222. data/spec/{concerns → javascripts/concerns}/model_presenter_spec.coffee +0 -0
  223. data/spec/{containers/panel_view_spec.coffee → javascripts/concerns/paginatable_spec.coffee} +0 -0
  224. data/spec/{concerns → javascripts/concerns}/state_model_spec.coffee +5 -0
  225. data/spec/javascripts/containers/card_view_spec.coffee +108 -0
  226. data/spec/{containers/tab_view_spec.coffee → javascripts/containers/modal_view_spec.coffee} +0 -0
  227. data/spec/{containers/viewport_spec.coffee → javascripts/containers/panel_view_spec.coffee} +0 -0
  228. data/spec/{core/observer_spec.coffee → javascripts/containers/tab_view_spec.coffee} +0 -0
  229. data/spec/{managers/socket_manager_spec.coffee → javascripts/containers/viewport_spec.coffee} +0 -0
  230. data/spec/{core → javascripts/core}/collection_spec.coffee +1 -1
  231. data/spec/{core → javascripts/core}/concerns_spec.coffee +0 -0
  232. data/spec/{core → javascripts/core}/container_spec.coffee +0 -0
  233. data/spec/{core → javascripts/core}/define_spec.coffee +0 -0
  234. data/spec/{core → javascripts/core}/events_spec.coffee +0 -0
  235. data/spec/{core → javascripts/core}/field_spec.coffee +0 -0
  236. data/spec/{core → javascripts/core}/framework_spec.coffee +0 -0
  237. data/spec/{core → javascripts/core}/model_spec.coffee +0 -0
  238. data/spec/javascripts/core/observer_spec.coffee +0 -0
  239. data/spec/{core → javascripts/core}/util_spec.coffee +0 -0
  240. data/spec/{core → javascripts/core}/view_spec.coffee +51 -39
  241. data/spec/{dependencies → javascripts/dependencies}/index.coffee +0 -0
  242. data/spec/{dependencies → javascripts/dependencies}/jasmine-html.js +0 -0
  243. data/spec/{dependencies → javascripts/dependencies}/jasmine.js +0 -0
  244. data/spec/{dependencies → javascripts/dependencies}/sinon.js +0 -0
  245. data/spec/{helper.coffee → javascripts/helper.coffee} +0 -0
  246. data/spec/{managers → javascripts/managers}/collection_manager_spec.coffee +0 -0
  247. data/spec/javascripts/managers/socket_manager_spec.coffee +0 -0
  248. data/spec/lib/component_definition_spec.rb +63 -0
  249. data/spec/lib/input_compiler_spec.rb +9 -0
  250. data/spec/lib/luca_application_spec.rb +30 -0
  251. data/spec/support/fixtures/application.coffee +45 -0
  252. data/spec/support/fixtures/component.coffee +34 -0
  253. data/tutorials/component-definitions.md +0 -0
  254. data/tutorials/component-definitions/01_intro.md +0 -0
  255. data/tutorials/component-driven-design.md +140 -0
  256. data/tutorials/structure-of-a-project.md +63 -0
  257. data/vendor/assets/javascripts/backbone-min.js +37 -33
  258. data/vendor/assets/javascripts/backbone-query.min.js +1 -1
  259. data/vendor/assets/javascripts/hogan.js +707 -0
  260. data/vendor/assets/javascripts/jquery.js +5 -4
  261. data/vendor/assets/javascripts/keymaster.min.js +4 -0
  262. data/vendor/assets/javascripts/luca-dependencies.min.js +8 -0
  263. data/vendor/assets/javascripts/luca-development.min.js +1 -0
  264. data/vendor/assets/javascripts/luca-spec.js +6 -6
  265. data/vendor/assets/javascripts/luca-ui.js +7386 -0
  266. data/vendor/assets/javascripts/luca-ui.min.js +5 -0
  267. data/vendor/assets/javascripts/luca.full.min.js +12 -0
  268. data/vendor/assets/javascripts/luca.min.js +5 -0
  269. data/vendor/assets/javascripts/underscore-min.js +1 -5
  270. data/vendor/assets/javascripts/underscore-string.min.js +1 -1
  271. data/vendor/assets/stylesheets/luca-components.css +202 -0
  272. data/vendor/assets/stylesheets/luca-development.css +23 -0
  273. data/vendor/assets/stylesheets/luca-ui.css +198 -0
  274. metadata +324 -94
  275. data/app/assets/javascripts/luca/components/base_toolbar.coffee +0 -17
  276. data/app/assets/javascripts/luca/components/form_button_toolbar.coffee +0 -28
  277. data/app/assets/javascripts/luca/components/grid_view.coffee +0 -269
  278. data/app/assets/javascripts/luca/components/page_controller.coffee +0 -7
  279. data/app/assets/javascripts/luca/components/template.coffee +0 -5
  280. data/app/assets/javascripts/luca/components/toolbar_dialog.coffee +0 -25
  281. data/lib/luca/code_browser.rb +0 -55
  282. data/lib/luca/command_line.rb +0 -69
  283. data/lib/luca/component_documentation.rb +0 -72
  284. data/site/assets/bootstrap.min.js +0 -7
  285. data/site/assets/dependencies.js +0 -94
  286. data/site/assets/glyphicons-halflings-white.png +0 -0
  287. data/site/assets/glyphicons-halflings.png +0 -0
  288. data/site/assets/luca-ui-bootstrap.css +0 -1331
  289. data/site/assets/luca-ui-bootstrap.js +0 -9
  290. data/site/assets/luca-ui-development-tools.css +0 -234
  291. data/site/assets/luca-ui-development-tools.js +0 -18561
  292. data/site/assets/luca-ui-development-tools.min.js +0 -15
  293. data/site/assets/luca-ui-full.min.js +0 -8
  294. data/site/assets/luca-ui.min.js +0 -4
  295. data/site/assets/sandbox.css +0 -62
  296. data/site/assets/sandbox.js +0 -469
  297. data/site/docs/application.html +0 -41
  298. data/site/docs/caching.html +0 -43
  299. data/site/docs/collection.html +0 -75
  300. data/site/docs/collection_manager.html +0 -71
  301. data/site/docs/containers.html +0 -118
  302. data/site/docs/events.html +0 -153
  303. data/site/docs/view.html +0 -128
  304. data/site/img/glyphicons-halflings-white.png +0 -0
  305. data/site/img/glyphicons-halflings.png +0 -0
  306. data/site/index.html +0 -20
  307. data/site/source-map.js +0 -1
  308. data/spec/components/form_view_spec.coffee +0 -84
  309. data/spec/containers/card_view_spec.coffee +0 -50
  310. data/spec/luca-spec.coffee +0 -9
@@ -0,0 +1,76 @@
1
+ model = Luca.register "Luca.models.Component"
2
+ model.extends "Luca.Model"
3
+
4
+ model.configuration
5
+ defaults:
6
+ class_name: undefined
7
+ superClass: undefined
8
+ asset_id: undefined
9
+ source_file_contents: ""
10
+ defined_in_file: ""
11
+
12
+ model.defines
13
+ idAttribute: "class_name"
14
+
15
+ documentation: ()->
16
+ base = _( @toJSON() ).pick 'header_documentation', 'class_name', 'defined_in_file'
17
+
18
+ _.extend base, @metaData(),
19
+ componentGroup: @componentGroup()
20
+ componentType: @componentType()
21
+ componentTypeAlias: @componentTypeAlias()
22
+ details:
23
+ publicMethods: @documentationFor("publicMethods")
24
+ privateMethods: @documentationFor("privateMethods")
25
+ privateProperties: @documentationFor("privateProperties")
26
+ publicProperties: @documentationFor("publicProperties")
27
+
28
+ documentationFor: (methodOrPropertyGroup="publicMethods")->
29
+ documentationSource = _.extend({}, @get("defines_methods"), @get("defines_properties"))
30
+
31
+ result = {}
32
+
33
+ if list = @metaData()?[ methodOrPropertyGroup ]?()
34
+ _(list).reduce (memo, methodOrProperty)->
35
+ memo[ methodOrProperty ] = documentationSource[ methodOrProperty ]
36
+ memo
37
+ , result
38
+
39
+ result
40
+
41
+ url: ()->
42
+ "/project/components/#{ Luca.namespace }/#{ @classNameId() }"
43
+
44
+ metaData: ()->
45
+ Luca( @get("class_name") ).prototype.componentMetaData()
46
+
47
+ classNameId: ()->
48
+ @get("class_name").replace(/\./g,'__')
49
+
50
+ componentGroup: ()->
51
+ parts = @get('class_name').split('.')
52
+ parts.slice(0,2).join('.')
53
+
54
+ componentType: ()->
55
+ type = "view"
56
+ parts = @get('class_name').split('.')
57
+
58
+ switch group = parts[1]
59
+ when "collections" then "collection"
60
+ when "models" then "model"
61
+ when ("views" || "components" || "pages") then "view"
62
+
63
+ return if group?
64
+
65
+ if componentPrototype = Luca.util.resolve( @get("class_name") )
66
+ return "view" if Luca.isViewPrototype( componentPrototype:: )
67
+ return "collection" if Luca.isCollectionPrototype( componentPrototype:: )
68
+ return "model" if Luca.isModelProtoype( componentPrototype:: )
69
+
70
+ # meh, but what about Router?
71
+ "view"
72
+
73
+ componentTypeAlias: ()->
74
+ parts = @get('class_name').split('.')
75
+ name = parts.pop()
76
+ _.str.underscored( name )
@@ -0,0 +1,57 @@
1
+ components = Luca.register "Luca.collections.Components"
2
+ components.extends "Luca.Collection"
3
+
4
+ components.configuration
5
+ model: Luca.models.Component
6
+ namespace: "components"
7
+
8
+ components.classMethods
9
+ generate: ()->
10
+ @collection = new Luca.collections.Components()
11
+ @collection.fetch()
12
+ @collection
13
+
14
+ components.defines
15
+ findByClassName: (class_name)->
16
+ @detect (model)->
17
+ model.get("class_name") is class_name
18
+
19
+ filterByNamespace: (namespace)->
20
+ @query
21
+ class_name: $like: namespace
22
+
23
+ classNames: ()->
24
+ @pluck('class_name')
25
+
26
+ groupsInsideOf: (namespace)->
27
+ classes = @filterByNamespace(namespace)
28
+ unique = {}
29
+
30
+ for component in classes when not unique[ component.componentGroup() ]?
31
+ if component.get("class_name")?.split('.')?.length > 2
32
+ unique[ component.componentGroup() ] = component.componentGroup().split('.')[1]
33
+
34
+ _.values(unique)
35
+
36
+ namespaces: ()->
37
+ list = _( @classNames() ).map (className)->
38
+ className.split('.')[0]
39
+
40
+ _( list ).uniq()
41
+
42
+ fetch: (options={})->
43
+ @populateFromRegistry(options)
44
+
45
+ comparator: (model)->
46
+ model.get("class_name")
47
+
48
+ populateFromRegistry: (options={})->
49
+ registeredClassNames = for class_name in Luca.registry.classes(true)
50
+ {class_name, name: class_name}
51
+
52
+ if options.namespace
53
+ registeredClassNames = for model in registeredClassNames when model.name.match(options.namespace)
54
+ model
55
+
56
+
57
+ @reset(registeredClassNames, options={})
@@ -186,7 +186,7 @@ Luca.util.inspectComponent = (component)->
186
186
 
187
187
  Luca.util.launchers.developmentConsole = (name="luca-development-console")->
188
188
  @_lucaDevConsole = Luca name, ()=>
189
- @$el.append Backbone.View::make("div", id: "#{ name }-wrapper", class: "modal fade large")
189
+ @$el.append Luca.View::make("div", id: "#{ name }-wrapper", class: "modal fade large")
190
190
 
191
191
  dconsole = new Luca.tools.DevelopmentConsole
192
192
  name: name
@@ -1,2 +1,5 @@
1
1
  #= require ./code_mirror_field
2
- #= require ./console
2
+ #= require ./console
3
+ #= require ./code_sync_manager
4
+ #= require ./component
5
+ #= require ./components
@@ -22,7 +22,7 @@ lucaUtilityHelper = (payload, args...)->
22
22
 
23
23
  (window || global).Luca = ()-> lucaUtilityHelper.apply(@, arguments)
24
24
 
25
- Luca.VERSION = '0.9.8'
25
+ Luca.VERSION = '0.9.9'
26
26
 
27
27
  _.extend Luca,
28
28
  core: {}
@@ -63,7 +63,10 @@ Luca.setupCollectionSpace = (options={})->
63
63
  # Creates a basic Namespace for you to begin defining
64
64
  # your application and all of its components.
65
65
  Luca.initialize = (namespace, options={})->
66
- defaults =
66
+ Luca.namespace = namespace.toLowerCase()
67
+ existing = Luca.util.resolve(namespace, window || global) || {}
68
+
69
+ _.defaults existing,
67
70
  views: {}
68
71
  collections: {}
69
72
  models: {}
@@ -83,11 +86,12 @@ Luca.initialize = (namespace, options={})->
83
86
 
84
87
 
85
88
  object = {}
86
- object[ namespace ] = _.extend(Luca.getHelper(), defaults)
89
+ object[ namespace ] = _.defaults(Luca.getHelper(), existing)
87
90
 
88
91
  _.extend(Luca.config, options)
89
92
  _.extend (window || global), object
90
93
 
94
+ Luca.lastNamespace = namespace
91
95
  Luca.concern.namespace "#{ namespace }.concerns"
92
96
  Luca.registry.namespace "#{ namespace }.views"
93
97
  Luca.Collection.namespace "#{ namespace }.collections"
@@ -1,8 +1,9 @@
1
+ #= require_self
1
2
  #= require_tree ./templates
2
3
  #= require ./framework
3
4
  #= require ./config
4
5
  #= require ./util
5
- #= require ./managers
6
6
  #= require ./core
7
+ #= require ./managers
7
8
  #= require ./containers
8
9
  #= require ./components
@@ -88,7 +88,6 @@ class Luca.CollectionManager
88
88
 
89
89
  collectionCountDidChange: ()->
90
90
  if @allCollectionsLoaded()
91
- # for backwards compat
92
91
  @trigger "all_collections_loaded"
93
92
  @trigger "initial:load"
94
93
 
@@ -157,12 +156,12 @@ loadInitialCollections = ()->
157
156
 
158
157
  handleInitialCollections = ()->
159
158
  @state.set({loaded_collections_count: 0, collections_count: @initialCollections.length })
160
- @state.bind "change:loaded_collections_count", ()=> @collectionCountDidChange()
159
+ @state.bind "change:loaded_collections_count", ()=>
160
+ @collectionCountDidChange()
161
161
 
162
162
  if @useProgressLoader
163
163
  @loaderView ||= new Luca.components.CollectionLoaderView(manager: @,name:"collection_loader_view")
164
164
 
165
165
  loadInitialCollections.call(@)
166
166
 
167
- @initialCollectionsLoadedu
168
167
  @
@@ -1,2 +1,2 @@
1
1
  #= require ./collection_manager
2
- #= require ./socket_manager
2
+ #= require ./socket_manager
@@ -1,7 +1,20 @@
1
1
  # The SocketManager provides communication between a Websocket / Pubsub
2
2
  # system and routes messages through the application to instances
3
- # of the
4
- class Luca.SocketManager extends Backbone.Model
3
+ # of a specific view, model, collection, or other Backbone.Events object.
4
+ #
5
+ # You will need to create the socket manager specifying your provider and host:
6
+ # @socket = new Luca.SocketManager(host:"//localhost:9292/faye")
7
+ #
8
+ socketManager = Luca.register "Luca.SocketManager"
9
+ socketManager.extends "Luca.Model"
10
+
11
+ socketManager.defines
12
+ # The SocketManager can be configured with the following options:
13
+ #
14
+ # autoStart: default(true) immediately begins to load the provider
15
+ # script, setup the connection, etc
16
+ #
17
+ # provider: faye.js or socket.io
5
18
  defaults:
6
19
  autoStart: true
7
20
  providerAvailable: false
@@ -9,26 +22,35 @@ class Luca.SocketManager extends Backbone.Model
9
22
  provider: "faye.js"
10
23
 
11
24
  initialize: (@attributes={})->
12
- @loadProviderSource() unless @providerAvailable() is true
25
+ unless @providerLibraryIsAvailable()
26
+ @loadProviderSource()
13
27
 
14
28
  Luca.Model::initialize?.apply(@, arguments)
15
29
 
16
30
  model = @
17
31
 
18
- connectOnReady = ()=> @connect() if @isReady()
32
+ connectOnReady = ()=>
33
+ @connect() if @isReady()
19
34
 
20
- model.on "change", ()->
35
+ model.on "change:ready", ()->
21
36
  connectOnReady()
22
- model.unbind("change", @)
37
+ model.unbind("change:ready", @)
38
+
39
+ model.on "change:providerAvailable", ()->
40
+ connectOnReady()
41
+ model.unbind("change:ready", @)
23
42
 
24
43
  @on "ready", _.once ()=> @set('ready', true)
25
44
 
26
45
  @trigger "change"
27
46
 
47
+ # The socket manager is ready once 'ready' event has been
48
+ # triggered on it. ( usually by the application ). and once
49
+ # the provider client library as been loaded.
28
50
  isReady: ()->
29
51
  @get("ready") is true and @get("providerAvailable") is true
30
52
 
31
- providerAvailable: ()->
53
+ providerLibraryIsAvailable: ()->
32
54
  providerTest = switch @get('provider')
33
55
  when "socket.io"
34
56
  "io"
@@ -42,7 +64,8 @@ class Luca.SocketManager extends Backbone.Model
42
64
  when "socket.io"
43
65
  @client = io.connect( @get('host') )
44
66
  when "faye.js"
45
- @client = new Faye.Client( @get('host') + ( @get('namespace') || "") )
67
+ @client = new Faye.Client(@get('host'))
68
+ @set("client", @client)
46
69
 
47
70
  providerSourceLoaded: ()->
48
71
  @set "providerAvailable", true
@@ -1,4 +1,19 @@
1
1
  <div class="navbar-inner">
2
- <div class="luca-ui-navbar-body container">
2
+ <div class="luca-ui-navbar-body">
3
+ <button type="button" class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
4
+ <span class="icon-bar"></span>
5
+ <span class="icon-bar"></span>
6
+ <span class="icon-bar"></span>
7
+ </button>
8
+
9
+ <a class="brand" href="#">Set @brand</a>
10
+
11
+ <div class="nav-collapse collapse">
12
+ <ul class="nav">
13
+ <li class="active">
14
+ <a href="#">Home</a>
15
+ </li>
16
+ </ul>
17
+ </div>
3
18
  </div>
4
19
  </div>
@@ -1,2 +1,2 @@
1
- <ul id="<%= cid %>-tabs-selector" class="nav <%= navClass %>"></ul>
1
+ <ul id="<%= cid %>-tabs-selector" class="nav nav-tabs"></ul>
2
2
  <div id="<%= cid %>-tab-view-content" class="tab-content"></div>
@@ -1,3 +1,4 @@
1
1
  #= require ./luca
2
2
  #= require ./logging
3
3
  #= require ./deprecations
4
+ #= require ./keybindings
@@ -0,0 +1,24 @@
1
+ # Luca.util.setupKeymaster(config, keyScope).on(view)
2
+ #
3
+ # Keymaster understands the following modifiers:
4
+ # `⇧`, `shift`, `option`, `⌥`, `alt`, `ctrl`, `control`, `command`, and `⌘`.
5
+
6
+ # The following special keys can be used for shortcuts:
7
+ # `backspace`, `tab`, `clear`, `enter`, `return`, `esc`, `escape`, `space`,
8
+ # `up`, `down`, `left`, `right`, `home`, `end`, `pageup`, `pagedown`, `del`, `delete`
9
+ # and `f1` through `f19`.
10
+ Luca.util.setupKeymaster = Luca.util.setupKeyBindings = (config, keyScope="all")->
11
+ unless _.isFunction(Luca.key)
12
+ throw "Keymaster library has not been included."
13
+
14
+ on: (view)->
15
+ view.on "before:remove", ()->
16
+ Luca.key?.deleteScope(keyScope)
17
+
18
+ for key, handler of config
19
+ if _.isString(handler) and _.isFunction(view[handler])
20
+ handler = view[handler]
21
+
22
+ if _.isFunction(handler)
23
+ handler = _.bind(handler, view)
24
+ Luca.key(key, keyScope, handler)
@@ -1,3 +1,18 @@
1
+ Luca.stats = {}
2
+
3
+ Luca.stats.reset = ()-> Luca.__stats = {}
4
+
5
+ Luca.stats.increment = (counter)->
6
+ Luca.__stats ||= {}
7
+ Luca.__stats[counter] ||= 1
8
+ Luca.__stats[counter] = Luca.__stats[counter] + 1
9
+ Luca.__stats[counter]
10
+
11
+ Luca.stats.report = ()->
12
+ console.log "Stats..."
13
+ for key, value of Luca.__stats
14
+ console.log key, value
15
+
1
16
  Luca.warn = (args...)->
2
17
  return unless Luca.config.showWarnings is true
3
18
 
@@ -112,7 +112,8 @@ Luca.util.loadScript = (url, callback) ->
112
112
  script.src = url
113
113
  document.body.appendChild(script)
114
114
 
115
- Luca.util.make = Backbone.View::make
115
+ Luca.util.make = (tagName="div", attributes={}, contents="")->
116
+ Luca.View::make.apply(@, arguments)
116
117
 
117
118
  Luca.util.list = (list,options={},ordered)->
118
119
  container = if ordered then "ol" else "ul"
@@ -144,6 +145,10 @@ Luca.util.setupHooks = (set)->
144
145
  fn = Luca.util.hook( eventId )
145
146
 
146
147
  callback = ()->
148
+ #if @[fn]?
149
+ # Luca.stats.increment("empty:hook")
150
+ #else
151
+ # Luca.stats.increment("valid:hook")
147
152
  @[fn]?.apply @, arguments
148
153
 
149
154
  callback = _.once(callback) if eventId?.match(/once:/)
@@ -181,3 +186,6 @@ Luca.util.rejectBlanks = (object)->
181
186
  processed[key] = value
182
187
 
183
188
  processed
189
+
190
+ Luca.util.enableDropdowns = (selector=".dropdown-toggle")->
191
+ $(selector).dropdown?()
@@ -0,0 +1,85 @@
1
+ /* define height and width of scrollable area. Add 16px to width for scrollbar */
2
+ ._scrollable-wrapper {
3
+ clear: both;
4
+ overflow: auto;
5
+ }
6
+
7
+ /* Reset overflow value to hidden for all non-IE browsers. */
8
+ ._scrollable-wrapper {
9
+ overflow: hidden;
10
+ }
11
+
12
+ /* define width of table. IE browsers only */
13
+ .scrollable-wrapper table {
14
+ }
15
+
16
+ /* define width of table. Add 16px to width for scrollbar. */
17
+ /* All other non-IE browsers. */
18
+ .scrollable-wrapper table {
19
+ }
20
+
21
+ .luca-scrollable-table-view {
22
+
23
+ /* set table header to a fixed position. WinIE 6.x only */
24
+ /* In WinIE 6.x, any element with a position property set to relative and is a child of */
25
+ /* an element that has an overflow property set, the relative value translates into fixed. */
26
+ /* Ex: parent element DIV with a class of tableContainer has an overflow property set to auto */
27
+ thead.fixed tr {
28
+ position: relative
29
+ }
30
+
31
+ /* set THEAD element to have block level attributes. All other non-IE browsers */
32
+ /* this enables overflow to work on TBODY element. All other non-IE, non-Mozilla browsers */
33
+ thead.fixed tr {
34
+ display: block
35
+ }
36
+
37
+ /* make the TH elements pretty */
38
+ thead.fixed th {
39
+ font-weight: bold;
40
+ text-align: left
41
+ }
42
+
43
+ /* make the A elements pretty. makes for nice clickable headers */
44
+ thead.fixed a, thead.fixed a:link, thead.fixed a:visited {
45
+ color: #FFF;
46
+ display: block;
47
+ text-decoration: none;
48
+ width: 100%
49
+ }
50
+
51
+ /* make the A elements pretty. makes for nice clickable headers */
52
+ /* WARNING: swapping the background on hover may cause problems in WinIE 6.x */
53
+ thead.fixed a:hover {
54
+ color: #FFF;
55
+ display: block;
56
+ text-decoration: underline;
57
+ width: 100%
58
+ }
59
+
60
+ /* define the table content to be scrollable */
61
+ /* set TBODY element to have block level attributes. All other non-IE browsers */
62
+ /* this enables overflow to work on TBODY element. All other non-IE, non-Mozilla browsers */
63
+ /* induced side effect is that child TDs no longer accept width: auto */
64
+ tbody.scrollable {
65
+ display: block;
66
+ overflow: auto;
67
+ width: 100%
68
+ }
69
+
70
+ /* define width of TH elements: 1st, 2nd, and 3rd respectively. */
71
+ /* Add 16px to last TH for scrollbar padding. All other non-IE browsers. */
72
+ /* http://www.w3.org/TR/REC-CSS2/selector.html#adjacent-selectors */
73
+ thead.fixed th {
74
+ padding: 5px;
75
+ }
76
+
77
+ /* define width of TD elements: 1st, 2nd, and 3rd respectively. */
78
+ /* All other non-IE browsers. */
79
+ /* http://www.w3.org/TR/REC-CSS2/selector.html#adjacent-selectors */
80
+ tbody.scrollable td {
81
+ padding: 5px;
82
+ }
83
+
84
+ }
85
+