luca 0.9.8 → 0.9.9

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -1,3 +1,9 @@
1
+ # The `Luca.fields.ButtonField` provides an easy way to generate
2
+ # a button element, with an optional icon. Supports all of the
3
+ # available bootstrap icons, and color states.
4
+ #
5
+ # The `Luca.fields.ButtonField` component will typically be used as
6
+ # part of a `Luca.components.FormView` or a `Luca.components.PanelToolbar`.
1
7
  buttonField = Luca.register "Luca.fields.ButtonField"
2
8
 
3
9
  buttonField.extends "Luca.core.Field"
@@ -5,27 +11,62 @@ buttonField.extends "Luca.core.Field"
5
11
  buttonField.triggers "button:click"
6
12
 
7
13
  buttonField.publicConfiguration
8
- readOnly: true
9
- input_value: undefined
10
- input_type: "button"
11
- icon_class: undefined
12
- input_name: undefined
13
- white: undefined
14
+ # Which size should this button be? Valid options are:
15
+ # - none ( default )
16
+ # - large
17
+ # - mini
18
+ # - small
19
+ buttonSize: undefined
20
+
21
+ # Which bootstrap color class should we apply to this button?
22
+ # Valid options are any css button class, or the defaults which
23
+ # ship with bootstrap:
24
+ #
25
+ # - btn-primary
26
+ # - btn-info
27
+ # - btn-success
28
+ # - btn-warning
29
+ # - btn-danger
30
+ # - btn-inverse
31
+ # - btn-link
32
+ class: undefined
33
+
34
+ # specifies the bootstrap icon class you want to use for this button
35
+ # you can use 'icon-ok-sign' or just 'ok-sign'
36
+ icon_class: undefined
37
+
38
+ # specifies the text value of the button
39
+ label: undefined
40
+
41
+ # an alias for label, or input_value. controls which text
42
+ # displays inside of the button
43
+ text: undefined
44
+
45
+ # should we render the white icon?
46
+ white: false
47
+
48
+ buttonField.privateConfiguration
49
+ readOnly: true
50
+ input_value: undefined
51
+ input_type: "button"
52
+ icon_class: undefined
53
+ input_name: undefined
54
+ buttonClasses: ""
14
55
 
15
56
  buttonField.privateConfiguration
16
57
  isButton: true
58
+ autoBindEventHandlers: true
17
59
  template: "fields/button_field"
18
60
  events:
19
- "click input" : "click_handler"
61
+ "click input" : "clickHandler"
20
62
 
21
- buttonField.privateInterface
22
- click_handler: (e)->
63
+ buttonField.privateMethods
64
+ clickHandler: (e)->
23
65
  me = my = $( e.currentTarget )
24
66
  @trigger "button:click"
25
67
 
26
68
  initialize: (@options={})->
27
- _.extend @options
28
- _.bindAll @, "click_handler"
69
+ _.extend @, @options
29
70
 
30
71
  Luca.core.Field::initialize.apply @, arguments
31
72
 
@@ -35,10 +76,16 @@ buttonField.privateInterface
35
76
  @input_id ||= _.uniqueId('button')
36
77
  @input_name ||= @name ||= @input_id
37
78
  @input_value ||= @label ||= @text
38
- @input_class ||= @class
79
+ @input_class ||= @class ||= @buttonClasses
80
+
81
+ if @buttonSize?.length > 0
82
+ @input_class += " #{ buttonSize.replace(/btn-/,'') }"
83
+
39
84
  @icon_class ||= ""
40
85
  @icon_class = "icon-#{ @icon_class }" if @icon_class.length and !@icon_class.match(/^icon-/)
41
86
  @icon_class += " icon-white" if @white
42
87
 
43
- setValue: ()-> true
88
+ setValue: ()->
89
+ true
44
90
 
91
+ buttonField.register()
@@ -1,11 +1,10 @@
1
- make = Luca.View::make
2
-
1
+ # The `Luca.fields.CheckboxArray` renders an array of values
2
+ # into checkbox controls. This is for fields which can have
3
+ # a list of values associated with them.
3
4
  checkboxArray = Luca.register "Luca.fields.CheckboxArray"
4
5
  checkboxArray.extends "Luca.core.Field"
5
6
 
6
- checkboxArray.defines
7
- version: 2
8
-
7
+ checkboxArray.privateConfiguration
9
8
  template: "fields/checkbox_array"
10
9
 
11
10
  className: "luca-ui-checkbox-array"
@@ -15,6 +14,7 @@ checkboxArray.defines
15
14
 
