luca 0.9.9 → 0.9.42
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +9 -153
- data/Gemfile +1 -10
- data/Gemfile.lock +40 -113
- data/Guardfile +25 -3
- data/README.md +57 -54
- data/ROADMAP +32 -15
- data/Rakefile +75 -24
- data/app.rb +46 -12
- data/{app/assets → assets}/images/glyphicons-halflings-white.png +0 -0
- data/{app/assets → assets}/images/glyphicons-halflings.png +0 -0
- data/assets/javascripts/dependencies/backbone-min.js +37 -0
- data/assets/javascripts/dependencies/backbone-query.min.js +1 -0
- data/assets/javascripts/dependencies/bootstrap.min.js +7 -0
- data/{vendor/assets/javascripts → assets/javascripts/dependencies}/codemirror-coffeescript.js +0 -0
- data/{vendor/assets/javascripts → assets/javascripts/dependencies}/codemirror-css.js +0 -0
- data/{vendor/assets/javascripts → assets/javascripts/dependencies}/codemirror-html.js +0 -0
- data/{vendor/assets/javascripts → assets/javascripts/dependencies}/codemirror-javascript.js +0 -0
- data/{vendor/assets/javascripts → assets/javascripts/dependencies}/codemirror-less.js +0 -0
- data/{vendor/assets/javascripts → assets/javascripts/dependencies}/codemirror-vim.js +0 -0
- data/{vendor/assets/javascripts → assets/javascripts/dependencies}/codemirror.js +0 -0
- data/assets/javascripts/dependencies/coffee-script.js +12189 -0
- data/{spec → assets}/javascripts/dependencies/jasmine-html.js +0 -0
- data/{spec → assets}/javascripts/dependencies/jasmine.js +0 -0
- data/assets/javascripts/dependencies/jquery.js +4 -0
- data/{vendor/assets/javascripts → assets/javascripts/dependencies}/modal.js +0 -0
- data/{vendor/assets/javascripts → assets/javascripts/dependencies}/modernizr.min.js +0 -0
- data/{vendor/assets/javascripts → assets/javascripts/dependencies}/prettify.js +0 -0
- data/{spec → assets}/javascripts/dependencies/sinon.js +0 -0
- data/{vendor/assets/javascripts → assets/javascripts/dependencies}/spin-min.js +0 -0
- data/assets/javascripts/dependencies/underscore-min.js +31 -0
- data/assets/javascripts/dependencies/underscore-string.min.js +14 -0
- data/assets/javascripts/dependencies.coffee +5 -0
- data/assets/javascripts/luca/index.coffee +1 -0
- data/assets/javascripts/luca-templates.js +1 -0
- data/assets/javascripts/luca-ui-base.coffee +1 -0
- data/assets/javascripts/luca-ui-bootstrap.js +1 -0
- data/assets/javascripts/luca-ui-development-tools.coffee +9 -0
- data/assets/javascripts/luca-ui-full.js +3 -0
- data/assets/javascripts/luca-ui-spec.coffee +2 -0
- data/assets/javascripts/luca-ui.js +3 -0
- data/assets/javascripts/sandbox/application.coffee +57 -0
- data/assets/javascripts/sandbox/config.coffee +7 -0
- data/assets/javascripts/sandbox/router.coffee +24 -0
- data/assets/javascripts/sandbox/templates/builder/component_list.luca +1 -0
- data/assets/javascripts/sandbox/templates/builder.luca +2 -0
- data/assets/javascripts/sandbox/templates/main.luca +53 -0
- data/assets/javascripts/sandbox/templates/sandbox/docs_index.luca +1 -0
- data/assets/javascripts/sandbox/templates/sandbox/navigation.luca +8 -0
- data/assets/javascripts/sandbox/templates/sandbox/readme.luca +30 -0
- data/assets/javascripts/sandbox/templates/sandbox.luca +1 -0
- data/assets/javascripts/sandbox/views/builder/builder_canvas.coffee +3 -0
- data/assets/javascripts/sandbox/views/builder/builder_editor.coffee +6 -0
- data/assets/javascripts/sandbox/views/builder/component_list.coffee +38 -0
- data/assets/javascripts/sandbox/views/builder/project_browser.coffee +14 -0
- data/assets/javascripts/sandbox/views/builder.coffee +133 -0
- data/assets/javascripts/sandbox/views/docs_controller.coffee +7 -0
- data/assets/javascripts/sandbox/views/inspector/instance_filter.coffee +18 -0
- data/{app/assets/stylesheets/luca/containers/modal_view.scss → assets/javascripts/sandbox/views/inspector/instance_list.coffee} +0 -0
- data/assets/javascripts/sandbox/views/inspector.coffee +11 -0
- data/assets/javascripts/sandbox/views/top_navigation.coffee +4 -0
- data/assets/javascripts/sandbox.coffee +7 -0
- data/assets/javascripts/spec-dependencies.coffee +4 -0
- data/assets/stylesheets/bootstrap-responsive.min.css +2 -0
- data/assets/stylesheets/bootstrap.min.css +727 -0
- data/{vendor/assets → assets}/stylesheets/codemirror-blackboard.css +0 -0
- data/{vendor/assets → assets}/stylesheets/codemirror-monokai.css +0 -0
- data/{vendor/assets → assets}/stylesheets/codemirror.css +0 -0
- data/{vendor/assets → assets}/stylesheets/jasmine.css +0 -0
- data/assets/stylesheets/luca-ui-bootstrap.css +4 -0
- data/assets/stylesheets/luca-ui-development-tools.css +5 -0
- data/assets/stylesheets/luca-ui-full.css +3 -0
- data/assets/stylesheets/luca-ui-spec.css +3 -0
- data/assets/stylesheets/luca-ui.css +3 -0
- data/assets/stylesheets/prettify.css +40 -0
- data/assets/stylesheets/sandbox/builder.scss +79 -0
- data/assets/stylesheets/sandbox/sandbox.scss +18 -0
- data/assets/stylesheets/sandbox.css +3 -0
- data/assets/stylesheets/themes/amelia-bootstrap.css +826 -0
- data/assets/stylesheets/themes/slate-bootstrap.css +797 -0
- data/assets/stylesheets/themes/superhero-bootstrap.css +830 -0
- data/config.ru +2 -1
- data/docs/{old/application.md → application.md} +0 -0
- data/docs/{old/collection.md → collection.md} +0 -0
- data/docs/{old/collection_manager.md → collection_manager.md} +0 -0
- data/docs/{old/container_philosophy.md → container_philosophy.md} +0 -0
- data/docs/{old/event_binding_helpers.md → event_binding_helpers.md} +0 -0
- data/docs/{old/method_caching_and_computed_properties.md → method_caching_and_computed_properties.md} +0 -0
- data/docs/{old/view.md → view.md} +0 -0
- data/lib/luca/code_browser.rb +55 -0
- data/lib/luca/command_line.rb +69 -0
- data/lib/luca/rails/engine.rb +0 -12
- data/lib/luca/rails/version.rb +2 -1
- data/lib/luca/rails.rb +3 -5
- data/lib/luca/template.rb +0 -2
- data/lib/luca.rb +1 -25
- data/luca.gemspec +7 -16
- data/site/assets/bootstrap.min.js +7 -0
- data/site/assets/dependencies.js +94 -0
- data/site/assets/glyphicons-halflings-white.png +0 -0
- data/site/assets/glyphicons-halflings.png +0 -0
- data/site/assets/luca-ui-bootstrap.css +1331 -0
- data/site/assets/luca-ui-bootstrap.js +9 -0
- data/site/assets/luca-ui-development-tools.css +234 -0
- data/site/assets/luca-ui-development-tools.js +18561 -0
- data/site/assets/luca-ui-development-tools.min.js +15 -0
- data/site/assets/luca-ui-full.min.js +8 -0
- data/site/assets/luca-ui.min.js +4 -0
- data/site/assets/sandbox.css +62 -0
- data/site/assets/sandbox.js +469 -0
- data/site/docs/application.html +41 -0
- data/site/docs/caching.html +43 -0
- data/site/docs/collection.html +75 -0
- data/site/docs/collection_manager.html +71 -0
- data/site/docs/containers.html +118 -0
- data/site/docs/events.html +153 -0
- data/site/docs/view.html +128 -0
- data/site/img/glyphicons-halflings-white.png +0 -0
- data/site/img/glyphicons-halflings.png +0 -0
- data/site/index.html +20 -0
- data/site/source-map.js +1 -0
- data/spec/{javascripts/components → components}/application_spec.coffee +0 -0
- data/spec/{javascripts/components → components}/collection_loader_view_spec.coffee +0 -0
- data/{site/source/app/assets/javascripts/docs/lib/util.coffee → spec/components/controller_spec.coffee} +0 -0
- data/spec/{javascripts/components → components}/fields/checkbox_array_spec.coffee +0 -0
- data/spec/components/form_view_spec.coffee +80 -0
- data/spec/{javascripts/components → components}/grid_view_spec.coffee +0 -0
- data/spec/{javascripts/components → components}/record_manager_spec.coffee +0 -0
- data/spec/{javascripts/components → components}/template_spec.coffee +0 -0
- data/spec/containers/card_view_spec.coffee +50 -0
- data/{site/source/app/assets/javascripts/docs/views/components/code_editor/index.coffee → spec/containers/column_view_spec.coffee} +0 -0
- data/spec/{javascripts/containers → containers}/modal_view_spec.coffee +0 -0
- data/spec/{javascripts/containers → containers}/panel_view_spec.coffee +0 -0
- data/spec/{javascripts/components/pagination_control_spec.coffee → containers/split_view_spec.coffee} +0 -0
- data/spec/{javascripts/containers → containers}/tab_view_spec.coffee +0 -0
- data/spec/{javascripts/containers → containers}/viewport_spec.coffee +0 -0
- data/spec/{javascripts/core → core}/collection_spec.coffee +1 -26
- data/spec/core/container_spec.coffee +66 -0
- data/spec/{javascripts/concerns/paginatable_spec.coffee → core/field_spec.coffee} +0 -0
- data/spec/{javascripts/core → core}/model_spec.coffee +3 -26
- data/spec/{javascripts/core → core}/observer_spec.coffee +0 -0
- data/spec/{javascripts/core → core}/view_spec.coffee +38 -114
- data/spec/{javascripts/core/framework_spec.coffee → framework_spec.coffee} +2 -31
- data/spec/{javascripts/helper.coffee → helper.coffee} +0 -0
- data/spec/{javascripts/managers → managers}/collection_manager_spec.coffee +0 -0
- data/spec/{javascripts/managers → managers}/socket_manager_spec.coffee +0 -0
- data/src/components/application.coffee +318 -0
- data/src/components/base_toolbar.coffee +15 -0
- data/{app/assets/javascripts/luca → src}/components/collection_loader_view.coffee +1 -3
- data/src/components/collection_view.coffee +131 -0
- data/src/components/controller.coffee +63 -0
- data/src/components/fields/button_field.coffee +38 -0
- data/{app/assets/javascripts/luca → src}/components/fields/checkbox_array.coffee +7 -18
- data/{app/assets/javascripts/luca → src}/components/fields/checkbox_field.coffee +10 -19
- data/{app/assets/javascripts/luca → src}/components/fields/file_upload_field.coffee +4 -5
- data/src/components/fields/hidden_field.coffee +12 -0
- data/src/components/fields/label_field.coffee +14 -0
- data/src/components/fields/select_field.coffee +97 -0
- data/src/components/fields/text_area_field.coffee +40 -0
- data/{app/assets/javascripts/luca → src}/components/fields/text_field.coffee +5 -16
- data/src/components/fields/type_ahead_field.coffee +22 -0
- data/src/components/form_button_toolbar.coffee +25 -0
- data/src/components/form_view.coffee +275 -0
- data/src/components/grid_view.coffee +269 -0
- data/src/components/index.coffee +1 -0
- data/src/components/load_mask.coffee +3 -0
- data/src/components/nav_bar.coffee +22 -0
- data/src/components/page_controller.coffee +2 -0
- data/{app/assets/javascripts/luca → src}/components/record_manager.coffee +0 -0
- data/{app/assets/javascripts/luca → src}/components/router.coffee +1 -6
- data/src/components/table_view.coffee +53 -0
- data/src/components/template.coffee +5 -0
- data/src/components/toolbar_dialog.coffee +25 -0
- data/src/containers/card_view.coffee +93 -0
- data/src/containers/column_view.coffee +42 -0
- data/{app/assets/javascripts/luca → src}/containers/modal_view.coffee +9 -9
- data/src/containers/page_view.coffee +2 -0
- data/{app/assets/javascripts/luca → src}/containers/panel_toolbar.coffee +84 -89
- data/src/containers/panel_view.coffee +23 -0
- data/src/containers/split_view.coffee +8 -0
- data/{app/assets/javascripts/luca → src}/containers/tab_view.coffee +21 -27
- data/{app/assets/javascripts/luca → src}/containers/viewport.coffee +18 -14
- data/{app/assets/javascripts/luca → src}/core/collection.coffee +51 -97
- data/src/core/container.coffee +374 -0
- data/{tutorials/component-definitions.md → src/core/core.coffee} +0 -0
- data/src/core/field.coffee +79 -0
- data/src/core/model.coffee +43 -0
- data/{app/assets/javascripts/luca → src}/core/observer.coffee +0 -0
- data/src/core/panel.coffee +118 -0
- data/{app/assets/javascripts/luca/core/registry → src/core}/registry.coffee +43 -63
- data/{app/assets/javascripts/luca/util → src/core}/script_loader.coffee +0 -0
- data/src/core/view.coffee +264 -0
- data/src/define.coffee +110 -0
- data/{app/assets/javascripts/luca → src}/framework.coffee +103 -98
- data/src/index.coffee +23 -0
- data/{app/assets/javascripts/luca → src}/managers/collection_manager.coffee +13 -37
- data/src/managers/socket_manager.coffee +54 -0
- data/{app/assets/javascripts/luca/concerns → src/modules}/deferrable.coffee +4 -5
- data/src/modules/grid_layout.coffee +3 -0
- data/{app/assets/javascripts/luca/concerns/loadmaskable.coffee → src/modules/load_mask.coffee} +11 -23
- data/{app/assets/javascripts/luca/concerns → src/modules}/local_storage.coffee +0 -0
- data/src/plugins/development_tool_helpers.coffee +21 -0
- data/src/plugins/events.coffee +54 -0
- data/src/samples/definition.coffee +49 -0
- data/{tutorials/component-definitions/01_intro.md → src/stylesheets/base.scss} +0 -0
- data/{app/assets/stylesheets/luca → src/stylesheets}/components/checkbox_array.scss +1 -1
- data/src/stylesheets/components/form_view.scss +59 -0
- data/{app/assets/stylesheets/luca → src/stylesheets}/components/grid_view.scss +0 -0
- data/{app/assets/stylesheets/luca → src/stylesheets}/components/load_mask.scss +0 -0
- data/src/stylesheets/components/toolbar.scss +0 -0
- data/{app/assets/stylesheets/luca → src/stylesheets}/components/viewport.scss +4 -1
- data/src/stylesheets/containers/container.scss +16 -0
- data/src/stylesheets/containers/modal_view.scss +0 -0
- data/{app/assets/stylesheets/luca → src/stylesheets}/containers/panels.scss +0 -0
- data/{app/assets/stylesheets/luca → src/stylesheets}/containers/tab_view.scss +5 -5
- data/{app/assets/stylesheets/luca → src/stylesheets}/normalize.scss +0 -0
- data/src/stylesheets/tools/class_browser.scss +32 -0
- data/src/stylesheets/tools/code_editor.scss +24 -0
- data/src/stylesheets/tools/component_tester.scss +26 -0
- data/{app/assets/stylesheets/luca/development → src/stylesheets/tools}/console.scss +0 -0
- data/src/templates/components/bootstrap_form_controls.luca +7 -0
- data/src/templates/components/collection_loader_view.luca +5 -0
- data/src/templates/components/form_alert +0 -0
- data/src/templates/components/form_alert.luca +3 -0
- data/src/templates/components/grid_view.luca +7 -0
- data/src/templates/components/grid_view_empty_text.luca +3 -0
- data/src/templates/components/load_mask.luca +3 -0
- data/src/templates/components/nav_bar.luca +2 -0
- data/src/templates/containers/basic.luca +1 -0
- data/src/templates/containers/tab_selector_container.luca +8 -0
- data/src/templates/containers/tab_view.luca +2 -0
- data/src/templates/containers/toolbar_wrapper.luca +1 -0
- data/src/templates/fields/button_field.luca +2 -0
- data/src/templates/fields/button_field_link.luca +5 -0
- data/src/templates/fields/checkbox_array.luca +4 -0
- data/src/templates/fields/checkbox_array_item.luca +4 -0
- data/src/templates/fields/checkbox_field.luca +9 -0
- data/src/templates/fields/file_upload_field.luca +8 -0
- data/src/templates/fields/hidden_field.luca +1 -0
- data/src/templates/fields/select_field.luca +8 -0
- data/src/templates/fields/text_area_field.luca +8 -0
- data/src/templates/fields/text_field.luca +17 -0
- data/src/templates/sample/contents.luca +1 -0
- data/src/templates/sample/welcome.luca +1 -0
- data/src/templates/table_view.luca +4 -0
- data/src/tools/application_inspector.coffee +2 -0
- data/src/tools/code_editor.coffee +258 -0
- data/{app/assets/javascripts/luca/development → src/tools}/code_mirror_field.coffee +1 -2
- data/src/tools/coffee_script_editor.coffee +82 -0
- data/src/tools/collection_inspector.coffee +4 -0
- data/src/tools/collections/components.coffee +59 -0
- data/src/tools/collections/instances.coffee +15 -0
- data/src/tools/component_tester.coffee +462 -0
- data/{app/assets/javascripts/luca/development → src/tools}/console.coffee +24 -55
- data/src/tools/models/components.coffee +25 -0
- data/src/tools/models/instance.coffee +2 -0
- data/src/tools/templates/component_tester/help.luca +14 -0
- data/{app/assets/javascripts/luca/util/luca.coffee → src/util.coffee} +6 -90
- data/vendor/assets/javascripts/luca-ui-development-tools.js +18533 -0
- data/vendor/assets/javascripts/luca-ui-development-tools.min.js +15 -0
- data/vendor/assets/javascripts/luca-ui-full.js +4806 -0
- data/vendor/assets/javascripts/luca-ui-full.min.js +8 -0
- data/vendor/assets/javascripts/luca-ui-templates.js +24 -0
- data/vendor/assets/javascripts/luca-ui.js +1703 -4394
- data/vendor/assets/javascripts/luca-ui.min.js +4 -5
- data/vendor/assets/luca-ui/base.css +85 -0
- data/vendor/assets/luca-ui/components/application.js +91 -0
- data/vendor/assets/luca-ui/components/base_toolbar.js +23 -0
- data/vendor/assets/luca-ui/components/controller.js +38 -0
- data/vendor/assets/luca-ui/components/fields/button_field.js +45 -0
- data/vendor/assets/luca-ui/components/fields/checkbox_field.js +43 -0
- data/vendor/assets/luca-ui/components/fields/file_upload_field.js +20 -0
- data/vendor/assets/luca-ui/components/fields/hidden_field.js +20 -0
- data/vendor/assets/luca-ui/components/fields/select_field.js +97 -0
- data/vendor/assets/luca-ui/components/fields/text_area_field.js +48 -0
- data/vendor/assets/luca-ui/components/fields/text_field.js +46 -0
- data/vendor/assets/luca-ui/components/fields/type_ahead_field.js +13 -0
- data/vendor/assets/luca-ui/components/form_button_toolbar.js +32 -0
- data/vendor/assets/luca-ui/components/form_view.css +32 -0
- data/vendor/assets/luca-ui/components/form_view.js +207 -0
- data/{app/assets/stylesheets/luca/components/table_view.scss → vendor/assets/luca-ui/components/grid_view.css} +51 -60
- data/vendor/assets/luca-ui/components/grid_view.js +202 -0
- data/vendor/assets/luca-ui/components/record_manager.js +207 -0
- data/vendor/assets/luca-ui/components/router.js +36 -0
- data/vendor/assets/luca-ui/components/template.js +26 -0
- data/vendor/assets/luca-ui/components/toolbar.css +11 -0
- data/vendor/assets/luca-ui/containers/card_view.js +98 -0
- data/vendor/assets/luca-ui/containers/column_view.js +52 -0
- data/vendor/assets/luca-ui/containers/container.css +3 -0
- data/vendor/assets/luca-ui/containers/modal_view.css +0 -0
- data/vendor/assets/luca-ui/containers/modal_view.js +87 -0
- data/vendor/assets/luca-ui/containers/panel_view.js +34 -0
- data/vendor/assets/luca-ui/containers/split_view.js +13 -0
- data/vendor/assets/luca-ui/containers/tab_view.css +16 -0
- data/vendor/assets/luca-ui/containers/tab_view.js +80 -0
- data/vendor/assets/luca-ui/containers/viewport.js +18 -0
- data/vendor/assets/luca-ui/core/collection.js +221 -0
- data/vendor/assets/luca-ui/core/container.js +205 -0
- data/vendor/assets/luca-ui/core/field.js +59 -0
- data/vendor/assets/luca-ui/core/observer.js +42 -0
- data/vendor/assets/luca-ui/core/view.js +127 -0
- data/vendor/assets/luca-ui/framework.js +110 -0
- data/vendor/assets/luca-ui/index.js +5 -0
- data/vendor/assets/luca-ui/managers/collection_manager.js +98 -0
- data/vendor/assets/luca-ui/managers/socket_manager.js +52 -0
- data/vendor/assets/luca-ui/modules/deferrable.js +21 -0
- data/vendor/assets/luca-ui/modules/local_storage.js +81 -0
- data/vendor/assets/luca-ui/normalize.css +359 -0
- data/vendor/assets/luca-ui/stylesheets/base.css +85 -0
- data/vendor/assets/luca-ui/stylesheets/components/form_view.css +32 -0
- data/vendor/assets/luca-ui/stylesheets/components/grid_view.css +76 -0
- data/vendor/assets/luca-ui/stylesheets/components/toolbar.css +11 -0
- data/vendor/assets/luca-ui/stylesheets/containers/container.css +3 -0
- data/vendor/assets/luca-ui/stylesheets/containers/modal_view.css +0 -0
- data/vendor/assets/luca-ui/stylesheets/containers/tab_view.css +16 -0
- data/vendor/assets/luca-ui/stylesheets/normalize.css +359 -0
- data/vendor/assets/luca-ui/templates/components/bootstrap_form_controls.js +4 -0
- data/vendor/assets/luca-ui/templates/components/form_view.js +4 -0
- data/vendor/assets/luca-ui/templates/components/grid_view.js +4 -0
- data/vendor/assets/luca-ui/templates/components/grid_view_empty_text.js +4 -0
- data/vendor/assets/luca-ui/templates/containers/basic.js +4 -0
- data/vendor/assets/luca-ui/templates/containers/tab_selector_container.js +4 -0
- data/vendor/assets/luca-ui/templates/containers/tab_view.js +4 -0
- data/vendor/assets/luca-ui/templates/containers/toolbar_wrapper.js +4 -0
- data/vendor/assets/luca-ui/templates/fields/button_field.js +4 -0
- data/vendor/assets/luca-ui/templates/fields/button_field_link.js +4 -0
- data/vendor/assets/luca-ui/templates/fields/checkbox_field.js +4 -0
- data/vendor/assets/luca-ui/templates/fields/file_upload_field.js +4 -0
- data/vendor/assets/luca-ui/templates/fields/hidden_field.js +4 -0
- data/vendor/assets/luca-ui/templates/fields/select_field.js +4 -0
- data/vendor/assets/luca-ui/templates/fields/text_area_field.js +4 -0
- data/vendor/assets/luca-ui/templates/fields/text_field.js +4 -0
- data/vendor/assets/luca-ui/templates/sample/contents.js +4 -0
- data/vendor/assets/luca-ui/templates/sample/welcome.js +4 -0
- data/vendor/assets/stylesheets/luca-ui.css +471 -68
- data/views/jasmine.erb +2 -2
- metadata +328 -496
- data/app/assets/javascripts/luca/basic.coffee +0 -8
- data/app/assets/javascripts/luca/components/application.coffee +0 -530
- data/app/assets/javascripts/luca/components/collection_view.coffee +0 -211
- data/app/assets/javascripts/luca/components/controller.coffee +0 -176
- data/app/assets/javascripts/luca/components/fields/base.coffee +0 -144
- data/app/assets/javascripts/luca/components/fields/button_field.coffee +0 -91
- data/app/assets/javascripts/luca/components/fields/hidden_field.coffee +0 -11
- data/app/assets/javascripts/luca/components/fields/label_field.coffee +0 -12
- data/app/assets/javascripts/luca/components/fields/select_field.coffee +0 -159
- data/app/assets/javascripts/luca/components/fields/text_area_field.coffee +0 -57
- data/app/assets/javascripts/luca/components/fields/type_ahead_field.coffee +0 -20
- data/app/assets/javascripts/luca/components/form_view.coffee +0 -421
- data/app/assets/javascripts/luca/components/grid_layout_view.coffee +0 -42
- data/app/assets/javascripts/luca/components/index.coffee +0 -7
- data/app/assets/javascripts/luca/components/load_mask.coffee +0 -8
- data/app/assets/javascripts/luca/components/multi_collection_view.coffee +0 -92
- data/app/assets/javascripts/luca/components/nav_bar.coffee +0 -80
- data/app/assets/javascripts/luca/components/page.coffee +0 -70
- data/app/assets/javascripts/luca/components/pagination_control.coffee +0 -104
- data/app/assets/javascripts/luca/components/simple_collection_view.coffee +0 -10
- data/app/assets/javascripts/luca/components/table_view.coffee +0 -93
- data/app/assets/javascripts/luca/components/table_view_scrollable.coffee +0 -23
- data/app/assets/javascripts/luca/concerns/application_event_bindings.coffee +0 -19
- data/app/assets/javascripts/luca/concerns/collection_event_bindings.coffee +0 -47
- data/app/assets/javascripts/luca/concerns/development_tool_helpers.coffee +0 -30
- data/app/assets/javascripts/luca/concerns/dom_helpers.coffee +0 -61
- data/app/assets/javascripts/luca/concerns/enhanced_properties.coffee +0 -23
- data/app/assets/javascripts/luca/concerns/filterable.coffee +0 -101
- data/app/assets/javascripts/luca/concerns/form_model_bindings.coffee +0 -20
- data/app/assets/javascripts/luca/concerns/grid_layout.coffee +0 -15
- data/app/assets/javascripts/luca/concerns/modal_view.coffee +0 -63
- data/app/assets/javascripts/luca/concerns/model_presenter.coffee +0 -23
- data/app/assets/javascripts/luca/concerns/paginatable.coffee +0 -79
- data/app/assets/javascripts/luca/concerns/query_collection_bindings.coffee +0 -52
- data/app/assets/javascripts/luca/concerns/sortable.coffee +0 -69
- data/app/assets/javascripts/luca/concerns/state_model.coffee +0 -58
- data/app/assets/javascripts/luca/concerns/templating.coffee +0 -13
- data/app/assets/javascripts/luca/config.coffee +0 -54
- data/app/assets/javascripts/luca/containers/card_view.coffee +0 -178
- data/app/assets/javascripts/luca/containers/container.coffee +0 -711
- data/app/assets/javascripts/luca/containers/index.coffee +0 -2
- data/app/assets/javascripts/luca/containers/page_controller.coffee +0 -25
- data/app/assets/javascripts/luca/core/events.coffee +0 -114
- data/app/assets/javascripts/luca/core/index.coffee +0 -12
- data/app/assets/javascripts/luca/core/model.coffee +0 -56
- data/app/assets/javascripts/luca/core/panel.coffee +0 -124
- data/app/assets/javascripts/luca/core/registry/component_definition.coffee +0 -319
- data/app/assets/javascripts/luca/core/registry/concerns.coffee +0 -70
- data/app/assets/javascripts/luca/core/registry/index.coffee +0 -4
- data/app/assets/javascripts/luca/core/registry/meta_data.coffee +0 -99
- data/app/assets/javascripts/luca/core/templates.coffee +0 -51
- data/app/assets/javascripts/luca/core/view.coffee +0 -383
- data/app/assets/javascripts/luca/dependencies.coffee +0 -9
- data/app/assets/javascripts/luca/development/code_sync_manager.coffee +0 -173
- data/app/assets/javascripts/luca/development/component.coffee +0 -76
- data/app/assets/javascripts/luca/development/components.coffee +0 -57
- data/app/assets/javascripts/luca/development/index.coffee +0 -5
- data/app/assets/javascripts/luca/index.coffee +0 -9
- data/app/assets/javascripts/luca/managers/index.coffee +0 -2
- data/app/assets/javascripts/luca/managers/socket_manager.coffee +0 -89
- data/app/assets/javascripts/luca/templates/components/bootstrap_form_controls.jst.ejs +0 -10
- data/app/assets/javascripts/luca/templates/components/collection_loader_view.jst.ejs +0 -6
- data/app/assets/javascripts/luca/templates/components/form_alert.jst.ejs +0 -4
- data/app/assets/javascripts/luca/templates/components/grid_view.jst.ejs +0 -11
- data/app/assets/javascripts/luca/templates/components/grid_view_empty_text.jst.ejs +0 -3
- data/app/assets/javascripts/luca/templates/components/load_mask.jst.ejs +0 -5
- data/app/assets/javascripts/luca/templates/components/nav_bar.jst.ejs +0 -19
- data/app/assets/javascripts/luca/templates/components/pagination.jst.ejs +0 -10
- data/app/assets/javascripts/luca/templates/components/table_view.jst.ejs +0 -4
- data/app/assets/javascripts/luca/templates/containers/basic.jst.ejs +0 -1
- data/app/assets/javascripts/luca/templates/containers/tab_selector_container.jst.ejs +0 -12
- data/app/assets/javascripts/luca/templates/containers/tab_view.jst.ejs +0 -2
- data/app/assets/javascripts/luca/templates/containers/toolbar_wrapper.jst.ejs +0 -1
- data/app/assets/javascripts/luca/templates/fields/button_field.jst.ejs +0 -2
- data/app/assets/javascripts/luca/templates/fields/button_field_link.jst.ejs +0 -6
- data/app/assets/javascripts/luca/templates/fields/checkbox_array.jst.ejs +0 -4
- data/app/assets/javascripts/luca/templates/fields/checkbox_array_item.jst.ejs +0 -3
- data/app/assets/javascripts/luca/templates/fields/checkbox_field.jst.ejs +0 -10
- data/app/assets/javascripts/luca/templates/fields/file_upload_field.jst.ejs +0 -10
- data/app/assets/javascripts/luca/templates/fields/hidden_field.jst.ejs +0 -1
- data/app/assets/javascripts/luca/templates/fields/select_field.jst.ejs +0 -11
- data/app/assets/javascripts/luca/templates/fields/text_area_field.jst.ejs +0 -11
- data/app/assets/javascripts/luca/templates/fields/text_field.jst.ejs +0 -16
- data/app/assets/javascripts/luca/util/deprecations.coffee +0 -18
- data/app/assets/javascripts/luca/util/index.coffee +0 -4
- data/app/assets/javascripts/luca/util/keybindings.coffee +0 -24
- data/app/assets/javascripts/luca/util/logging.coffee +0 -30
- data/app/assets/javascripts/luca-ui.js +0 -1
- data/app/assets/stylesheets/luca/components/form_view.scss +0 -7
- data/app/assets/stylesheets/luca/containers/container.scss +0 -19
- data/app/assets/stylesheets/luca/development/index.css +0 -3
- data/app/assets/stylesheets/luca/index.css +0 -4
- data/bin/luca +0 -14
- data/docs/framework.json +0 -1
- data/docs/luca-framework-documentation.js +0 -1
- data/lib/generators/luca/application/application_generator.rb +0 -75
- data/lib/generators/luca/application/templates/controller.rb +0 -4
- data/lib/generators/luca/application/templates/index.html.erb +0 -19
- data/lib/generators/luca/application/templates/index.html.haml +0 -7
- data/lib/generators/luca/application/templates/javascripts/application.coffee +0 -18
- data/lib/generators/luca/application/templates/javascripts/collection_manager.coffee +0 -2
- data/lib/generators/luca/application/templates/javascripts/config.coffee +0 -3
- data/lib/generators/luca/application/templates/javascripts/dependencies.coffee +0 -3
- data/lib/generators/luca/application/templates/javascripts/home.jst.ejs +0 -2
- data/lib/generators/luca/application/templates/javascripts/index.coffee +0 -15
- data/lib/generators/luca/application/templates/javascripts/router.coffee +0 -4
- data/lib/guard/luca.rb +0 -84
- data/lib/luca/asset_compiler.rb +0 -117
- data/lib/luca/cli/generate.rb +0 -37
- data/lib/luca/cli/server.rb +0 -20
- data/lib/luca/cli/sync.rb +0 -40
- data/lib/luca/cli/watch.rb +0 -16
- data/lib/luca/cli.rb +0 -68
- data/lib/luca/collection/endpoint.rb +0 -38
- data/lib/luca/collection/file_backend.rb +0 -121
- data/lib/luca/collection/redis_backend.rb +0 -153
- data/lib/luca/collection.rb +0 -64
- data/lib/luca/compiled_asset.rb +0 -61
- data/lib/luca/component_definition.rb +0 -356
- data/lib/luca/luca_application.rb +0 -258
- data/lib/luca/project.rb +0 -73
- data/lib/luca/project_harness.rb +0 -96
- data/lib/luca/server.rb +0 -7
- data/lib/luca/stylesheet.rb +0 -35
- data/lib/luca/template_asset.rb +0 -64
- data/lib/luca/version.rb +0 -3
- data/lib/luca/watcher.rb +0 -72
- data/lib/railties/luca/tasks.rake +0 -38
- data/site/.bundle/config +0 -2
- data/site/.gitignore +0 -5
- data/site/.rvmrc +0 -1
- data/site/CHANGELOG.md +0 -41
- data/site/DOCS.md +0 -41
- data/site/Gemfile +0 -8
- data/site/Gemfile.lock +0 -134
- data/site/LICENSE.md +0 -19
- data/site/config.rb +0 -84
- data/site/helpers/site_helpers.rb +0 -20
- data/site/html5bp-docs/README.md +0 -38
- data/site/html5bp-docs/contribute.md +0 -104
- data/site/html5bp-docs/crossdomain.md +0 -21
- data/site/html5bp-docs/css.md +0 -135
- data/site/html5bp-docs/extend.md +0 -507
- data/site/html5bp-docs/faq.md +0 -77
- data/site/html5bp-docs/htaccess.md +0 -323
- data/site/html5bp-docs/html.md +0 -170
- data/site/html5bp-docs/js.md +0 -31
- data/site/html5bp-docs/misc.md +0 -25
- data/site/html5bp-docs/usage.md +0 -109
- data/site/readme.md +0 -47
- data/site/source/.htaccess +0 -540
- data/site/source/404.html +0 -157
- data/site/source/app/assets/javascripts/dependencies.js.coffee +0 -6
- data/site/source/app/assets/javascripts/docs/application.coffee +0 -64
- data/site/source/app/assets/javascripts/docs/collections/docs_documentation.coffee +0 -17
- data/site/source/app/assets/javascripts/docs/collections/github_repositories.coffee +0 -7
- data/site/source/app/assets/javascripts/docs/collections/index.coffee +0 -1
- data/site/source/app/assets/javascripts/docs/collections/luca_documentation.coffee +0 -17
- data/site/source/app/assets/javascripts/docs/collections/public_gists.coffee +0 -4
- data/site/source/app/assets/javascripts/docs/config.coffee +0 -5
- data/site/source/app/assets/javascripts/docs/index.coffee +0 -12
- data/site/source/app/assets/javascripts/docs/lib/router.coffee +0 -3
- data/site/source/app/assets/javascripts/docs/models/component.coffee +0 -99
- data/site/source/app/assets/javascripts/docs/models/github_repository.coffee +0 -3
- data/site/source/app/assets/javascripts/docs/models/index.coffee +0 -1
- data/site/source/app/assets/javascripts/docs/templates/component_documentation.jst.ejs +0 -55
- data/site/source/app/assets/javascripts/docs/templates/examples_browser/overview.jst.ejs +0 -4
- data/site/source/app/assets/javascripts/docs/templates/examples_browser/selector.jst.ejs +0 -11
- data/site/source/app/assets/javascripts/docs/templates/github_repository.jst.ejs +0 -4
- data/site/source/app/assets/javascripts/docs/templates/layouts/main.jst.ejs +0 -4
- data/site/source/app/assets/javascripts/docs/templates/left_navigation.jst.ejs +0 -5
- data/site/source/app/assets/javascripts/docs/templates/pages/getting_started.jst.ejs +0 -78
- data/site/source/app/assets/javascripts/docs/templates/pages/home.jst.ejs +0 -57
- data/site/source/app/assets/javascripts/docs/views/components/code_editor.coffee +0 -45
- data/site/source/app/assets/javascripts/docs/views/components/component_documentation.coffee +0 -72
- data/site/source/app/assets/javascripts/docs/views/index.coffee +0 -3
- data/site/source/app/assets/javascripts/docs/views/pages/browse_source/details.coffee +0 -37
- data/site/source/app/assets/javascripts/docs/views/pages/browse_source/list.coffee +0 -31
- data/site/source/app/assets/javascripts/docs/views/pages/browse_source.coffee +0 -46
- data/site/source/app/assets/javascripts/docs/views/pages/component_editor.coffee +0 -10
- data/site/source/app/assets/javascripts/docs/views/pages/examples_browser/docs.coffee +0 -12
- data/site/source/app/assets/javascripts/docs/views/pages/examples_browser/source.coffee +0 -13
- data/site/source/app/assets/javascripts/docs/views/pages/examples_browser.coffee +0 -102
- data/site/source/app/assets/javascripts/docs/views/pages/home.coffee +0 -10
- data/site/source/app/assets/javascripts/docs/views/views/api_browser/index.coffee +0 -43
- data/site/source/app/assets/javascripts/docs/views/views/collection_view_examples/grid_layout_view_example.coffee +0 -14
- data/site/source/app/assets/javascripts/docs/views/views/collection_view_examples/table_view_example.coffee +0 -39
- data/site/source/app/assets/javascripts/docs/views/views/form_view_examples/basic_example.coffee +0 -38
- data/site/source/app/assets/javascripts/docs/views/views/form_view_examples/complex_layout.coffee +0 -110
- data/site/source/app/assets/javascripts/docs/views/views/top_navigation.coffee +0 -6
- data/site/source/app/assets/javascripts/docs-docs.js +0 -1
- data/site/source/app/assets/javascripts/luca-docs.js +0 -1
- data/site/source/app/assets/javascripts/luca-framework-documentation.js +0 -1
- data/site/source/app/assets/javascripts/site.js.coffee +0 -4
- data/site/source/app/assets/javascripts/vendor/codemirror.js +0 -4786
- data/site/source/app/assets/javascripts/vendor/coffeescript.js +0 -346
- data/site/source/app/assets/javascripts/vendor/css.js +0 -465
- data/site/source/app/assets/javascripts/vendor/htmlmixed.js +0 -84
- data/site/source/app/assets/javascripts/vendor/javascript.js +0 -422
- data/site/source/app/assets/javascripts/vendor/js-beautify.js +0 -1353
- data/site/source/app/assets/javascripts/vendor/modernizr-2.6.1.min.js +0 -4
- data/site/source/app/assets/javascripts/vendor/vim.js +0 -2511
- data/site/source/app/assets/stylesheets/docs/api-browser.css.scss +0 -5
- data/site/source/app/assets/stylesheets/docs/application.css.scss +0 -35
- data/site/source/app/assets/stylesheets/docs/browse-source.css.scss +0 -5
- data/site/source/app/assets/stylesheets/docs/scrollable-table.css.scss +0 -5
- data/site/source/app/assets/stylesheets/site.css.scss +0 -2
- data/site/source/app/assets/stylesheets/vendor/codemirror.css +0 -240
- data/site/source/app/assets/stylesheets/vendor/prettify-tomorrow-night-bright.css +0 -160
- data/site/source/app/assets/stylesheets/vendor/twilight.css +0 -26
- data/site/source/crossdomain.xml +0 -15
- data/site/source/documentation.html.haml +0 -1
- data/site/source/favicon_base.png +0 -0
- data/site/source/humans.txt +0 -15
- data/site/source/images/background.png +0 -0
- data/site/source/images/middleman.png +0 -0
- data/site/source/index.html.haml +0 -1
- data/site/source/layouts/layout.haml +0 -55
- data/site/source/readme.md +0 -63
- data/site/source/robots.txt +0 -3
- data/spec/javascripts/components/collection_view_spec.coffee +0 -59
- data/spec/javascripts/components/controller_spec.coffee +0 -62
- data/spec/javascripts/components/form_view_spec.coffee +0 -162
- data/spec/javascripts/components/multi_collection_view_spec.coffee +0 -5
- data/spec/javascripts/components/table_view_spec.coffee +0 -17
- data/spec/javascripts/concerns/collection_event_bindings_spec.coffee +0 -15
- data/spec/javascripts/concerns/dom_helpers_spec.coffee +0 -16
- data/spec/javascripts/concerns/filterable_spec.coffee +0 -25
- data/spec/javascripts/concerns/model_presenter_spec.coffee +0 -31
- data/spec/javascripts/concerns/state_model_spec.coffee +0 -55
- data/spec/javascripts/containers/card_view_spec.coffee +0 -108
- data/spec/javascripts/core/concerns_spec.coffee +0 -88
- data/spec/javascripts/core/container_spec.coffee +0 -287
- data/spec/javascripts/core/define_spec.coffee +0 -116
- data/spec/javascripts/core/events_spec.coffee +0 -26
- data/spec/javascripts/core/field_spec.coffee +0 -4
- data/spec/javascripts/core/util_spec.coffee +0 -24
- data/spec/javascripts/dependencies/index.coffee +0 -3
- data/spec/lib/component_definition_spec.rb +0 -63
- data/spec/lib/input_compiler_spec.rb +0 -9
- data/spec/lib/luca_application_spec.rb +0 -30
- data/spec/support/fixtures/application.coffee +0 -45
- data/spec/support/fixtures/component.coffee +0 -34
- data/tutorials/component-driven-design.md +0 -140
- data/tutorials/structure-of-a-project.md +0 -63
- data/vendor/assets/javascripts/backbone-ext.js +0 -21
- data/vendor/assets/javascripts/backbone-min.js +0 -42
- data/vendor/assets/javascripts/backbone-query.min.js +0 -1
- data/vendor/assets/javascripts/bootstrap.min.js +0 -7
- data/vendor/assets/javascripts/codemirror-ui.js +0 -503
- data/vendor/assets/javascripts/hogan.js +0 -707
- data/vendor/assets/javascripts/inflections.js +0 -656
- data/vendor/assets/javascripts/jasmine-html.js +0 -190
- data/vendor/assets/javascripts/jasmine.js +0 -2476
- data/vendor/assets/javascripts/jquery.js +0 -5
- data/vendor/assets/javascripts/keymaster.min.js +0 -4
- data/vendor/assets/javascripts/luca-dependencies.min.js +0 -8
- data/vendor/assets/javascripts/luca-development.min.js +0 -1
- data/vendor/assets/javascripts/luca-spec.js +0 -11
- data/vendor/assets/javascripts/luca.full.min.js +0 -12
- data/vendor/assets/javascripts/luca.min.js +0 -5
- data/vendor/assets/javascripts/sinon.js +0 -3469
- data/vendor/assets/javascripts/underscore-min.js +0 -1
- data/vendor/assets/javascripts/underscore-string.min.js +0 -1
- data/vendor/assets/stylesheets/bootstrap-responsive.min.css +0 -9
- data/vendor/assets/stylesheets/bootstrap.min.css +0 -9
- data/vendor/assets/stylesheets/luca-components.css +0 -202
- data/vendor/assets/stylesheets/luca-development.css +0 -23
@@ -1,18 +1,13 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
collection.includes 'Luca.Events'
|
1
|
+
source = 'Backbone.Collection'
|
2
|
+
source = 'Backbone.QueryCollection' if Backbone.QueryCollection?
|
4
3
|
|
5
|
-
|
6
|
-
|
7
|
-
"after:response"
|
8
|
-
|
9
|
-
collection.publicConfiguration
|
10
|
-
model: Luca.Model
|
4
|
+
_.def("Luca.Collection").extends( source ).with
|
5
|
+
include: ['Luca.Events']
|
11
6
|
# cachedMethods refers to a list of methods on the collection
|
12
7
|
# whose value gets cached once it is ran. the collection then
|
13
8
|
# binds to change, add, remove, and reset events and then expires
|
14
9
|
# the cached value once these events are fired.
|
15
|
-
|
10
|
+
|
16
11
|
# cachedMethods expects an array of strings representing the method name
|
17
12
|
# or objects containing @method and @resetEvents properties. by default
|
18
13
|
# @resetEvents are 'add','remove',reset' and 'change'.
|
@@ -22,19 +17,9 @@ collection.publicConfiguration
|
|
22
17
|
# and return the filtered results that way, then set this to true
|
23
18
|
remoteFilter: false
|
24
19
|
|
25
|
-
# setting a cache key to a string, or to a function which returns
|
26
|
-
# a string, will determine where the collections' models are pulled
|
27
|
-
# from if they are available on page load. also known as "bootstrapping"
|
28
|
-
# your collections with data. The cache key will look in whatever object
|
29
|
-
# is set in Luca.config.modelBootstrap for its models.
|
30
|
-
cache_key: undefined
|
31
|
-
|
32
|
-
# Which CollectionManager should we register with? Expects either a string
|
33
|
-
# which will get resolved into a global variable, or a
|
34
|
-
manager: undefined
|
35
|
-
|
36
20
|
initialize: (models=[], @options)->
|
37
21
|
_.extend @, @options
|
22
|
+
@setupMethodCaching()
|
38
23
|
@_reset()
|
39
24
|
|
40
25
|
# By specifying a @cache_key property or method, you can instruct
|
@@ -46,7 +31,7 @@ collection.publicConfiguration
|
|
46
31
|
console.log 'The @cached property of Luca.Collection is being deprecated. Please change to cache_key'
|
47
32
|
|
48
33
|
if @cache_key ||= @cached
|
49
|
-
@bootstrap_cache_key =
|
34
|
+
@bootstrap_cache_key = if _.isFunction( @cache_key ) then @cache_key() else @cache_key
|
50
35
|
|
51
36
|
if @registerAs or @registerWith
|
52
37
|
console.log "This configuration API is deprecated. use @name and @manager properties instead"
|
@@ -55,7 +40,7 @@ collection.publicConfiguration
|
|
55
40
|
@name ||= @registerAs
|
56
41
|
@manager ||= @registerWith
|
57
42
|
|
58
|
-
@manager =
|
43
|
+
@manager = if _.isFunction(@manager) then @manager() else @manager
|
59
44
|
|
60
45
|
# if they specify a
|
61
46
|
if @name and not @manager
|
@@ -67,8 +52,8 @@ collection.publicConfiguration
|
|
67
52
|
# to be scoped with some sort of unique id, as say some sort of belongsTo relationship
|
68
53
|
# then you can specify @registerAs as a method()
|
69
54
|
if @manager
|
70
|
-
@name ||=
|
71
|
-
@name =
|
55
|
+
@name ||= @cache_key()
|
56
|
+
@name = if _.isFunction( @name ) then @name() else @name
|
72
57
|
|
73
58
|
unless @private or @anonymous
|
74
59
|
@bind "after:initialize", ()=>
|
@@ -79,7 +64,7 @@ collection.publicConfiguration
|
|
79
64
|
# locally in localStorage
|
80
65
|
if @useLocalStorage is true and window.localStorage?
|
81
66
|
table = @bootstrap_cache_key || @name
|
82
|
-
throw "Must specify a
|
67
|
+
throw "Must specify either a cached or registerAs property to use localStorage"
|
83
68
|
@localStorage = new Luca.LocalStore( table )
|
84
69
|
|
85
70
|
# Populating a collection with local data
|
@@ -100,11 +85,6 @@ collection.publicConfiguration
|
|
100
85
|
if models
|
101
86
|
@reset models, silent: true, parse: options?.parse
|
102
87
|
|
103
|
-
Luca.concern.setup.call(@)
|
104
|
-
Luca.util.setupHooks.call(@, @hooks)
|
105
|
-
|
106
|
-
@setupMethodCaching()
|
107
|
-
|
108
88
|
@trigger "after:initialize"
|
109
89
|
|
110
90
|
# Luca.Collections will append a query string to the URL
|
@@ -153,43 +133,43 @@ collection.publicConfiguration
|
|
153
133
|
@
|
154
134
|
|
155
135
|
applyFilter: (filter={}, options={})->
|
156
|
-
options = _( options ).clone()
|
157
|
-
|
158
136
|
if options.remote? is true or @remoteFilter is true
|
159
137
|
@applyParams(filter)
|
160
|
-
@fetch _.extend(options,refresh:true
|
138
|
+
@fetch _.extend(options,refresh:true)
|
161
139
|
else
|
162
|
-
@reset @query
|
140
|
+
@reset @query filter
|
163
141
|
|
164
142
|
# You can apply params to a collection, so that any upcoming requests
|
165
143
|
# made to the REST API are made with the key values specified
|
166
144
|
applyParams: (params)->
|
167
|
-
@base_params = _( Luca.Collection.baseParams() ).clone()
|
145
|
+
@base_params = _( Luca.Collection.baseParams() ).clone()
|
168
146
|
_.extend @base_params, params
|
169
147
|
|
170
148
|
@
|
171
149
|
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
150
|
+
# If this collection is to be registered with some global collection
|
151
|
+
# tracker such as new Luca.CollectionManager() then we will register
|
152
|
+
# ourselves automatically
|
153
|
+
#
|
154
|
+
# To automatically register a collection with the registry, instantiate
|
155
|
+
# it with the registerWith property, which can either be a reference to
|
156
|
+
# the manager itself, or a string in case the manager isn't available
|
157
|
+
# at compile time
|
158
|
+
register: (collectionManager=Luca.CollectionManager.get(), key="", collection)->
|
159
|
+
throw "Can not register with a collection manager without a key" unless key.length >= 1
|
160
|
+
throw "Can not register with a collection manager without a valid collection manager" unless collectionManager?
|
178
161
|
|
179
162
|
# by passing a string instead of a reference to an object, we can look up
|
180
163
|
# that object only when necessary. this prevents us from having to create
|
181
164
|
# the manager instance before we can define our collections
|
182
165
|
if _.isString( collectionManager )
|
183
|
-
collectionManager = Luca.util.
|
166
|
+
collectionManager = Luca.util.nestedValue( collectionManager, (window || global) )
|
184
167
|
|
185
|
-
unless collectionManager
|
186
|
-
throw "Attempt to register with a non existent collection manager."
|
168
|
+
throw "Could not register with collection manager" unless collectionManager
|
187
169
|
|
188
170
|
if _.isFunction( collectionManager.add )
|
189
171
|
return collectionManager.add(key, collection)
|
190
172
|
|
191
|
-
# If we don't want to use the CollectionManager class, and just want
|
192
|
-
# to cache collection instances on an object, we can do that too.
|
193
173
|
if _.isObject( collectionManager )
|
194
174
|
collectionManager[ key ] = collection
|
195
175
|
|
@@ -225,7 +205,7 @@ collection.publicConfiguration
|
|
225
205
|
# fetch will try to pull from the bootstrap if it is setup to do so
|
226
206
|
# you can actually make the roundtrip to the server anyway if you pass
|
227
207
|
# refresh = true in the options hash
|
228
|
-
return @bootstrap() if @cached_models().length and not
|
208
|
+
return @bootstrap() if @cached_models().length and not options.refresh
|
229
209
|
|
230
210
|
url = if _.isFunction(@url) then @url() else @url
|
231
211
|
|
@@ -244,11 +224,10 @@ collection.publicConfiguration
|
|
244
224
|
# reset trigger with a function wrapped in _.once
|
245
225
|
# so that it only gets run...ahem...once.
|
246
226
|
#
|
227
|
+
# that being said, if the collection already has models
|
247
228
|
# it won't even bother fetching it it will just run
|
248
229
|
# as if reset was already triggered
|
249
|
-
onceLoaded: (fn, options={})->
|
250
|
-
_.defaults(options, autoFetch: true)
|
251
|
-
|
230
|
+
onceLoaded: (fn, options={autoFetch:true})->
|
252
231
|
if @length > 0 and not @fetching
|
253
232
|
fn.apply @, [@]
|
254
233
|
return
|
@@ -259,7 +238,7 @@ collection.publicConfiguration
|
|
259
238
|
wrapped()
|
260
239
|
@unbind "reset", @
|
261
240
|
|
262
|
-
unless @fetching or not
|
241
|
+
unless @fetching or not options.autoFetch
|
263
242
|
@fetch()
|
264
243
|
|
265
244
|
# ifLoaded is equivalent to binding to the reset trigger with
|
@@ -277,6 +256,17 @@ collection.publicConfiguration
|
|
277
256
|
unless @fetching is true or !options.autoFetch or @length > 0
|
278
257
|
@fetch()
|
279
258
|
|
259
|
+
# parse is very close to the stock Backbone.Collection parse, which
|
260
|
+
# just returns the response. However, it also triggers a callback
|
261
|
+
# after:response, and automatically parses responses which contain
|
262
|
+
# a JSON root like you would see in rails, if you specify the @root
|
263
|
+
# property.
|
264
|
+
#
|
265
|
+
# it will also update the Luca.Collection.cache with the models from
|
266
|
+
# the response, so that any subsequent calls to fetch() on a bootstrapped
|
267
|
+
# collection, will have updated models from the server. Really only
|
268
|
+
# useful if you call fetch(refresh:true) manually on any bootstrapped
|
269
|
+
# collection
|
280
270
|
parse: (response)->
|
281
271
|
@fetching = false
|
282
272
|
@trigger "after:response", response
|
@@ -306,8 +296,6 @@ collection.publicConfiguration
|
|
306
296
|
@clearMethodCache(name)
|
307
297
|
|
308
298
|
setupMethodCaching: ()->
|
309
|
-
return unless @cachedMethods?.length > 0
|
310
|
-
|
311
299
|
collection = @
|
312
300
|
membershipEvents = ["reset","add","remove"]
|
313
301
|
cache = @_methodCache = {}
|
@@ -322,7 +310,7 @@ collection.publicConfiguration
|
|
322
310
|
|
323
311
|
# wrap the collection method with a basic memoize operation
|
324
312
|
collection[ method ] = ()->
|
325
|
-
cache[method].value ||= cache[method].original.apply
|
313
|
+
cache[method].value ||= cache[method].original.apply collection, arguments
|
326
314
|
|
327
315
|
# bind to events on the collection, which once triggered, will
|
328
316
|
# invalidate the cached value. causing us to have to restore it
|
@@ -333,33 +321,19 @@ collection.publicConfiguration
|
|
333
321
|
dependencies = method.split(':')[1]
|
334
322
|
|
335
323
|
if dependencies
|
336
|
-
|
337
|
-
|
338
|
-
_( watchForChangesOn ).each (dependency)->
|
324
|
+
for dependency in dependencies.split(",")
|
339
325
|
collection.bind "change:#{dependency}", ()->
|
340
326
|
collection.clearMethodCache(method: method)
|
341
327
|
|
342
|
-
|
343
328
|
# make sure the querying interface from backbone.query is present
|
344
329
|
# in the case backbone-query isn't loaded. without it, it will
|
345
330
|
# just return the models
|
346
|
-
#
|
347
|
-
# TODO:
|
348
|
-
#
|
349
|
-
# Currently the View mixins: Filterable, Sortable, and Paginatable
|
350
|
-
# implement a lot of logic that belongs in this interface.
|
351
331
|
query: (filter={},options={})->
|
352
332
|
if Backbone.QueryCollection?
|
353
|
-
|
354
|
-
filter = prepare(filter)
|
355
|
-
|
356
|
-
return Backbone.QueryCollection::query.call(@, filter, options)
|
333
|
+
return Backbone.QueryCollection::query.apply(@, arguments)
|
357
334
|
else
|
358
335
|
@models
|
359
336
|
|
360
|
-
collection.register()
|
361
|
-
|
362
|
-
|
363
337
|
# Global Collection Observer
|
364
338
|
_.extend Luca.Collection.prototype,
|
365
339
|
trigger: ()->
|
@@ -369,38 +343,18 @@ _.extend Luca.Collection.prototype,
|
|
369
343
|
|
370
344
|
Backbone.View.prototype.trigger.apply @, arguments
|
371
345
|
|
372
|
-
Luca.Collection._originalExtend = Backbone.Collection.extend
|
373
|
-
|
374
|
-
Luca.Collection.extend = (definition={})->
|
375
|
-
# for backward compatibility
|
376
|
-
definition.concerns ||= definition.concerns if definition.concerns?
|
377
|
-
|
378
|
-
componentClass = Luca.Collection._originalExtend.call(@, definition)
|
379
|
-
|
380
|
-
if definition.concerns? and _.isArray( definition.concerns )
|
381
|
-
for module in definition.concerns
|
382
|
-
Luca.decorate( componentClass ).with( module )
|
383
|
-
|
384
|
-
componentClass
|
385
|
-
|
386
|
-
Luca.Collection.namespace = (namespace)->
|
387
|
-
namespace = Luca.util.resolve(namespace) if _.isString(namespace)
|
388
|
-
Luca.Collection.__defaultNamespace = namespace if namespace?
|
389
|
-
Luca.Collection.__defaultNamespace ||= (window || global)
|
390
|
-
Luca.util.read( Luca.Collection.__defaultNamespace )
|
391
|
-
|
392
346
|
# Always include these parameters in every request to your REST API.
|
393
347
|
#
|
394
348
|
# either specify a function which returns a hash, or just a normal hash
|
395
349
|
Luca.Collection.baseParams = (obj)->
|
396
|
-
|
397
|
-
|
350
|
+
return Luca.Collection._baseParams = obj if obj
|
351
|
+
|
352
|
+
if _.isFunction( Luca.Collection._baseParams )
|
353
|
+
return Luca.Collection._baseParams()
|
398
354
|
|
399
|
-
|
355
|
+
if _.isObject( Luca.Collection._baseParams )
|
356
|
+
Luca.Collection._baseParams
|
400
357
|
|
401
|
-
Luca.Collection.resetBaseParams = ()->
|
402
|
-
Luca.Collection._baseParams = {}
|
403
|
-
|
404
358
|
# In order to make our Backbone Apps super fast it is a good practice
|
405
359
|
# to pre-populate your collections by what is referred to as bootstrapping
|
406
360
|
#
|
@@ -0,0 +1,374 @@
|
|
1
|
+
# The Component Container
|
2
|
+
#
|
3
|
+
# The Component Container is a nestable component
|
4
|
+
# which are responsible for handling communication between multiple
|
5
|
+
# nested views.
|
6
|
+
#
|
7
|
+
# One: Layout
|
8
|
+
#
|
9
|
+
# a container is responsible for laying out the nested views
|
10
|
+
# and rendering them in a special DOM element
|
11
|
+
doLayout = ()->
|
12
|
+
@trigger "before:layout", @
|
13
|
+
@prepareLayout()
|
14
|
+
@trigger "after:layout", @
|
15
|
+
|
16
|
+
# and displaying those elements in a way that is
|
17
|
+
# optimal for the desired user experience of that view
|
18
|
+
# ( i.e seeing only one of them at a time, seeing them side by side )
|
19
|
+
applyDOMConfig = (panel, panelIndex)->
|
20
|
+
style_declarations = []
|
21
|
+
|
22
|
+
style_declarations.push "height: #{ (if _.isNumber(panel.height) then panel.height + 'px' else panel.height ) }" if panel.height?
|
23
|
+
style_declarations.push "width: #{ (if _.isNumber(panel.width) then panel.width + 'px' else panel.width ) }" if panel.width?
|
24
|
+
style_declarations.push "float: #{ panel.float }" if panel.float
|
25
|
+
|
26
|
+
config =
|
27
|
+
class: panel?.classes || @componentClass
|
28
|
+
id: "#{ @cid }-#{ panelIndex }"
|
29
|
+
style: style_declarations.join(';')
|
30
|
+
"data-luca-owner" : @name || @cid
|
31
|
+
|
32
|
+
if @customizeContainerEl?
|
33
|
+
config = @customizeContainerEl( config, panel, panelIndex )
|
34
|
+
|
35
|
+
config
|
36
|
+
|
37
|
+
# Two: Component Creation
|
38
|
+
#
|
39
|
+
# A container is responsible for creating and storing references to the nested
|
40
|
+
# views that are required for its functioning.
|
41
|
+
doComponents = ()->
|
42
|
+
|
43
|
+
@trigger "before:components", @, @components
|
44
|
+
@prepareComponents()
|
45
|
+
@createComponents()
|
46
|
+
@trigger "before:render:components", @, @components
|
47
|
+
@renderComponents()
|
48
|
+
@trigger "after:components", @, @components
|
49
|
+
|
50
|
+
|
51
|
+
# Containers are central to Luca. They are what make it easy to structure
|
52
|
+
# your application in a logical way and to specify much of the behavior of
|
53
|
+
# complex / composite views at define time using JSON syntax combined with
|
54
|
+
# the meta data contained in the Luca component registry.
|
55
|
+
_.def('Luca.core.Container').extends('Luca.components.Panel').with
|
56
|
+
|
57
|
+
className: 'luca-ui-container'
|
58
|
+
|
59
|
+
componentTag: 'div'
|
60
|
+
componentClass: 'luca-ui-panel'
|
61
|
+
|
62
|
+
isContainer: true
|
63
|
+
|
64
|
+
hooks:[
|
65
|
+
"before:components"
|
66
|
+
"before:render:components"
|
67
|
+
"before:layout"
|
68
|
+
"after:components"
|
69
|
+
"after:layout"
|
70
|
+
"first:activation"
|
71
|
+
]
|
72
|
+
|
73
|
+
rendered: false
|
74
|
+
|
75
|
+
components: []
|
76
|
+
|
77
|
+
initialize: (@options={})->
|
78
|
+
_.extend @, @options
|
79
|
+
|
80
|
+
@setupHooks [
|
81
|
+
"before:components"
|
82
|
+
"before:render:components"
|
83
|
+
"before:layout"
|
84
|
+
"after:components"
|
85
|
+
"after:layout"
|
86
|
+
"first:activation"
|
87
|
+
]
|
88
|
+
|
89
|
+
Luca.View::initialize.apply @, arguments
|
90
|
+
|
91
|
+
# Rendering Pipeline
|
92
|
+
#
|
93
|
+
# A container has nested components. these components
|
94
|
+
# are automatically rendered inside their own DOM element
|
95
|
+
# and then CSS configuration is generally applied to these
|
96
|
+
# DOM elements. Each component is assigned to this DOM
|
97
|
+
# element by specifying a @container property on the component.
|
98
|
+
#
|
99
|
+
# Each component is instantiated by looking up its @ctype propery
|
100
|
+
# in the Luca Component Registry. Then the components are rendered
|
101
|
+
# by having their @render() method called on them.
|
102
|
+
#
|
103
|
+
# Any class which extends Luca.View will have its defined render method
|
104
|
+
# wrapped in a method which triggers "before:render", and "after:render"
|
105
|
+
# before and after the defined render method.
|
106
|
+
#
|
107
|
+
# so you can expect the following, for any container or nested container
|
108
|
+
#
|
109
|
+
# DOM Element Manipulation:
|
110
|
+
#
|
111
|
+
# beforeRender()
|
112
|
+
# beforeLayout()
|
113
|
+
# prepareLayout()
|
114
|
+
# afterLayout()
|
115
|
+
#
|
116
|
+
# Luca / Backbone Component Manipulation
|
117
|
+
#
|
118
|
+
# beforeComponents()
|
119
|
+
# prepareComponents()
|
120
|
+
# createComponents()
|
121
|
+
# beforeRenderComponents()
|
122
|
+
# renderComponents() ->
|
123
|
+
# calls render() on each component, starting this whole cycle
|
124
|
+
#
|
125
|
+
# afterComponents()
|
126
|
+
#
|
127
|
+
# DOM Injection
|
128
|
+
#
|
129
|
+
# render()
|
130
|
+
# afterRender()
|
131
|
+
#
|
132
|
+
# For Components which are originally hidden
|
133
|
+
# ( card view, tab view, etc )
|
134
|
+
#
|
135
|
+
# firstActivation()
|
136
|
+
#
|
137
|
+
beforeRender: ()->
|
138
|
+
doLayout.call(@)
|
139
|
+
doComponents.call(@)
|
140
|
+
Luca.components.Panel::beforeRender?.apply(@, arguments)
|
141
|
+
|
142
|
+
# Components which inherit from Luca.core.Container can implement
|
143
|
+
# their own versions of this method, if they need to apply any sort
|
144
|
+
# of additional styling / configuration for the DOM elements that
|
145
|
+
# are created to wrap each container.
|
146
|
+
customizeContainerEl: (containerEl, panel, panelIndex)->
|
147
|
+
containerEl
|
148
|
+
|
149
|
+
prepareLayout: ()->
|
150
|
+
container = @
|
151
|
+
@componentContainers = _( @components ).map (component, index)->
|
152
|
+
applyDOMConfig.call(container, component, index)
|
153
|
+
|
154
|
+
prepareComponents: ()->
|
155
|
+
# accept components as an array of strings representing
|
156
|
+
# the luca component type
|
157
|
+
for component in @components when _.isString(component)
|
158
|
+
component = (type: component)
|
159
|
+
|
160
|
+
_( @components ).each (component, index)=>
|
161
|
+
ce = componentContainerElement = @componentContainers?[index]
|
162
|
+
|
163
|
+
# support a variety of the bad naming conventions
|
164
|
+
ce.class = ce.class || ce.className || ce.classes
|
165
|
+
|
166
|
+
if @generateComponentElements
|
167
|
+
panel = @make(@componentTag, componentContainerElement, '')
|
168
|
+
@$append( panel )
|
169
|
+
|
170
|
+
unless component.container?
|
171
|
+
component.container = "##{ componentContainerElement.id }" if @generateComponentElements
|
172
|
+
component.container ||= @$bodyEl()
|
173
|
+
|
174
|
+
# create components is responsible for turning the JSON syntax of the
|
175
|
+
# container's definition into live objects against a given Luca Component
|
176
|
+
# type.
|
177
|
+
#
|
178
|
+
# In addition to this, a container builds an index of the components
|
179
|
+
# which belong to it, so that they can easily be looked up by name
|
180
|
+
createComponents: ()->
|
181
|
+
return if @componentsCreated is true
|
182
|
+
|
183
|
+
map = @componentIndex =
|
184
|
+
name_index: {}
|
185
|
+
cid_index: {}
|
186
|
+
|
187
|
+
@components = _( @components ).map (object, index)=>
|
188
|
+
|
189
|
+
# you can include normal backbone views as components
|
190
|
+
# you will want to make sure your render method handles
|
191
|
+
# adding the views @$el to the appropriate @container.
|
192
|
+
|
193
|
+
# you can also just pass a string representing the component_type
|
194
|
+
component = if Luca.isBackboneView( object )
|
195
|
+
object
|
196
|
+
else
|
197
|
+
object.type ||= object.ctype
|
198
|
+
|
199
|
+
if !object.type?
|
200
|
+
if object.components?
|
201
|
+
object.type = object.ctype = 'container'
|
202
|
+
else
|
203
|
+
object.type = object.ctype = Luca.defaultComponentType
|
204
|
+
|
205
|
+
Luca.util.lazyComponent( object )
|
206
|
+
|
207
|
+
# if you define a @getter property as a string on your component
|
208
|
+
# we will create a function with that name on this container that
|
209
|
+
# allows you to access this component
|
210
|
+
if _.isString( component.getter )
|
211
|
+
@[ component.getter ] = (()-> component)
|
212
|
+
|
213
|
+
# if we're using base backbone views, then they don't extend themselves
|
214
|
+
# with their passed options, so this is a workaround to get them to
|
215
|
+
# pick up the container config property
|
216
|
+
if !component.container and component.options.container
|
217
|
+
component.container = component.options.container
|
218
|
+
|
219
|
+
if map and component.cid?
|
220
|
+
map.cid_index[ component.cid ] = index
|
221
|
+
|
222
|
+
if map and component.name?
|
223
|
+
map.name_index[ component.name ] = index
|
224
|
+
|
225
|
+
component
|
226
|
+
|
227
|
+
@componentsCreated = true
|
228
|
+
|
229
|
+
@registerComponentEvents() unless _.isEmpty(@componentEvents)
|
230
|
+
|
231
|
+
map
|
232
|
+
|
233
|
+
# Trigger the Rendering Pipeline process on all of the nested
|
234
|
+
# components
|
235
|
+
renderComponents: (@debugMode="")->
|
236
|
+
@debug "container render components"
|
237
|
+
|
238
|
+
container = @
|
239
|
+
_(@components).each (component)->
|
240
|
+
component.getParent = ()->
|
241
|
+
container
|
242
|
+
|
243
|
+
try
|
244
|
+
$( component.container ).append( component.el )
|
245
|
+
component.render()
|
246
|
+
catch e
|
247
|
+
console.log "Error Rendering Component #{ component.name || component.cid }", component
|
248
|
+
|
249
|
+
if _.isObject(e)
|
250
|
+
console.log e.message
|
251
|
+
console.log e.stack
|
252
|
+
|
253
|
+
throw e unless Luca.silenceRenderErrors? is true
|
254
|
+
|
255
|
+
#### Container Activation
|
256
|
+
#
|
257
|
+
# When a container is first activated is a good time to perform
|
258
|
+
# operations which are not needed unless that component becomes
|
259
|
+
# visible. This first activation event should be relayed to all
|
260
|
+
# of the nested components. Components which hide / display
|
261
|
+
# other components, such as a CardView or TabContainer
|
262
|
+
# will trigger first:activation on the components as they become
|
263
|
+
# displayed.
|
264
|
+
firstActivation: ()->
|
265
|
+
activator = @
|
266
|
+
@each (component, index)->
|
267
|
+
# apply the first:activation trigger on the component, in the context of the component
|
268
|
+
# passing as arguments the component itself, and the component doing the activation
|
269
|
+
unless component?.previously_activated is true
|
270
|
+
component?.trigger?.call component, "first:activation", component, activator
|
271
|
+
component.previously_activated = true
|
272
|
+
|
273
|
+
#### Underscore Methods For Working with Components
|
274
|
+
pluck: (attribute)->
|
275
|
+
_( @components ).pluck attribute
|
276
|
+
|
277
|
+
invoke: (method)->
|
278
|
+
_( @components ).invoke method
|
279
|
+
|
280
|
+
map: (fn)->
|
281
|
+
_( @components ).map(fn)
|
282
|
+
|
283
|
+
# event binding sugar for nested components
|
284
|
+
#
|
285
|
+
# you can define events like:
|
286
|
+
|
287
|
+
# _.def("MyContainer").extends("Luca.View").with
|
288
|
+
# componentEvents:
|
289
|
+
# "component_name before:load" : "mySpecialHandler"
|
290
|
+
componentEvents: {}
|
291
|
+
|
292
|
+
registerComponentEvents: ()->
|
293
|
+
for listener, handler of @componentEvents
|
294
|
+
[componentName,trigger] = listener.split(' ')
|
295
|
+
component = @findComponentByName(componentName)
|
296
|
+
component?.bind trigger, @[handler]
|
297
|
+
|
298
|
+
findComponentByName: (name, deep=false)->
|
299
|
+
@findComponent(name, "name_index", deep)
|
300
|
+
|
301
|
+
findComponentById: (id, deep=false)->
|
302
|
+
@findComponent(id, "cid_index", deep)
|
303
|
+
|
304
|
+
findComponent: (needle, haystack="name", deep=false)->
|
305
|
+
@createComponents() unless @componentsCreated is true
|
306
|
+
|
307
|
+
position = @componentIndex?[ haystack ][ needle ]
|
308
|
+
component = @components?[ position ]
|
309
|
+
|
310
|
+
return component if component
|
311
|
+
|
312
|
+
if deep is true
|
313
|
+
sub_container = _( @components ).detect (component)-> component?.findComponent?(needle, haystack, true)
|
314
|
+
sub_container?.findComponent?(needle, haystack, true)
|
315
|
+
|
316
|
+
each: (fn)->
|
317
|
+
@eachComponent(fn, false)
|
318
|
+
|
319
|
+
# run a function for each component in this container
|
320
|
+
# and any nested containers in those components, recursively
|
321
|
+
# pass false as the second argument to skip the deep recursion
|
322
|
+
eachComponent: (fn, deep=true)->
|
323
|
+
_( @components ).each (component, index)=>
|
324
|
+
fn.call component, component, index
|
325
|
+
component?.eachComponent?.apply component, [fn,deep] if deep
|
326
|
+
|
327
|
+
indexOf: (name)->
|
328
|
+
names = _( @components ).pluck('name')
|
329
|
+
_( names ).indexOf(name)
|
330
|
+
|
331
|
+
activeComponent: ()->
|
332
|
+
return @ unless @activeItem
|
333
|
+
return @components[ @activeItem ]
|
334
|
+
|
335
|
+
componentElements: ()->
|
336
|
+
@$(">.#{ @componentClass }", @$bodyEl())
|
337
|
+
|
338
|
+
getComponent: (needle)->
|
339
|
+
@components[ needle ]
|
340
|
+
|
341
|
+
rootComponent: ()->
|
342
|
+
console.log "Calling rootComponent will be deprecated. use isRootComponent instead"
|
343
|
+
!@getParent?
|
344
|
+
|
345
|
+
isRootComponent:()->
|
346
|
+
!@getParent?
|
347
|
+
|
348
|
+
getRootComponent: ()->
|
349
|
+
if @rootComponent() then @ else @getParent().getRootComponent()
|
350
|
+
|
351
|
+
selectByAttribute: (attribute, value, deep=false)->
|
352
|
+
components = _( @components ).map (component)->
|
353
|
+
matches = []
|
354
|
+
test = component[ attribute ]
|
355
|
+
|
356
|
+
matches.push( component ) if test is value
|
357
|
+
|
358
|
+
# recursively traverse our components
|
359
|
+
matches.push component.selectByAttribute?(attribute, value, true) if deep is true
|
360
|
+
|
361
|
+
_.compact matches
|
362
|
+
|
363
|
+
_.flatten( components )
|
364
|
+
|
365
|
+
select: (attribute, value, deep=false)->
|
366
|
+
console.log "Container.select will be replaced by selectByAttribute in 1.0"
|
367
|
+
Luca.core.Container::selectByAttribute.apply(@, arguments)
|
368
|
+
|
369
|
+
# This is the method by which a container injects the rendered child views
|
370
|
+
# into the DOM. It will get passed the container object, and the component
|
371
|
+
# that is being rendered.
|
372
|
+
Luca.core.Container.componentRenderer = (container, component)->
|
373
|
+
attachMethod = $( component.container )[ component.attachWith || "append" ]
|
374
|
+
attachMethod( component.render().el )
|
File without changes
|