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