16
15
  selectedItems: []
17
16
 
17
+ checkboxArray.privateMethods
18
18
  initialize: (@options={})->
19
19
  _.extend @, @options
20
20
  _.extend @, Luca.concerns.Deferrable
@@ -65,8 +65,8 @@ checkboxArray.defines
65
65
  label = model.get(@displayField)
66
66
  input_id = _.uniqueId("#{ @cid }_checkbox")
67
67
 
68
- inputElement = make("input",type:"checkbox",class:"array-checkbox",name:@input_name,value:value,id: input_id)
69
- element = make("label", {for:input_id}, inputElement)
68
+ inputElement = @make("input",type:"checkbox",class:"array-checkbox",name:@input_name,value:value,id: input_id)
69
+ element = @make("label", {for:input_id}, inputElement)
70
70
 
71
71
  $( element ).append(" #{ label }")
72
72
  @controls().append( element )
@@ -80,6 +80,9 @@ checkboxArray.defines
80
80
  allFields: ()->
81
81
  @controls().find("input[type='checkbox']")
82
82
 
83
+ checkboxArray.publicMethods
84
+ # Check the selected items. Expects an array of values
85
+ # for boxes you would like to see checked.
83
86
  checkSelected: (items)->
84
87
  @selectedItems = items if items?
85
88
 
@@ -91,6 +94,8 @@ checkboxArray.defines
91
94
 
92
95
  @selectedItems
93
96
 
97
+ # Gets an array of values for the checkboxes in this array
98
+ # which are checked.
94
99
  getValue: ()->
95
100
  @$(field).val() for field in @allFields() when @$(field).prop('checked')
96
101
 
@@ -2,40 +2,86 @@ selectField = Luca.register "Luca.fields.SelectField"
2
2
 
3
3
  selectField.extends "Luca.core.Field"
4
4
 
5
- selectField.triggers "after:select"
5
+ selectField.triggers "after:select",
6
+ "on:change"
6
7
 
7
- selectField.defines
8
- events:
9
- "change select" : "change_handler"
10
-
11
- template: "fields/select_field"
8
+ selectField.publicConfiguration
9
+ # Enables multi-select UI element.
10
+ allowMultiple: false
12
11
 
12
+ # Includes a blank option in addition to all of the items
13
+ # in the underlying collection. Defaults to `true`
13
14
  includeBlank: true
14
15
 
16
+ # determines which value is sent when
17
+ # the blank option is selected?
15
18
  blankValue: ''
16
19
 
20
+ # Determines the text displayed when
21
+ # the blank option is selected
17
22
  blankText: 'Select One'
18
23
 
24
+ # Specifying a value for maxDisplayLength will truncate
25
+ # values displayed in the select field when they reach
26
+ # past a certain point, using the _.str truncate method.
27
+ # Leave at 0 if you want to keep this feature disabled.
28
+ maxDisplayLength: 0
29
+
30
+ # When the underlying collection is reset and we re-render
31
+ # the options elements, should we keep the value that was set
32
+ # on this field prior to that? Defaults to `true` unless otherwise
33
+ # specified.
34
+ retainValue: undefined
35
+
36
+ # Determines which value is rendered in the label element that gets
37
+ # rendered along with this control group.
38
+ label: undefined
39
+
40
+ selectField.privateConfiguration
41
+ template: "fields/select_field"
42
+ events:
43
+ "change select" : "change_handler"
44
+
45
+ selectField.publicMethods
46
+ # sets the value of this select field.
47
+ setValue: (value)->
48
+ @currentValue = value
49
+ Luca.core.Field::setValue.apply @, arguments
50
+
51
+ # returns the value of the select field. runs
52
+ # the value through the getParsedValue method which
53
+ # enforces the valueType type conversion.
54
+ getValue: ()->
55
+ raw = @getInputElement()?.val()
56
+
57
+ if @allowMultiple
58
+ _.map raw, (value)=>
59
+ @getParsedValue(value)
60
+ else
61
+ @getParsedValue(raw)
62
+
63
+ selectField.privateMethods
19
64
  initialize: (@options={})->
20
65
  _.extend @, @options
21
66
  _.extend @, Luca.concerns.Deferrable
22
- _.bindAll @, "change_handler", "populateOptions", "beforeFetch"
67
+ _.bindAll @, "change_handler"
23
68
 
24
69
  if _.isArray(@collection)
25
70
  @collection = data: @collection
26
-
71
+
27
72
  Luca.core.Field::initialize.apply @, arguments
