luca 0.9.8 → 0.9.9
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +49 -0
- data/Gemfile +8 -1
- data/Gemfile.lock +97 -53
- data/Guardfile +3 -25
- data/README.md +5 -16
- data/ROADMAP +15 -9
- data/Rakefile +24 -75
- data/app.rb +10 -42
- data/app/assets/javascripts/luca/basic.coffee +1 -1
- data/app/assets/javascripts/luca/components/application.coffee +187 -104
- data/app/assets/javascripts/luca/components/collection_view.coffee +115 -51
- data/app/assets/javascripts/luca/components/controller.coffee +87 -10
- data/app/assets/javascripts/luca/components/fields/base.coffee +74 -13
- data/app/assets/javascripts/luca/components/fields/button_field.coffee +60 -13
- data/app/assets/javascripts/luca/components/fields/checkbox_array.coffee +12 -7
- data/app/assets/javascripts/luca/components/fields/select_field.coffee +82 -23
- data/app/assets/javascripts/luca/components/fields/text_area_field.coffee +25 -10
- data/app/assets/javascripts/luca/components/fields/text_field.coffee +9 -3
- data/app/assets/javascripts/luca/components/form_view.coffee +105 -33
- data/app/assets/javascripts/luca/components/grid_layout_view.coffee +42 -0
- data/app/assets/javascripts/luca/components/index.coffee +6 -0
- data/app/assets/javascripts/luca/components/nav_bar.coffee +60 -6
- data/app/assets/javascripts/luca/components/page.coffee +70 -0
- data/app/assets/javascripts/luca/components/simple_collection_view.coffee +10 -0
- data/app/assets/javascripts/luca/components/table_view.coffee +7 -3
- data/app/assets/javascripts/luca/components/table_view_scrollable.coffee +23 -0
- data/app/assets/javascripts/luca/concerns/collection_event_bindings.coffee +4 -1
- data/app/assets/javascripts/luca/concerns/development_tool_helpers.coffee +23 -14
- data/app/assets/javascripts/luca/concerns/dom_helpers.coffee +2 -2
- data/app/assets/javascripts/luca/concerns/filterable.coffee +8 -11
- data/app/assets/javascripts/luca/concerns/form_model_bindings.coffee +20 -0
- data/app/assets/javascripts/luca/concerns/modal_view.coffee +40 -15
- data/app/assets/javascripts/luca/concerns/query_collection_bindings.coffee +7 -1
- data/app/assets/javascripts/luca/concerns/state_model.coffee +40 -26
- data/app/assets/javascripts/luca/concerns/templating.coffee +3 -1
- data/app/assets/javascripts/luca/config.coffee +5 -0
- data/app/assets/javascripts/luca/containers/card_view.coffee +87 -52
- data/app/assets/javascripts/luca/containers/container.coffee +305 -108
- data/app/assets/javascripts/luca/containers/modal_view.coffee +9 -9
- data/app/assets/javascripts/luca/containers/page_controller.coffee +25 -0
- data/app/assets/javascripts/luca/containers/panel_toolbar.coffee +5 -6
- data/app/assets/javascripts/luca/containers/tab_view.coffee +19 -10
- data/app/assets/javascripts/luca/containers/viewport.coffee +12 -16
- data/app/assets/javascripts/luca/core/collection.coffee +19 -5
- data/app/assets/javascripts/luca/core/events.coffee +5 -5
- data/app/assets/javascripts/luca/core/model.coffee +1 -1
- data/app/assets/javascripts/luca/core/panel.coffee +18 -6
- data/app/assets/javascripts/luca/core/registry/component_definition.coffee +2 -1
- data/app/assets/javascripts/luca/core/registry/meta_data.coffee +2 -0
- data/app/assets/javascripts/luca/core/registry/registry.coffee +14 -11
- data/app/assets/javascripts/luca/core/templates.coffee +5 -1
- data/app/assets/javascripts/luca/core/view.coffee +200 -47
- data/app/assets/javascripts/luca/dependencies.coffee +2 -0
- data/app/assets/javascripts/luca/development/code_sync_manager.coffee +173 -0
- data/app/assets/javascripts/luca/development/component.coffee +76 -0
- data/app/assets/javascripts/luca/development/components.coffee +57 -0
- data/app/assets/javascripts/luca/development/console.coffee +1 -1
- data/app/assets/javascripts/luca/development/index.coffee +4 -1
- data/app/assets/javascripts/luca/framework.coffee +7 -3
- data/app/assets/javascripts/luca/index.coffee +2 -1
- data/app/assets/javascripts/luca/managers/collection_manager.coffee +2 -3
- data/app/assets/javascripts/luca/managers/index.coffee +1 -1
- data/app/assets/javascripts/luca/managers/socket_manager.coffee +31 -8
- data/app/assets/javascripts/luca/templates/components/nav_bar.jst.ejs +16 -1
- data/app/assets/javascripts/luca/templates/containers/tab_view.jst.ejs +1 -1
- data/app/assets/javascripts/luca/util/index.coffee +1 -0
- data/app/assets/javascripts/luca/util/keybindings.coffee +24 -0
- data/app/assets/javascripts/luca/util/logging.coffee +15 -0
- data/app/assets/javascripts/luca/util/luca.coffee +9 -1
- data/app/assets/stylesheets/luca/components/table_view.scss +85 -0
- data/app/assets/stylesheets/luca/components/viewport.scss +0 -4
- data/app/assets/stylesheets/luca/containers/container.scss +8 -0
- data/app/assets/stylesheets/luca/index.css +2 -2
- data/bin/luca +14 -0
- data/config.ru +1 -2
- data/docs/framework.json +1 -0
- data/docs/luca-framework-documentation.js +1 -0
- data/docs/{application.md → old/application.md} +0 -0
- data/docs/{collection.md → old/collection.md} +0 -0
- data/docs/{collection_manager.md → old/collection_manager.md} +0 -0
- data/docs/{container_philosophy.md → old/container_philosophy.md} +0 -0
- data/docs/{event_binding_helpers.md → old/event_binding_helpers.md} +0 -0
- data/docs/{method_caching_and_computed_properties.md → old/method_caching_and_computed_properties.md} +0 -0
- data/docs/{view.md → old/view.md} +0 -0
- data/lib/generators/luca/application/templates/javascripts/dependencies.coffee +2 -5
- data/lib/guard/luca.rb +84 -0
- data/lib/luca.rb +25 -1
- data/lib/luca/asset_compiler.rb +117 -0
- data/lib/luca/cli.rb +68 -0
- data/lib/luca/cli/generate.rb +37 -0
- data/lib/luca/cli/server.rb +20 -0
- data/lib/luca/cli/sync.rb +40 -0
- data/lib/luca/cli/watch.rb +16 -0
- data/lib/luca/collection.rb +64 -0
- data/lib/luca/collection/endpoint.rb +38 -0
- data/lib/luca/collection/file_backend.rb +121 -0
- data/lib/luca/collection/redis_backend.rb +153 -0
- data/lib/luca/compiled_asset.rb +61 -0
- data/lib/luca/component_definition.rb +356 -0
- data/lib/luca/luca_application.rb +258 -0
- data/lib/luca/project.rb +73 -0
- data/lib/luca/project_harness.rb +96 -0
- data/lib/luca/rails.rb +5 -3
- data/lib/luca/rails/engine.rb +8 -0
- data/lib/luca/rails/version.rb +1 -2
- data/lib/luca/server.rb +7 -0
- data/lib/luca/stylesheet.rb +35 -0
- data/lib/luca/template.rb +2 -0
- data/lib/luca/template_asset.rb +64 -0
- data/lib/luca/version.rb +3 -0
- data/lib/luca/watcher.rb +72 -0
- data/lib/railties/luca/tasks.rake +7 -0
- data/site/.bundle/config +2 -0
- data/site/.gitignore +5 -0
- data/site/.rvmrc +1 -0
- data/site/CHANGELOG.md +41 -0
- data/site/DOCS.md +41 -0
- data/site/Gemfile +8 -0
- data/site/Gemfile.lock +134 -0
- data/site/LICENSE.md +19 -0
- data/site/config.rb +84 -0
- data/site/helpers/site_helpers.rb +20 -0
- data/site/html5bp-docs/README.md +38 -0
- data/site/html5bp-docs/contribute.md +104 -0
- data/site/html5bp-docs/crossdomain.md +21 -0
- data/site/html5bp-docs/css.md +135 -0
- data/site/html5bp-docs/extend.md +507 -0
- data/site/html5bp-docs/faq.md +77 -0
- data/site/html5bp-docs/htaccess.md +323 -0
- data/site/html5bp-docs/html.md +170 -0
- data/site/html5bp-docs/js.md +31 -0
- data/site/html5bp-docs/misc.md +25 -0
- data/site/html5bp-docs/usage.md +109 -0
- data/site/readme.md +47 -0
- data/site/source/.htaccess +540 -0
- data/site/source/404.html +157 -0
- data/site/source/app/assets/javascripts/dependencies.js.coffee +6 -0
- data/site/source/app/assets/javascripts/docs-docs.js +1 -0
- data/site/source/app/assets/javascripts/docs/application.coffee +64 -0
- data/site/source/app/assets/javascripts/docs/collections/docs_documentation.coffee +17 -0
- data/site/source/app/assets/javascripts/docs/collections/github_repositories.coffee +7 -0
- data/site/source/app/assets/javascripts/docs/collections/index.coffee +1 -0
- data/site/source/app/assets/javascripts/docs/collections/luca_documentation.coffee +17 -0
- data/site/source/app/assets/javascripts/docs/collections/public_gists.coffee +4 -0
- data/site/source/app/assets/javascripts/docs/config.coffee +5 -0
- data/site/source/app/assets/javascripts/docs/index.coffee +12 -0
- data/site/source/app/assets/javascripts/docs/lib/router.coffee +3 -0
- data/{spec/components/application_spec.coffee → site/source/app/assets/javascripts/docs/lib/util.coffee} +0 -0
- data/site/source/app/assets/javascripts/docs/models/component.coffee +99 -0
- data/site/source/app/assets/javascripts/docs/models/github_repository.coffee +3 -0
- data/site/source/app/assets/javascripts/docs/models/index.coffee +1 -0
- data/site/source/app/assets/javascripts/docs/templates/component_documentation.jst.ejs +55 -0
- data/site/source/app/assets/javascripts/docs/templates/examples_browser/overview.jst.ejs +4 -0
- data/site/source/app/assets/javascripts/docs/templates/examples_browser/selector.jst.ejs +11 -0
- data/site/source/app/assets/javascripts/docs/templates/github_repository.jst.ejs +4 -0
- data/site/source/app/assets/javascripts/docs/templates/layouts/main.jst.ejs +4 -0
- data/site/source/app/assets/javascripts/docs/templates/left_navigation.jst.ejs +5 -0
- data/site/source/app/assets/javascripts/docs/templates/pages/getting_started.jst.ejs +78 -0
- data/site/source/app/assets/javascripts/docs/templates/pages/home.jst.ejs +57 -0
- data/site/source/app/assets/javascripts/docs/views/components/code_editor.coffee +45 -0
- data/{spec/components/collection_loader_view_spec.coffee → site/source/app/assets/javascripts/docs/views/components/code_editor/index.coffee} +0 -0
- data/site/source/app/assets/javascripts/docs/views/components/component_documentation.coffee +72 -0
- data/site/source/app/assets/javascripts/docs/views/index.coffee +3 -0
- data/site/source/app/assets/javascripts/docs/views/pages/browse_source.coffee +46 -0
- data/site/source/app/assets/javascripts/docs/views/pages/browse_source/details.coffee +37 -0
- data/site/source/app/assets/javascripts/docs/views/pages/browse_source/list.coffee +31 -0
- data/site/source/app/assets/javascripts/docs/views/pages/component_editor.coffee +10 -0
- data/site/source/app/assets/javascripts/docs/views/pages/examples_browser.coffee +102 -0
- data/site/source/app/assets/javascripts/docs/views/pages/examples_browser/docs.coffee +12 -0
- data/site/source/app/assets/javascripts/docs/views/pages/examples_browser/source.coffee +13 -0
- data/site/source/app/assets/javascripts/docs/views/pages/home.coffee +10 -0
- data/site/source/app/assets/javascripts/docs/views/views/api_browser/index.coffee +43 -0
- data/site/source/app/assets/javascripts/docs/views/views/collection_view_examples/grid_layout_view_example.coffee +14 -0
- data/site/source/app/assets/javascripts/docs/views/views/collection_view_examples/table_view_example.coffee +39 -0
- data/site/source/app/assets/javascripts/docs/views/views/form_view_examples/basic_example.coffee +38 -0
- data/site/source/app/assets/javascripts/docs/views/views/form_view_examples/complex_layout.coffee +110 -0
- data/site/source/app/assets/javascripts/docs/views/views/top_navigation.coffee +6 -0
- data/site/source/app/assets/javascripts/luca-docs.js +1 -0
- data/site/source/app/assets/javascripts/luca-framework-documentation.js +1 -0
- data/site/source/app/assets/javascripts/site.js.coffee +4 -0
- data/site/source/app/assets/javascripts/vendor/codemirror.js +4786 -0
- data/site/source/app/assets/javascripts/vendor/coffeescript.js +346 -0
- data/site/source/app/assets/javascripts/vendor/css.js +465 -0
- data/site/source/app/assets/javascripts/vendor/htmlmixed.js +84 -0
- data/site/source/app/assets/javascripts/vendor/javascript.js +422 -0
- data/site/source/app/assets/javascripts/vendor/js-beautify.js +1353 -0
- data/site/source/app/assets/javascripts/vendor/modernizr-2.6.1.min.js +4 -0
- data/site/source/app/assets/javascripts/vendor/vim.js +2511 -0
- data/site/source/app/assets/stylesheets/docs/api-browser.css.scss +5 -0
- data/site/source/app/assets/stylesheets/docs/application.css.scss +35 -0
- data/site/source/app/assets/stylesheets/docs/browse-source.css.scss +5 -0
- data/site/source/app/assets/stylesheets/docs/scrollable-table.css.scss +5 -0
- data/site/source/app/assets/stylesheets/site.css.scss +2 -0
- data/site/source/app/assets/stylesheets/vendor/codemirror.css +240 -0
- data/site/source/app/assets/stylesheets/vendor/prettify-tomorrow-night-bright.css +160 -0
- data/site/source/app/assets/stylesheets/vendor/twilight.css +26 -0
- data/site/source/crossdomain.xml +15 -0
- data/site/source/documentation.html.haml +1 -0
- data/site/source/favicon_base.png +0 -0
- data/site/source/humans.txt +15 -0
- data/site/source/images/background.png +0 -0
- data/site/source/images/middleman.png +0 -0
- data/site/source/index.html.haml +1 -0
- data/site/source/layouts/layout.haml +55 -0
- data/site/source/readme.md +63 -0
- data/site/source/robots.txt +3 -0
- data/spec/{components/grid_view_spec.coffee → javascripts/components/application_spec.coffee} +0 -0
- data/spec/{components/pagination_control_spec.coffee → javascripts/components/collection_loader_view_spec.coffee} +0 -0
- data/spec/{components → javascripts/components}/collection_view_spec.coffee +1 -1
- data/spec/{components → javascripts/components}/controller_spec.coffee +0 -0
- data/spec/{components → javascripts/components}/fields/checkbox_array_spec.coffee +0 -0
- data/spec/javascripts/components/form_view_spec.coffee +162 -0
- data/spec/{components/record_manager_spec.coffee → javascripts/components/grid_view_spec.coffee} +0 -0
- data/spec/{components → javascripts/components}/multi_collection_view_spec.coffee +0 -0
- data/spec/{components/template_spec.coffee → javascripts/components/pagination_control_spec.coffee} +0 -0
- data/spec/{concerns/paginatable_spec.coffee → javascripts/components/record_manager_spec.coffee} +0 -0
- data/spec/{components → javascripts/components}/table_view_spec.coffee +0 -0
- data/spec/{containers/modal_view_spec.coffee → javascripts/components/template_spec.coffee} +0 -0
- data/spec/{concerns → javascripts/concerns}/collection_event_bindings_spec.coffee +0 -0
- data/spec/{concerns → javascripts/concerns}/dom_helpers_spec.coffee +0 -0
- data/spec/{concerns → javascripts/concerns}/filterable_spec.coffee +0 -0
- data/spec/{concerns → javascripts/concerns}/model_presenter_spec.coffee +0 -0
- data/spec/{containers/panel_view_spec.coffee → javascripts/concerns/paginatable_spec.coffee} +0 -0
- data/spec/{concerns → javascripts/concerns}/state_model_spec.coffee +5 -0
- data/spec/javascripts/containers/card_view_spec.coffee +108 -0
- data/spec/{containers/tab_view_spec.coffee → javascripts/containers/modal_view_spec.coffee} +0 -0
- data/spec/{containers/viewport_spec.coffee → javascripts/containers/panel_view_spec.coffee} +0 -0
- data/spec/{core/observer_spec.coffee → javascripts/containers/tab_view_spec.coffee} +0 -0
- data/spec/{managers/socket_manager_spec.coffee → javascripts/containers/viewport_spec.coffee} +0 -0
- data/spec/{core → javascripts/core}/collection_spec.coffee +1 -1
- data/spec/{core → javascripts/core}/concerns_spec.coffee +0 -0
- data/spec/{core → javascripts/core}/container_spec.coffee +0 -0
- data/spec/{core → javascripts/core}/define_spec.coffee +0 -0
- data/spec/{core → javascripts/core}/events_spec.coffee +0 -0
- data/spec/{core → javascripts/core}/field_spec.coffee +0 -0
- data/spec/{core → javascripts/core}/framework_spec.coffee +0 -0
- data/spec/{core → javascripts/core}/model_spec.coffee +0 -0
- data/spec/javascripts/core/observer_spec.coffee +0 -0
- data/spec/{core → javascripts/core}/util_spec.coffee +0 -0
- data/spec/{core → javascripts/core}/view_spec.coffee +51 -39
- data/spec/{dependencies → javascripts/dependencies}/index.coffee +0 -0
- data/spec/{dependencies → javascripts/dependencies}/jasmine-html.js +0 -0
- data/spec/{dependencies → javascripts/dependencies}/jasmine.js +0 -0
- data/spec/{dependencies → javascripts/dependencies}/sinon.js +0 -0
- data/spec/{helper.coffee → javascripts/helper.coffee} +0 -0
- data/spec/{managers → javascripts/managers}/collection_manager_spec.coffee +0 -0
- data/spec/javascripts/managers/socket_manager_spec.coffee +0 -0
- data/spec/lib/component_definition_spec.rb +63 -0
- data/spec/lib/input_compiler_spec.rb +9 -0
- data/spec/lib/luca_application_spec.rb +30 -0
- data/spec/support/fixtures/application.coffee +45 -0
- data/spec/support/fixtures/component.coffee +34 -0
- data/tutorials/component-definitions.md +0 -0
- data/tutorials/component-definitions/01_intro.md +0 -0
- data/tutorials/component-driven-design.md +140 -0
- data/tutorials/structure-of-a-project.md +63 -0
- data/vendor/assets/javascripts/backbone-min.js +37 -33
- data/vendor/assets/javascripts/backbone-query.min.js +1 -1
- data/vendor/assets/javascripts/hogan.js +707 -0
- data/vendor/assets/javascripts/jquery.js +5 -4
- data/vendor/assets/javascripts/keymaster.min.js +4 -0
- data/vendor/assets/javascripts/luca-dependencies.min.js +8 -0
- data/vendor/assets/javascripts/luca-development.min.js +1 -0
- data/vendor/assets/javascripts/luca-spec.js +6 -6
- data/vendor/assets/javascripts/luca-ui.js +7386 -0
- data/vendor/assets/javascripts/luca-ui.min.js +5 -0
- data/vendor/assets/javascripts/luca.full.min.js +12 -0
- data/vendor/assets/javascripts/luca.min.js +5 -0
- data/vendor/assets/javascripts/underscore-min.js +1 -5
- data/vendor/assets/javascripts/underscore-string.min.js +1 -1
- data/vendor/assets/stylesheets/luca-components.css +202 -0
- data/vendor/assets/stylesheets/luca-development.css +23 -0
- data/vendor/assets/stylesheets/luca-ui.css +198 -0
- metadata +324 -94
- data/app/assets/javascripts/luca/components/base_toolbar.coffee +0 -17
- data/app/assets/javascripts/luca/components/form_button_toolbar.coffee +0 -28
- data/app/assets/javascripts/luca/components/grid_view.coffee +0 -269
- data/app/assets/javascripts/luca/components/page_controller.coffee +0 -7
- data/app/assets/javascripts/luca/components/template.coffee +0 -5
- data/app/assets/javascripts/luca/components/toolbar_dialog.coffee +0 -25
- data/lib/luca/code_browser.rb +0 -55
- data/lib/luca/command_line.rb +0 -69
- data/lib/luca/component_documentation.rb +0 -72
- data/site/assets/bootstrap.min.js +0 -7
- data/site/assets/dependencies.js +0 -94
- data/site/assets/glyphicons-halflings-white.png +0 -0
- data/site/assets/glyphicons-halflings.png +0 -0
- data/site/assets/luca-ui-bootstrap.css +0 -1331
- data/site/assets/luca-ui-bootstrap.js +0 -9
- data/site/assets/luca-ui-development-tools.css +0 -234
- data/site/assets/luca-ui-development-tools.js +0 -18561
- data/site/assets/luca-ui-development-tools.min.js +0 -15
- data/site/assets/luca-ui-full.min.js +0 -8
- data/site/assets/luca-ui.min.js +0 -4
- data/site/assets/sandbox.css +0 -62
- data/site/assets/sandbox.js +0 -469
- data/site/docs/application.html +0 -41
- data/site/docs/caching.html +0 -43
- data/site/docs/collection.html +0 -75
- data/site/docs/collection_manager.html +0 -71
- data/site/docs/containers.html +0 -118
- data/site/docs/events.html +0 -153
- data/site/docs/view.html +0 -128
- data/site/img/glyphicons-halflings-white.png +0 -0
- data/site/img/glyphicons-halflings.png +0 -0
- data/site/index.html +0 -20
- data/site/source-map.js +0 -1
- data/spec/components/form_view_spec.coffee +0 -84
- data/spec/containers/card_view_spec.coffee +0 -50
- data/spec/luca-spec.coffee +0 -9
@@ -0,0 +1,42 @@
|
|
1
|
+
gridView = Luca.register "Luca.components.GridLayoutView"
|
2
|
+
gridView.extends "Luca.CollectionView"
|
3
|
+
|
4
|
+
gridView.publicConfiguration
|
5
|
+
# how many items do you wish to render per row?
|
6
|
+
# assuming a 12 column grid, each item will receive
|
7
|
+
# an equal amount of grid span/columns.
|
8
|
+
itemsPerRow: 3
|
9
|
+
|
10
|
+
gridView.privateConfiguration
|
11
|
+
className: "grid-layout-view"
|
12
|
+
tagName: "div"
|
13
|
+
itemTagName: "div"
|
14
|
+
|
15
|
+
gridView.privateMethods
|
16
|
+
# adds the bootstrap span class to each collection-item,
|
17
|
+
# where span class is equal to the 12 column grid / @itemsPerRow.
|
18
|
+
# for example, each item would receive a span4 class when @itemsPerRow = 3
|
19
|
+
attributesForItem: ()->
|
20
|
+
base = Luca.CollectionView::attributesForItem.apply(@, arguments)
|
21
|
+
@itemsPerRow = 3 unless _.isNumber(@itemsPerRow) and @itemsPerRow > 1
|
22
|
+
columns = parseInt(12 / @itemsPerRow)
|
23
|
+
base.class += " span#{ columns }"
|
24
|
+
|
25
|
+
base
|
26
|
+
|
27
|
+
# wraps every N number of rows, where N = @itemsPerRow
|
28
|
+
# in a row-fluid wrapper, and appends it to the view
|
29
|
+
renderModels: (models)->
|
30
|
+
index = 0
|
31
|
+
rowIndex = 0
|
32
|
+
|
33
|
+
rows = for model in models
|
34
|
+
row = @make("div", class:"row-fluid") if rowIndex++ is 0
|
35
|
+
$(row).append @makeItem(model,index++)
|
36
|
+
rowIndex = 0 if index > 0 and index % @itemsPerRow is 0
|
37
|
+
row
|
38
|
+
|
39
|
+
for row in rows
|
40
|
+
@$append(row)
|
41
|
+
|
42
|
+
gridView.register()
|
@@ -1,26 +1,80 @@
|
|
1
|
+
# A Twitter Bootstrap compatible navigation bar. The Luca.Application
|
2
|
+
# and Luca.containers.Viewport class both have configuration options for
|
3
|
+
# creating navbar components in the header and footer of the viewport.
|
4
|
+
#
|
5
|
+
# #### Example of an Application with a Navbar
|
6
|
+
# ##### Component Definition
|
7
|
+
# # Navigation Component
|
8
|
+
# navBar = Luca.register "App.views.TopNavigation"
|
9
|
+
# navBar.extends "Luca.components.NavBar"
|
10
|
+
# navBar.defines
|
11
|
+
# brand: "My App"
|
12
|
+
# # for white on black
|
13
|
+
# inverse: true
|
14
|
+
#
|
15
|
+
# We are able to reference the component we just defined in the
|
16
|
+
# configuration of the Application, simply by using it's
|
17
|
+
# type alias `top_navigation`
|
18
|
+
#
|
19
|
+
# # Application Component
|
20
|
+
# app = Luca.register "App.Application"
|
21
|
+
# app.extends "Luca.Application"
|
22
|
+
# app.defines
|
23
|
+
# topNav: "top_navigation"
|
24
|
+
#
|
1
25
|
navBar = Luca.register "Luca.components.NavBar"
|
2
|
-
|
3
26
|
navBar.extends "Luca.View"
|
4
27
|
|
5
|
-
navBar.
|
28
|
+
navBar.publicConfiguration
|
29
|
+
# Specify whether the navbar is supposed to be fixed
|
30
|
+
# the way Twitter bootstrap navbar can be.
|
6
31
|
fixed: true
|
32
|
+
|
33
|
+
# Valid options are 'top', 'bottom'. Only valid when `@fixed is true`
|
7
34
|
position: 'top'
|
8
|
-
|
35
|
+
|
36
|
+
# Specify whether the navbar should use the fluid grid.
|
37
|
+
# Usually the same as your Viewport setting.
|
38
|
+
fluid: undefined
|
39
|
+
|
40
|
+
# What content do you want to show in the logo area of the
|
41
|
+
# standard bootstrap nav
|
9
42
|
brand: "Luca.js"
|
43
|
+
|
44
|
+
# Specifies an optional template to use for the navigation menu
|
45
|
+
# content. Whatever you specify will be rendered inside of the
|
46
|
+
# collapsible container inside of the standard bootstrap nav.
|
47
|
+
template: undefined
|
48
|
+
|
49
|
+
navBar.privateConfiguration
|
50
|
+
className: 'navbar'
|
10
51
|
bodyTemplate: 'nav_bar'
|
11
52
|
bodyClassName: 'luca-ui-navbar-body'
|
12
53
|
|
13
54
|
beforeRender: ()->
|
14
55
|
@$el.addClass "navbar-fixed-#{ @position }" if @fixed
|
56
|
+
@$el.addClass "navbar-inverse" if @inverse is true
|
15
57
|
|
16
58
|
if @brand?
|
17
|
-
|
59
|
+
@$('.brand').attr('href', @homeLink || '#')
|
60
|
+
@$('.brand').html(@brand)
|
18
61
|
|
19
62
|
if @template
|
20
|
-
@
|
63
|
+
@navContainer().html Luca.template(@template, @)
|
64
|
+
|
65
|
+
if !!(@fluid || Luca.getApplication()?.fluid)
|
66
|
+
@content().addClass( Luca.config.fluidWrapperClass )
|
67
|
+
else
|
68
|
+
@content().addClass( Luca.config.wrapperClass )
|
21
69
|
|
22
70
|
render: ()->
|
23
71
|
@
|
24
72
|
|
73
|
+
navContainer: ()->
|
74
|
+
@$('.luca-ui-navbar-body .nav-collapse')
|
75
|
+
|
25
76
|
content: ()->
|
26
|
-
@$('.
|
77
|
+
@$('.luca-ui-navbar-body').eq(0)
|
78
|
+
|
79
|
+
|
80
|
+
navBar.register()
|
@@ -0,0 +1,70 @@
|
|
1
|
+
# The `Page` is a type of `Container` that has
|
2
|
+
# all of its subcomponents visible at one time,
|
3
|
+
# and assigned to various `@regions` that exist
|
4
|
+
# in the `@layout` template which provide its
|
5
|
+
# internal dom structure.
|
6
|
+
#
|
7
|
+
# #### Example Template (haml):
|
8
|
+
# .page.layout.row-fluid{"data-layout"=>"layouts/left_nav_grid"}
|
9
|
+
# .span3.region{"data-region"=>"left"}
|
10
|
+
# .span9.region{"data-region"=>"right"}
|
11
|
+
#
|
12
|
+
# ### Example Page Configuration
|
13
|
+
# page = new Luca.components.Page
|
14
|
+
# layout: "layouts/left_nav_grid"
|
15
|
+
# regions:
|
16
|
+
# left:
|
17
|
+
# type: "navigation"
|
18
|
+
# right:
|
19
|
+
# type: "details"
|
20
|
+
#
|
21
|
+
page = Luca.register "Luca.components.Page"
|
22
|
+
page.extends "Luca.Container"
|
23
|
+
|
24
|
+
page.privateMethods
|
25
|
+
# `Page`s are typically instantiated by a `Luca.components.Controller`
|
26
|
+
initialize: (@options={})->
|
27
|
+
@assignComponentsToRegions()
|
28
|
+
@bodyTemplate = @options.layout || @layout
|
29
|
+
@bodyTemplate ||= @options.template || @template
|
30
|
+
Luca.Container::initialize.apply(@, arguments)
|
31
|
+
|
32
|
+
# Takes the configuration specified in @regions
|
33
|
+
# and creates a components hash out of them.
|
34
|
+
assignComponentsToRegions: ()->
|
35
|
+
@components ||= []
|
36
|
+
|
37
|
+
assigned = for regionId, regionAssignment of @regions
|
38
|
+
if _.isString(regionAssignment) and componentClass = Luca.registry.lookup( regionAssignment )
|
39
|
+
regionAssignment =
|
40
|
+
component: regionAssignment
|
41
|
+
else if _.isString(regionAssignment) and Luca.template(regionAssignment)
|
42
|
+
regionAssignment =
|
43
|
+
bodyTemplate: regionAssignment
|
44
|
+
|
45
|
+
_.extend(regionAssignment, container: "[data-region='#{ regionId }']")
|
46
|
+
|
47
|
+
@components = assigned
|
48
|
+
|
49
|
+
page.publicConfiguration
|
50
|
+
# The `@layout` property is the equivalent to specifying @bodyTemplate
|
51
|
+
# but more semantic. A `@layout` template is expected to contain DOM
|
52
|
+
# elements with a data attribute named `region` on it.
|
53
|
+
|
54
|
+
layout: undefined
|
55
|
+
# The @regions property assigns containers ( by their type alias )
|
56
|
+
# to DOM elements identified as regions within a layout template.
|
57
|
+
#
|
58
|
+
# #### Example:
|
59
|
+
# new Luca.components.Page
|
60
|
+
# regions:
|
61
|
+
# left: "my_component"
|
62
|
+
# right:
|
63
|
+
# type: "my_other_component"
|
64
|
+
# role: "component_role"
|
65
|
+
#
|
66
|
+
# This will render an instance of MyComponent to this
|
67
|
+
# page's @$('[data-region-id="right"]') DOM element.
|
68
|
+
regions: {}
|
69
|
+
|
70
|
+
page.register()
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# The SimpleCollectionView class is a CollectionView without any of the
|
2
|
+
# bells and whistles ( filtering, pagination, sorting, etc )
|
3
|
+
simple = Luca.register "Luca.components.SimpleCollectionView"
|
4
|
+
simple.extends "Luca.CollectionView"
|
5
|
+
|
6
|
+
simple.defines
|
7
|
+
filterable: false
|
8
|
+
paginatable: false
|
9
|
+
sortable: false
|
10
|
+
loadMask: false
|
@@ -1,5 +1,5 @@
|
|
1
1
|
tableView = Luca.register "Luca.components.TableView"
|
2
|
-
tableView.extends "Luca.
|
2
|
+
tableView.extends "Luca.CollectionView"
|
3
3
|
|
4
4
|
tableView.publicConfiguration
|
5
5
|
widths: []
|
@@ -17,6 +17,10 @@ tableView.privateConfiguration
|
|
17
17
|
observeChanges: true
|
18
18
|
|
19
19
|
tableView.privateMethods
|
20
|
+
|
21
|
+
lastColumn: ()->
|
22
|
+
@columns[ @columns.length - 1 ]
|
23
|
+
|
20
24
|
eachColumn: (fn, scope=@)->
|
21
25
|
index = 0
|
22
26
|
for col in @columns
|
@@ -63,7 +67,7 @@ tableView.classMethods
|
|
63
67
|
content = column.header
|
64
68
|
content = "<a class='link'>#{ column.header }</a>" if column.sortable
|
65
69
|
|
66
|
-
@$(targetElement).append(
|
70
|
+
@$(targetElement).find('tr').append( Luca.View::make "th", attrs, content )
|
67
71
|
|
68
72
|
|
69
73
|
index = 0
|
@@ -84,6 +88,6 @@ tableView.classMethods
|
|
84
88
|
if _.isFunction( column.renderer )
|
85
89
|
cellValue = column.renderer.call @, cellValue, model, column
|
86
90
|
|
87
|
-
|
91
|
+
Luca.View::make("td", {"data-col-index":index}, cellValue)
|
88
92
|
|
89
93
|
tableView.register()
|
@@ -0,0 +1,23 @@
|
|
1
|
+
scrollable = Luca.register 'Luca.components.ScrollableTable'
|
2
|
+
|
3
|
+
scrollable.extends 'Luca.components.TableView'
|
4
|
+
|
5
|
+
scrollable.replaces 'Luca.components.GridView'
|
6
|
+
|
7
|
+
scrollable.publicConfiguration
|
8
|
+
maxHeight: undefined
|
9
|
+
|
10
|
+
scrollable.privateMethods
|
11
|
+
$scrollableWrapperEl: ()->
|
12
|
+
@$el.parent('.scrollable-wrapper')
|
13
|
+
|
14
|
+
setMaxHeight: ()->
|
15
|
+
parent = @$scrollableWrapperEl()
|
16
|
+
parent.css('overflow':'auto', 'max-height': @maxHeight)
|
17
|
+
|
18
|
+
afterRender: ()->
|
19
|
+
@$wrap 'scrollable-wrapper'
|
20
|
+
@setMaxHeight()
|
21
|
+
|
22
|
+
scrollable.defines
|
23
|
+
version: 1
|
@@ -1,6 +1,9 @@
|
|
1
1
|
Luca.concerns.CollectionEventBindings =
|
2
2
|
__initializer: ()->
|
3
|
-
|
3
|
+
|
4
|
+
@defer ()=>
|
5
|
+
Luca.concerns.CollectionEventBindings.__setup.call(@)
|
6
|
+
.until("after:initialize")
|
4
7
|
|
5
8
|
unless @collectionEventBindingsSetup is true
|
6
9
|
if Luca.isBackboneCollection(@collection)
|
@@ -1,21 +1,30 @@
|
|
1
1
|
Luca.concerns.DevelopmentToolHelpers =
|
2
|
-
|
2
|
+
refreshEventBindings: ()->
|
3
3
|
view = @
|
4
4
|
|
5
|
-
|
6
|
-
view[ prop ] = view.definitionClass()[prop]
|
5
|
+
console.log "Refreshing Event Bindings ON ", view.name || view.cid
|
7
6
|
|
8
|
-
|
9
|
-
@bindAllEventHandlers()
|
7
|
+
view.undelegateEvents()
|
10
8
|
|
11
|
-
|
9
|
+
domEvents = view.definitionClass?()?.events || view.events
|
12
10
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
11
|
+
for eventSignature, eventName of domEvents when _.isString(eventName) is true
|
12
|
+
defaultEventHandler = view.definitionClass?()?[ eventName ]
|
13
|
+
console.log "Rebinding dom event", eventSignature, eventName, defaultEventHandler
|
14
|
+
view.events[ eventSignature ] = defaultEventHandler
|
17
15
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
16
|
+
if view.state? and view.stateful?
|
17
|
+
Luca.concerns.StateModel.__setupModelBindings.call(view, "off")
|
18
|
+
Luca.concerns.StateModel.__setupModelBindings.call(view, "on")
|
19
|
+
|
20
|
+
if view.isContainer is true and not _.isEmpty(view.componentEvents)
|
21
|
+
Luca.Container::registerComponentEvents.call(@,undefined,"off")
|
22
|
+
newBindings = view.definitionClass?()?.componentEvents
|
23
|
+
|
24
|
+
Luca.Container::registerComponentEvents.call(@,newBindings,"on")
|
25
|
+
|
26
|
+
|
27
|
+
#if @autoBindEventHandlers is true
|
28
|
+
# @bindAllEventHandlers()
|
29
|
+
|
30
|
+
view.delegateEvents()
|
@@ -46,10 +46,10 @@ Luca.concerns.DomHelpers =
|
|
46
46
|
console.log "Error in $template: #{ template } #{ @identifier?() ? @name || @cid }"
|
47
47
|
|
48
48
|
$html: (content)->
|
49
|
-
@$el.html(
|
49
|
+
if content? then @$el.html(content) else @$el.html()
|
50
50
|
|
51
51
|
$append: (content)->
|
52
|
-
@$el.append(
|
52
|
+
@$el.append(content)
|
53
53
|
|
54
54
|
$attach: ()->
|
55
55
|
@$container().append( @el )
|
@@ -1,18 +1,16 @@
|
|
1
|
-
Luca.concerns.Filterable =
|
1
|
+
Luca.concerns.Filterable =
|
2
2
|
classMethods:
|
3
3
|
prepare: ()->
|
4
|
-
|
5
|
-
|
4
|
+
@trigger "data:refresh"
|
5
|
+
return unless @isRemote()
|
6
|
+
|
7
|
+
filter = _.clone(@getRemoteQuery())
|
8
|
+
options = _.clone(@getQueryOptions())
|
6
9
|
|
7
10
|
prepared = @prepareRemoteFilter(filter, options)
|
8
11
|
|
9
|
-
@
|
12
|
+
@collection.applyFilter(prepared, remote: true)
|
10
13
|
|
11
|
-
if @isRemote()
|
12
|
-
@collection.applyFilter(prepared, remote: true)
|
13
|
-
else
|
14
|
-
@trigger "data:refresh"
|
15
|
-
|
16
14
|
__included: (component, module)->
|
17
15
|
_.extend(Luca.Collection::, __filters:{})
|
18
16
|
|
@@ -75,8 +73,7 @@ Luca.concerns.Filterable =
|
|
75
73
|
|
76
74
|
applyFilter: (query={}, options={})->
|
77
75
|
options = _.defaults(options, @getQueryOptions())
|
78
|
-
|
79
|
-
@getFilterState().clear(silent:false)
|
76
|
+
@getFilterState().clear(silent: true)
|
80
77
|
@getFilterState().set({query,options}, options)
|
81
78
|
|
82
79
|
class FilterModel extends Backbone.Model
|
@@ -0,0 +1,20 @@
|
|
1
|
+
Luca.concerns.FormModelBindings =
|
2
|
+
__initializer: ()->
|
3
|
+
return unless @trackModelChanges is true
|
4
|
+
|
5
|
+
@on "state:change:currentModel", @onStateChangeCurrentModel, @
|
6
|
+
|
7
|
+
_.bindAll(@, "onStateChangeCurrentModel", "unbindFromModel", "onModelChange", "bindToModel")
|
8
|
+
|
9
|
+
onStateChangeCurrentModel: (state, current, previous)->
|
10
|
+
@unbindFromModel(previous) if Luca.isBackboneModel(previous)
|
11
|
+
@bindToModel(current) if Luca.isBackboneModel(current)
|
12
|
+
|
13
|
+
unbindFromModel: (model)->
|
14
|
+
(model || @currentModel())?.unbind("change", @onModelChange)
|
15
|
+
|
16
|
+
onModelChange: (model)->
|
17
|
+
@setValues(model, modelChange: true)
|
18
|
+
|
19
|
+
bindToModel: (model)->
|
20
|
+
(model || @currentModel())?.bind("change", @onModelChange, @)
|
@@ -1,4 +1,6 @@
|
|
1
1
|
Luca.concerns.ModalView =
|
2
|
+
version: 3
|
3
|
+
|
2
4
|
closeOnEscape: true
|
3
5
|
|
4
6
|
showOnInitialize: false
|
@@ -6,12 +8,24 @@ Luca.concerns.ModalView =
|
|
6
8
|
backdrop: false
|
7
9
|
|
8
10
|
__initializer: ()->
|
9
|
-
|
11
|
+
return unless @modal is true
|
10
12
|
|
11
|
-
@on "before:render", applyModalConfig, @
|
13
|
+
@on "before:render", @applyModalConfig, @
|
12
14
|
|
13
15
|
@
|
14
16
|
|
17
|
+
applyModalConfig: ()->
|
18
|
+
@$el.addClass 'modal'
|
19
|
+
@$el.addClass 'fade' if @fade is true
|
20
|
+
|
21
|
+
@$el.modal
|
22
|
+
backdrop: @backdrop is true
|
23
|
+
keyboard: @closeOnEscape is true
|
24
|
+
show: @showOnInitialize is true
|
25
|
+
|
26
|
+
@$el.css('display','none') unless @showOnInitialize is true
|
27
|
+
@
|
28
|
+
|
15
29
|
container: ()->
|
16
30
|
$('body')
|
17
31
|
|
@@ -19,20 +33,31 @@ Luca.concerns.ModalView =
|
|
19
33
|
@$el.modal('toggle')
|
20
34
|
|
21
35
|
show: ()->
|
36
|
+
@render() unless @rendered is true
|
37
|
+
@trigger "before:show"
|
22
38
|
@$el.modal('show')
|
39
|
+
@trigger "after:show"
|
23
40
|
|
24
41
|
hide: ()->
|
42
|
+
@trigger "before:hide"
|
25
43
|
@$el.modal('hide')
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
44
|
+
@trigger "after:hide"
|
45
|
+
|
46
|
+
setModalDimensions: (height, width)->
|
47
|
+
if _.isObject(height)
|
48
|
+
{height,width} = height
|
49
|
+
|
50
|
+
@setModalHeight( height ) if height?
|
51
|
+
@setModalWidth( width ) if width?
|
52
|
+
|
53
|
+
setModalWidth: (width)->
|
54
|
+
@$el.css
|
55
|
+
"width": width
|
56
|
+
"max-width": width
|
57
|
+
"margin-left": width * 0.5 * -1
|
58
|
+
|
59
|
+
setModalHeight: (height)->
|
60
|
+
@$el.css
|
61
|
+
"max-height": height
|
62
|
+
"margin-top": height * 0.5 * -1
|
63
|
+
"height": height
|