28
73
 
29
74
  @input_id ||= _.uniqueId('field')
30
75
  @input_name ||= @name
31
76
  @valueType ||= Luca.config.idAttributeType if @valueField is "id"
32
77
  @label ||= @name
33
- @retainValue = true if _.isUndefined @retainValue
78
+ @retainValue = true unless @retainValue?
34
79
 
35
80
  afterInitialize: ()->
36
81
  if @collection?.data
37
82
  @valueField ||= "id"
38
83
  @displayField ||= "name"
84
+ @sortOptionsBy ||= @displayField
39
85
  @parseData()
40
86
 
41
87
  try
@@ -43,8 +89,8 @@ selectField.defines
43
89
  catch e
44
90
  console.log "Error Configuring Collection", @, e.message
45
91
 
46
- @collection?.bind "before:fetch", @beforeFetch
47
- @collection?.bind "reset", @populateOptions
92
+ @collection?.bind "before:fetch", @beforeFetch, @
93
+ @collection?.bind "reset", @populateOptions, @
48
94
 
49
95
  # if the select field is configured with a data property
50
96
  # then parse that data into the proper format. either
@@ -69,10 +115,6 @@ selectField.defines
69
115
  else
70
116
  @collection?.trigger("reset")
71
117
 
72
- setValue: (value)->
73
- @currentValue = value
74
- Luca.core.Field::setValue.apply @, arguments
75
-
76
118
  beforeFetch: ()->
77
119
  @resetOptions()
78
120
 
@@ -82,19 +124,36 @@ selectField.defines
82
124
  resetOptions: ()->
83
125
  @getInputElement().html('')
84
126
 
85
- if @includeBlank
127
+ if @allowMultiple
128
+ @getInputElement().attr(multiple: true)
129
+ else if @includeBlank
86
130
  @getInputElement().append("<option value='#{ @blankValue }'>#{ @blankText }</option>")
87
131
 
88
132
  populateOptions: ()->
89
133
  @resetOptions()
90
134
 
91
- if @collection?.each?
92
- @collection.each (model) =>
93
- value = model.get( @valueField )
94
- display = model.get( @displayField )
95
- selected = "selected" if @selected and value is @selected
96
- option = "<option #{ selected } value='#{ value }'>#{ display }</option>"
135
+ if @collection?.length > 0
136
+ if @sortOptionsBy?
137
+ models = @collection.sortBy (model)=>
138
+ if model.read?
139
+ model.read( @sortOptionsBy )
140
+ else
141
+ model.get( @sortOptionsBy )
142
+ else
143
+ models = @collection.models
144
+
145
+ for model in models
146
+ v = model.read?( @valueField ) || model.get(@valueField)
147
+ d = model.read?( @displayField ) || model.get(@displayField)
148
+
149
+ if @maxDisplayLength and @maxDisplayLength > 0
150
+ d = _.str.truncate(d, @maxDisplayLength)
151
+
152
+ selected = "selected" if @selected and v is @selected
153
+ option = "<option #{ selected } value='#{ v }'>#{ d }</option>"
97
154
  @getInputElement().append( option )
98
155
 
99
156
  @trigger "after:populate:options", @
100
- @setValue( @currentValue )
157
+ @setValue( @currentValue )
158
+
159
+ selectField.register()
@@ -1,17 +1,19 @@
1
- _.def('Luca.fields.TextAreaField').extends('Luca.core.Field').with
1
+ textArea = Luca.register "Luca.fields.TextAreaField"
2
+ textArea.extends "Luca.core.Field"
3
+ textArea.defines
4
+ autoBindEventHandlers: true
2
5
 
3
6
  events:
4
- "keydown input" : "keydown_handler"
5
- "blur input" : "blur_handler"
6
- "focus input" : "focus_handler"
7
+ "blur textarea" : "blur_handler"
8
+ "focus textarea" : "focus_handler"
7
9
 
8
10
  template: 'fields/text_area_field'
9
11
 
10
12
  height: "200px"
11
13
  width: "90%"
14
+ keyEventThrottle: 300
12
15
 
13
16
  initialize: (@options={})->
14
- _.bindAll @, "keydown_handler"
15
17
 
16
18
  @input_id ||= _.uniqueId('field')
17
19
  @input_name ||= @name
@@ -23,6 +25,13 @@ _.def('Luca.fields.TextAreaField').extends('Luca.core.Field').with
23
25
 
24
26
  Luca.core.Field::initialize.apply @, arguments
25
27
 
28
+ if @enableKeyEvents is true
29
+ @keyup_handler = _.debounce(@keyup_handler, @keyEventThrottle || 10)
30
+
31
+ console.log "Registering Key Events"
32
+ @registerEvent("keyup textarea","keyup_handler")
33
+ @registerEvent("keydown textarea","keyup_handler")
34
+
26
35
  setValue: (value)->
27
36
  $( @field() ).val(value)
28
37
 
@@ -30,13 +39,19 @@ _.def('Luca.fields.TextAreaField').extends('Luca.core.Field').with
30
39
  $( @field() ).val()
31
40
 
32
41
  field: ()->
33
- @input = $("textarea##{ @input_id }", @el)
42
+ @input = @$("textarea")
34
43
 
35
- keydown_handler: (e)->
36
- me = my = $( e.currentTarget )
44
+ keyup_handler: (e)->
45
+ # TODO: Should ignore certain keyup events
46
+ # which would not indicate a change
47
+ @trigger "on:change", @, e
48
+ @trigger "on:keyup", @, e
37
49
 
38
50
  blur_handler: (e)->
39
- me = my = $( e.currentTarget )
51
+ @trigger "on:blur", @, e
40
52
 
41
53
  focus_handler: (e)->
42
- me = my = $( e.currentTarget )
54
+ @trigger "on:focus", @, e
55
+
56
+ change_handler: (e)->
57
+ @trigger "on:change", @, e
@@ -2,7 +2,7 @@ textField = Luca.register 'Luca.fields.TextField'
2
2
  textField.extends 'Luca.core.Field'
3
3
 
4
4
  textField.defines
5
- events:
5
+ _inheritEvents:
6
6
  "blur input" : "blur_handler"
7
7
  "focus input" : "focus_handler"
8
8
  "change input" : "change_handler"
@@ -17,6 +17,9 @@ textField.defines
17
17
 
18
18
  initialize: (@options={})->
19
19
  if @enableKeyEvents
20
+ if @keyEventThrottle
21
+ @keyup_handler = _.debounce(@keyup_handler, @keyEventThrottle)
22
+
20
23
  @registerEvent("keyup input","keyup_handler")
21
24
 
22
25
  @input_id ||= _.uniqueId('field')
@@ -26,11 +29,11 @@ textField.defines
26
29
  @input_value ||= @value || ""
27
30
 
28
31
  if @prepend
29
- @$el.addClass('input-prepend')
32
+ @$el.addClass 'input-prepend'
30
33
  @addOn = @prepend
31
34
 
32
35
  if @append
33
- @$el.addClass('input-append')
36
+ @$el.addClass 'input-append'
34
37
  @addOn = @append
35
38
 
36
39
  @placeHolder ||= ""
@@ -38,6 +41,9 @@ textField.defines
38
41
  Luca.core.Field::initialize.apply @, arguments
39
42
 
40
43
  keyup_handler: (e)->
44
+ # TODO: Should ignore certain keyup events
45
+ # which would not indicate a change
46
+ @trigger "on:change", @, e
41
47
  @trigger "on:keyup", @, e
42
48
 
43
49
  blur_handler: (e)->
@@ -3,12 +3,13 @@
3
3
  #
4
4
  # The FormView component integrates well with Luca.Models and can control
5
5
  # the attributes on that model, respond to validations, and submit changes
6
- # to an API.
6
+ # to an API.
7
7
  formView = Luca.register "Luca.components.FormView"
8
8
 
9
9
  formView.extends "Luca.Container"
10
10
 
11
- formView.mixesIn "LoadMaskable"
11
+ formView.mixesIn "LoadMaskable",
12
+ "FormModelBindings"
12
13
 
13
14
  formView.triggers "before:submit",
14
15
  "before:reset",
@@ -22,11 +23,20 @@ formView.triggers "before:submit",
22
23
  "after:load:existing",
23
24
  "after:submit:success",
24
25
  "after:submit:fatal_error",
25
- "after:submit:error"
26
+ "after:submit:error",
27
+ "state:change:dirty"
26
28
 
27
29
 
28
30
 
29
31
  formView.publicConfiguration
32
+ # track dirty state will bind to change events
33
+ # on all of the underlying fields, and set a
34
+ # flag whenever one of them changes
35
+ trackDirtyState: false
36
+
37
+ # don't setup two way binding to the model
38
+ trackModelChanges: false
39
+
30
40
  # should the label display above, or to the
31
41
  # side of the fields
32
42
  labelAlign: undefined
@@ -62,7 +72,7 @@ formView.publicConfiguration
62
72
 
63
73
  # Applies the twitter bootstrap well class to this form.
64
74
  # @$el.addClass('well') if @well
65
- well: false
75
+ well: false
66
76
 
67
77
  # Applies the twitter bootstrap form-search class to this form.
68
78
  # @$el.addClass('form-search') if @searchForm
@@ -82,15 +92,24 @@ formView.publicConfiguration
82
92
 
83
93
  formView.privateConfiguration
84
94
  tagName: 'form'
85
- stateful: true
86
- events:
95
+
96
+ # These events will get registered on the component
97
+ # but still leave the @events property open to extend
98
+ # for any component which inherits from us.
99
+ _inheritEvents:
87
100
  "click .submit-button" : "submitHandler"
88
101
  "click .reset-button" : "resetHandler"
89
102
 
90
103
  bodyClassName: "form-view-body"
91
104
 
105
+ stateful:
106
+ dirty: false
107
+ currentModel: undefined
108
+
92
109
  formView.privateMethods
93
110
  initialize: (@options={})->
111
+ form = @
112
+
94
113
  @loadMask = Luca.config.enableBoostrap unless @loadMask?
95
114
 
96
115
  Luca.Container::initialize.apply @, arguments
@@ -99,12 +118,26 @@ formView.privateMethods
99
118
 
100
119
  _.bindAll @, "submitHandler", "resetHandler", "renderToolbars"
101
120
 
121
+ # have our events be internal to the view, and not
122
+ # part of the normal @events chain, so they can be inherited
123
+ for eventId, handler of @_inheritEvents
124
+ @registerEvent(eventId, handler)
125
+
126
+ if @trackDirtyState is true
127
+ @on "after:components", ()->
128
+ for field in @getFields()
129
+ field.on "on:change", @onFieldChange, form
130
+ , form
131
+
102
132
  @setupHooks( @hooks )
103
133
 
104
134
  @applyStyleClasses()
105
135
 
106
136
  Luca.components.FormView.setupToolbar.call(@)
107
137
 
138
+ onFieldChange: (field, e)->
139
+ @trigger "field:change", field, e
140
+ @state.set('dirty', true)
108
141
 
109
142
  getDefaultToolbar: ()->
110
143
  config = @toolbarConfig || @defaultToolbar
@@ -127,13 +160,20 @@ formView.privateMethods
127
160
 
128
161
  resetHandler: (e)->
129
162
  me = my = $( e?.target )
130
- @trigger "before:reset", @
163
+ if @beforeReset?
164
+ result = @beforeReset()
165
+ return if result is false
166
+
131
167
  @reset()
132
168
  @trigger "after:reset", @
133
169
 
134
170
  submitHandler: (e)->
135
- me = my = $( e?.target )
136
- @trigger "before:submit", @
171
+ if @beforeSubmit?
172
+ result = @beforeSubmit()
173
+ return if result is false
174
+ else
175
+ @trigger "before:submit", @
176
+
137
177
  @trigger "enable:loadmask", @ if @loadMask is true
138
178
  @submit() if @hasModel()
139
179
 
@@ -142,7 +182,7 @@ formView.privateMethods
142
182
 
143
183
  form = @
144
184
  @eachField (field)->
145
- field.getForm = ()=> form
185
+ field.getForm = ()=> form
146
186
  field.getModel = ()=> form.currentModel()
147
187
 
148
188
  eachField: (iterator)->
@@ -165,30 +205,33 @@ formView.privateMethods
165
205
 
166
206
  fields
167
207
 
168
- loadModel: (@current_model)->
208
+ loadModel: (model)->
169
209
  form = @
170
210
  fields = @getFields()
171
211
 
172
- @trigger "before:load", @, @current_model
212
+ @state.set('dirty', false)
213
+
214
+ @trigger "before:load", @, model
173
215
 
174
- if @current_model
175
- @current_model.beforeFormLoad?.apply(@current_model, @)
216
+ if model
217
+ model.beforeFormLoad?.apply(model, @)
218
+ event = "before:load:#{ (if model.isNew() then "new" else "existing")}"
219
+ @trigger event, @, model
176
220
 
177
- event = "before:load:#{ (if @current_model.isNew() then "new" else "existing")}"
178
- @trigger event, @, @current_model
221
+ @state.set('currentModel', model)
179
222
 
180
- @setValues(@current_model)
223
+ @setValues(model || {}, silent: true)
181
224
 
182
- @trigger "after:load", @, @current_model
225
+ @trigger "after:load", @, model
183
226
 
184
- if @current_model
185
- @trigger "after:load:#{ (if @current_model.isNew() then "new" else "existing")}", @, @current_model
227
+ if model
228
+ @trigger "after:load:#{ (if model.isNew() then "new" else "existing")}", @, model
186
229
 
187
230
  reset: ()->
188
- @loadModel( @current_model ) if @current_model?
231
+ @loadModel( @state.get('currentModel') )
189
232
 
190
233
  clear: ()->
191
- @current_model = if @defaultModel? then @defaultModel() else undefined
234
+ @state.set('currentModel', @defaultModel?() )
192
235
 
193
236
  _( @getFields() ).each (field)=>
194
237
  try
@@ -196,6 +239,9 @@ formView.privateMethods
196
239
  catch e
197
240
  console.log "Error Clearing", @, field
198
241
 
242
+ isDirty: ()->
243
+ !!@state.get('dirty')
244
+
199
245
  # set the values on the form
200
246
  # without syncing
201
247
  setValues: (source, options={})->
@@ -205,16 +251,15 @@ formView.privateMethods
205
251
  _( fields ).each (field) =>
206
252
  field_name = field.input_name || field.name
207
253
 
208
- if value = source[field_name]
209
- if _.isFunction(value)
210
- value = value.apply(@)
254
+ if source?[field_name]
255
+ value = Luca.util.read( source[field_name] )
211
256
 
212
257
  if !value and Luca.isBackboneModel(source)
213
258
  value = source.get(field_name)
214
259
 
215
260
  field?.setValue( value ) unless field.readOnly is true
216
261
 
217
- @syncFormWithModel() unless options.silent? is true
262
+ @applyFormValuesToModel() unless options.silent? is true
218
263
 
219
264
  # Public: returns a hash of values for the form fields in this view.
220
265
  #
@@ -261,6 +306,26 @@ formView.privateMethods
261
306
 
262
307
  values
263
308
 
309
+ removeErrors: ()->
310
+ @$('.alert.alert-error').remove()
311
+ @$el.removeClass('error')
312
+
313
+ for field in @getFields()
314
+ field.clearErrors()
315
+
316
+ displayErrors: (errors)->
317
+ has_errors = false
318
+ for field in @getFields()
319
+ for field_name, field_errors of errors when field_name is field.input_name
320
+ field.displayErrors(field_errors)
321
+ has_errors = true
322
+
323
+ if has_errors
324
+ @$el.addClass('error')
325
+
326
+ displayValidationErrorsMessage: ()->
327
+ @errorMessage('Please fix the fields with errors')
328
+
264
329
  submit_success_handler: (model, response, xhr)->
265
330
  @trigger "after:submit", @, model, response
266
331
  @trigger "disable:loadmask", @ if @loadMask is true
@@ -274,27 +339,34 @@ formView.privateMethods
274
339
  @trigger "after:submit", @, model, response
275
340
  @trigger "after:submit:fatal_error", @, model, response
276
341
 
342
+ try
343
+ json = $.parseJSON(response.responseText)
344
+ if !json.success && json.errors?
345
+ @displayValidationErrorsMessage()
346
+ @displayErrors(json.errors)
347
+
277
348
  submit: (save=true, saveOptions={})->
278
349
  _.bindAll @, "submit_success_handler", "submit_fatal_error_handler"
279
350
 
280
351
  saveOptions.success ||= @submit_success_handler
281
352
  saveOptions.error ||= @submit_fatal_error_handler
282
353
 
283
- @syncFormWithModel()
354
+ @removeErrors()
355
+ @applyFormValuesToModel()
284
356
  return unless save
285
- @current_model.save( @current_model.toJSON(), saveOptions )
357
+ @currentModel()?.save( @currentModel().toJSON(), saveOptions )
286
358
 
287
359
  hasModel: ()->
288
- @current_model?
360
+ @currentModel()?
289
361
 
290
362
  currentModel: (options={})->
291
363
  if options is true or options?.refresh is true
292
- @syncFormWithModel()
364
+ @applyFormValuesToModel()
293
365
 
294
- @current_model
366
+ @state.get('currentModel')
295
367
 
296
- syncFormWithModel: (options)->
297
- @current_model?.set( @getValues(), options )
368
+ applyFormValuesToModel: (options)->
369
+ @currentModel()?.set( @getValues(), options )
298
370
 
299
371
  setLegend: (@legend)->
300
372
  $('fieldset legend', @el).first().html(@legend)