luca 0.9.89 → 0.9.91
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +11 -1
- data/Gemfile +5 -2
- data/Gemfile.lock +84 -56
- data/Rakefile +10 -2
- data/app/assets/javascripts/luca/components/application.coffee +82 -89
- data/app/assets/javascripts/luca/components/collection_view.coffee +9 -5
- data/app/assets/javascripts/luca/components/controller.coffee +72 -11
- data/app/assets/javascripts/luca/components/fields/base.coffee +61 -8
- data/app/assets/javascripts/luca/components/fields/button_field.coffee +53 -7
- data/app/assets/javascripts/luca/components/fields/checkbox_array.coffee +12 -7
- data/app/assets/javascripts/luca/components/fields/text_field.coffee +1 -1
- data/app/assets/javascripts/luca/components/form_view.coffee +2 -2
- data/app/assets/javascripts/luca/components/grid_layout_view.coffee +0 -1
- data/app/assets/javascripts/luca/components/page.coffee +1 -0
- data/app/assets/javascripts/luca/components/table_view.coffee +2 -2
- data/app/assets/javascripts/luca/concerns/dom_helpers.coffee +2 -2
- data/app/assets/javascripts/luca/containers/card_view.coffee +84 -54
- data/app/assets/javascripts/luca/containers/container.coffee +126 -46
- 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 +1 -1
- data/app/assets/javascripts/luca/containers/viewport.coffee +2 -5
- data/app/assets/javascripts/luca/core/collection.coffee +18 -4
- data/app/assets/javascripts/luca/core/model.coffee +1 -1
- data/app/assets/javascripts/luca/core/panel.coffee +1 -1
- data/app/assets/javascripts/luca/core/view.coffee +26 -7
- data/app/assets/javascripts/luca/development/code_sync_manager.coffee +51 -4
- data/app/assets/javascripts/luca/development/console.coffee +1 -1
- data/app/assets/javascripts/luca/framework.coffee +1 -1
- data/app/assets/javascripts/luca/index.coffee +1 -0
- data/app/assets/javascripts/luca/util/luca.coffee +2 -1
- data/app/assets/stylesheets/luca/components/viewport.scss +0 -4
- data/bin/luca +14 -0
- data/docs/framework.json +1 -1
- data/docs/luca-framework-documentation.js +1 -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/cli.rb +68 -0
- data/lib/luca/collection/endpoint.rb +1 -0
- data/lib/luca/component_definition.rb +23 -5
- data/lib/luca/luca_application.rb +18 -7
- data/lib/luca/rails/version.rb +1 -1
- data/lib/luca/server.rb +7 -0
- data/lib/luca/stylesheet.rb +2 -3
- data/lib/luca/version.rb +3 -0
- data/lib/luca/watcher.rb +72 -0
- data/lib/luca.rb +8 -1
- data/luca.gemspec +14 -7
- 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/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/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/index.coffee +0 -0
- data/site/source/app/assets/javascripts/docs/views/components/code_editor.coffee +45 -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/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/browse_source.coffee +46 -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/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/examples_browser.coffee +102 -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/docs-docs.js +1 -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/javascripts/components/collection_view_spec.coffee +1 -1
- data/spec/javascripts/containers/card_view_spec.coffee +58 -5
- data/spec/javascripts/core/collection_spec.coffee +1 -1
- data/spec/javascripts/core/view_spec.coffee +2 -2
- data/vendor/assets/javascripts/backbone-min.js +37 -33
- data/vendor/assets/javascripts/backbone-query.min.js +1 -1
- data/vendor/assets/javascripts/jquery.js +5 -4
- data/vendor/assets/javascripts/luca-dependencies.min.js +8 -6
- data/vendor/assets/javascripts/luca-development.min.js +1 -1
- data/vendor/assets/javascripts/luca.full.min.js +12 -10
- data/vendor/assets/javascripts/luca.min.js +5 -5
- 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 +0 -2
- data/vendor/assets/stylesheets/luca-development.css +1 -1
- metadata +215 -39
- data/app/assets/javascripts/luca/components/page_controller.coffee +0 -3
- data/app/assets/javascripts/luca/core/collection_view.coffee +0 -150
- 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
@@ -0,0 +1,45 @@
|
|
1
|
+
view = Luca.register "Docs.views.CodeEditor"
|
2
|
+
view.extends "Luca.View"
|
3
|
+
|
4
|
+
view.privateConfiguration
|
5
|
+
tagName: "textarea"
|
6
|
+
|
7
|
+
view.publicConfiguration
|
8
|
+
# CodeMirror option. This will control which theme is applied
|
9
|
+
# to the editor. Make sure the CSS for this theme has been loaded.
|
10
|
+
theme: "twilight"
|
11
|
+
|
12
|
+
# How many spaces a block should be indented.
|
13
|
+
indentUnit: 2
|
14
|
+
|
15
|
+
# Whether to use the context-sensitive indentation that the mode provides
|
16
|
+
smartIndent: true
|
17
|
+
|
18
|
+
# Which language will we be editing? Support for coffeescript,
|
19
|
+
# html, javascript, css, sass, less come out of the box
|
20
|
+
mode: "coffeescript"
|
21
|
+
|
22
|
+
# which keymap to use? default, or vim
|
23
|
+
keyMap: "default"
|
24
|
+
|
25
|
+
# whether or not to wrap lines when they reach past the set limit
|
26
|
+
lineWrapping: false
|
27
|
+
|
28
|
+
view.privateConfiguration
|
29
|
+
codeMirrorOptions: {}
|
30
|
+
codeMirrorConfigKeys:[
|
31
|
+
"theme"
|
32
|
+
"indentUnit"
|
33
|
+
"smartIndent"
|
34
|
+
"mode"
|
35
|
+
"keyMap"
|
36
|
+
"lineWrapping"
|
37
|
+
]
|
38
|
+
|
39
|
+
view.privateMethods
|
40
|
+
afterRender: ()->
|
41
|
+
defaults = _(@).pick( @codeMirrorConfigKeys... )
|
42
|
+
options = _(@codeMirrorOptions).defaults(defaults)
|
43
|
+
@codeMirror = window.CodeMirror.fromTextArea( @$el[0], options)
|
44
|
+
|
45
|
+
view.register()
|
@@ -0,0 +1,72 @@
|
|
1
|
+
view = Docs.register "Docs.views.ComponentDocumentation"
|
2
|
+
view.extends "Luca.View"
|
3
|
+
|
4
|
+
view.privateConfiguration
|
5
|
+
bodyTemplate: "component_documentation"
|
6
|
+
|
7
|
+
# If set to true, we will render the source code
|
8
|
+
# for the component in addition to all of the information
|
9
|
+
# about the methods and properties
|
10
|
+
displaySource: false
|
11
|
+
|
12
|
+
# If set to true, we will render the header documentation
|
13
|
+
# that is contained in the component
|
14
|
+
displayHeader: false
|
15
|
+
|
16
|
+
view.publicMethods
|
17
|
+
# Loads a component definition from the documentation objects that
|
18
|
+
# are generated by the Luca gem's Luca::LucaApplication#export tool.
|
19
|
+
# These objects are the result of parsing component definition files
|
20
|
+
# and determining the public and private properties and methods, and
|
21
|
+
# the documentation that is rendered from their comments.
|
22
|
+
loadComponent: (@component)->
|
23
|
+
@reset()
|
24
|
+
|
25
|
+
for section in ["private", "public"]
|
26
|
+
@renderMethodGroup(section)
|
27
|
+
@renderPropertyGroup(section)
|
28
|
+
|
29
|
+
@$('.source').hide()
|
30
|
+
|
31
|
+
if @displayHeader is true
|
32
|
+
@$('.header-documentation').show()
|
33
|
+
@$('.header-documentation').html( @component.get("header_documentation") )
|
34
|
+
|
35
|
+
if @displaySource is true
|
36
|
+
@$('.source').show()
|
37
|
+
@$('pre.source').html( @component.contentsWithoutHeader() )
|
38
|
+
|
39
|
+
@$('pre').addClass('prettyprint')
|
40
|
+
|
41
|
+
view.privateMethods
|
42
|
+
reset: ()->
|
43
|
+
@$('.table tbody').empty()
|
44
|
+
@$('.properties,.methods').hide()
|
45
|
+
@$('.header-documentation').hide()
|
46
|
+
|
47
|
+
renderMethodGroup: (group="public")->
|
48
|
+
source = @component?.documentation()?.details["#{ group }Methods"]
|
49
|
+
return if _.isEmpty(source)
|
50
|
+
prototype = Luca.util.resolve(@component.get("class_name"))?.prototype
|
51
|
+
list = @$(".methods.#{ group }").show().find('.table tbody')
|
52
|
+
|
53
|
+
for method, details of source when _.isFunction(prototype[method])
|
54
|
+
details ||= {}
|
55
|
+
arg_details = _( details.arguments ).reduce (memo,pair)->
|
56
|
+
memo += "#{ pair.argument }"
|
57
|
+
memo += "= #{ pair.value || 'undefined' }" if pair.value?
|
58
|
+
memo += "<br/>"
|
59
|
+
, ""
|
60
|
+
list.append "<tr><td>#{ method }</td><td>#{ arg_details }</td><td>#{ details.documentation || "" }</td></tr>"
|
61
|
+
|
62
|
+
renderPropertyGroup: (group="public")->
|
63
|
+
source = @component?.documentation()?.details["#{ group }Properties"]
|
64
|
+
return if _.isEmpty(source)
|
65
|
+
prototype = Luca.util.resolve(@component.get("class_name"))?.prototype
|
66
|
+
list = @$(".properties.#{ group }").show().find('.table tbody')
|
67
|
+
|
68
|
+
for method, details of source when not _.isFunction(prototype[method])
|
69
|
+
details ||= {}
|
70
|
+
list.append "<tr><td>#{ method }</td><td>#{ details.default || "" }</td><td>#{ details.documentation || "" }</td></tr>"
|
71
|
+
|
72
|
+
view.register()
|
@@ -0,0 +1,37 @@
|
|
1
|
+
view = Docs.register "Docs.views.ComponentDetails"
|
2
|
+
view.extends "Luca.Container"
|
3
|
+
|
4
|
+
view.configuration
|
5
|
+
rowFluid: true
|
6
|
+
|
7
|
+
view.contains
|
8
|
+
role: "documentation"
|
9
|
+
span: 5
|
10
|
+
loadComponent: (model)->
|
11
|
+
@$el.empty()
|
12
|
+
@$el.append("<h2>#{ model.get('class_name') }</h2>")
|
13
|
+
@$el.append("<div class='header-documentation'>#{ model.get('header_documentation') }</div>")
|
14
|
+
,
|
15
|
+
type: "component_documentation"
|
16
|
+
role: "details"
|
17
|
+
displaySource: true
|
18
|
+
span: 7
|
19
|
+
|
20
|
+
view.defines
|
21
|
+
afterRender: ()->
|
22
|
+
@getDetails().$el.hide()
|
23
|
+
@getDocumentation().$el.hide()
|
24
|
+
|
25
|
+
load: (model)->
|
26
|
+
@getDetails().$el.show()
|
27
|
+
@getDocumentation().$el.show()
|
28
|
+
|
29
|
+
@getDetails().loadComponent(model)
|
30
|
+
@getDocumentation().loadComponent(model)
|
31
|
+
|
32
|
+
@prettyPrint()
|
33
|
+
|
34
|
+
# Applies syntax highlighting to all pre elements
|
35
|
+
prettyPrint: ()->
|
36
|
+
@$('pre').addClass('prettyprint')
|
37
|
+
window.prettyPrint?()
|
@@ -0,0 +1,31 @@
|
|
1
|
+
view = Docs.register "Docs.views.ComponentList"
|
2
|
+
view.extends "Luca.components.ScrollableTable"
|
3
|
+
view.defines
|
4
|
+
paginatable: false
|
5
|
+
maxHeight: 200
|
6
|
+
collection: "luca_documentation"
|
7
|
+
columns:[
|
8
|
+
reader: "class_name"
|
9
|
+
width: "20%"
|
10
|
+
renderer: (name)->
|
11
|
+
"<a class='link'>#{ name }</a>"
|
12
|
+
,
|
13
|
+
reader: "class_name"
|
14
|
+
header: "Extends From"
|
15
|
+
width: "20%"
|
16
|
+
renderer: (className)->
|
17
|
+
if component = Luca.util.resolve(className)
|
18
|
+
name = component.prototype.componentMetaData()?.meta["super class name"]
|
19
|
+
"<a class='link'>#{ name }</a>"
|
20
|
+
,
|
21
|
+
reader: "type_alias"
|
22
|
+
header: "Shortcut"
|
23
|
+
width: "10%"
|
24
|
+
,
|
25
|
+
reader: "defined_in_file"
|
26
|
+
header: "<i class='icon icon-github'/> Github"
|
27
|
+
renderer: (file)->
|
28
|
+
shortened = file.split("javascripts/luca/")[1]
|
29
|
+
"<a href='https://github.com/datapimp/luca/blob/master/app/assets/javascripts/luca/#{ shortened }'>#{ shortened }</a>"
|
30
|
+
]
|
31
|
+
|
@@ -0,0 +1,46 @@
|
|
1
|
+
#= require_tree ./browse_source
|
2
|
+
#= require_self
|
3
|
+
view = Docs.register "Docs.views.BrowseSource"
|
4
|
+
view.extends "Luca.Container"
|
5
|
+
|
6
|
+
view.configuration
|
7
|
+
autoBindEventHandlers: true
|
8
|
+
events:
|
9
|
+
"click .docs-component-list a.link" : "selectComponent"
|
10
|
+
|
11
|
+
view.contains
|
12
|
+
component: "component_list"
|
13
|
+
,
|
14
|
+
component: "component_details"
|
15
|
+
|
16
|
+
view.privateMethods
|
17
|
+
|
18
|
+
index: ()->
|
19
|
+
@selectComponent(@getComponentList().getCollection().at(0))
|
20
|
+
|
21
|
+
show: (componentName)->
|
22
|
+
component = @getComponentList().getCollection().detect (model)->
|
23
|
+
model.get("class_name") is componentName
|
24
|
+
|
25
|
+
return @index() unless component?
|
26
|
+
|
27
|
+
@selectComponent(component)
|
28
|
+
|
29
|
+
selectComponent: (e)->
|
30
|
+
list = @getComponentList()
|
31
|
+
details = @getComponentDetails()
|
32
|
+
|
33
|
+
if Luca.isBackboneModel(e)
|
34
|
+
model = e
|
35
|
+
index = list.getCollection().indexOf(model)
|
36
|
+
row = list.$("tr[data-index='#{ index }']")
|
37
|
+
else
|
38
|
+
$target = @$(e.target)
|
39
|
+
row = $target.parents('tr').eq(0)
|
40
|
+
index = row.data('index')
|
41
|
+
model = list.getCollection().at(index)
|
42
|
+
|
43
|
+
list.$('tr').removeClass('info')
|
44
|
+
row.addClass('info')
|
45
|
+
details.load(model)
|
46
|
+
|
@@ -0,0 +1,12 @@
|
|
1
|
+
view = Docs.register "Docs.views.ExampleDocs"
|
2
|
+
view.extends "Docs.views.ComponentDocumentation"
|
3
|
+
view.defines
|
4
|
+
collection: "docs_documentation"
|
5
|
+
displayHeader: true
|
6
|
+
beforeRender: ()->
|
7
|
+
component = @collection.detect (component)=>
|
8
|
+
component.get("type_alias") is @example
|
9
|
+
|
10
|
+
if component?
|
11
|
+
@loadComponent(component)
|
12
|
+
|
@@ -0,0 +1,13 @@
|
|
1
|
+
view = Docs.register "Docs.views.ExampleSource"
|
2
|
+
view.extends "Luca.View"
|
3
|
+
view.defines
|
4
|
+
tagName: "pre"
|
5
|
+
className: "prettyprint pre-scrollable"
|
6
|
+
collection: "docs_documentation"
|
7
|
+
beforeRender: ()->
|
8
|
+
component = @collection.detect (component)=>
|
9
|
+
component.get("type_alias") is @example
|
10
|
+
|
11
|
+
@$el.html( component.get("source_file_contents") )
|
12
|
+
window.prettyPrint()
|
13
|
+
|
@@ -0,0 +1,102 @@
|
|
1
|
+
#= require_tree ./examples_browser
|
2
|
+
#= require_self
|
3
|
+
|
4
|
+
page = Docs.register "Docs.views.ExamplesBrowser"
|
5
|
+
page.extends "Luca.containers.TabView"
|
6
|
+
|
7
|
+
page.contains
|
8
|
+
title: "API Browser"
|
9
|
+
type: "api_browser"
|
10
|
+
name: "api_browser"
|
11
|
+
,
|
12
|
+
title: "Basic FormView"
|
13
|
+
type: "basic_form_view"
|
14
|
+
name: "basic_form_view"
|
15
|
+
,
|
16
|
+
title: "Complex Layout FormView"
|
17
|
+
type: "complex_layout_form"
|
18
|
+
name: "complex_layout_form"
|
19
|
+
,
|
20
|
+
title: "Scrollable Table"
|
21
|
+
type: "table_view_example"
|
22
|
+
name: "table_view_example"
|
23
|
+
,
|
24
|
+
title: "Grid Layout CollectionView"
|
25
|
+
type: "grid_layout_view_example"
|
26
|
+
name: "grid_layout_view_example"
|
27
|
+
|
28
|
+
page.privateConfiguration
|
29
|
+
activeCard: 0
|
30
|
+
tab_position: "left"
|
31
|
+
defaults:
|
32
|
+
activation: ()->
|
33
|
+
Docs().router.navigate("#examples/#{ @name }/component", false)
|
34
|
+
|
35
|
+
page.privateMethods
|
36
|
+
# Hack
|
37
|
+
afterSelect: _.debounce ()->
|
38
|
+
if active = @activeComponent()
|
39
|
+
active.findComponentByName?("component")?.runExample?()
|
40
|
+
, 10
|
41
|
+
|
42
|
+
wrapExampleComponents: ()->
|
43
|
+
wrapped = []
|
44
|
+
|
45
|
+
wrapped = _(@components).map (component,index)->
|
46
|
+
title: component.title
|
47
|
+
name: component.name
|
48
|
+
autoBindEventHandlers: true
|
49
|
+
events:
|
50
|
+
"click a.link[data-navigate-to]" : "selectPanel"
|
51
|
+
|
52
|
+
selectPanel: (e)->
|
53
|
+
$target = @$(e.target)
|
54
|
+
link = $target.data("navigate-to")
|
55
|
+
index = $target.data("index")
|
56
|
+
@$('.panel-selector li').removeClass("active")
|
57
|
+
$target.parent('li').addClass("active")
|
58
|
+
@getViewSelector().activate(index)
|
59
|
+
Docs().router.navigate(link, false)
|
60
|
+
|
61
|
+
components:[
|
62
|
+
type: "card"
|
63
|
+
role: "view_selector"
|
64
|
+
afterInitialize: ()->
|
65
|
+
@$el.append("<h3>#{ component.title } Example</h3>")
|
66
|
+
components:[
|
67
|
+
type: component.type
|
68
|
+
name: "component"
|
69
|
+
activation: ()->
|
70
|
+
@runExample?()
|
71
|
+
,
|
72
|
+
type: "example_source"
|
73
|
+
example: component.name
|
74
|
+
name: "source"
|
75
|
+
,
|
76
|
+
type: "example_docs"
|
77
|
+
example: component.name
|
78
|
+
name: "documentation"
|
79
|
+
]
|
80
|
+
,
|
81
|
+
bodyTemplate: "examples_browser/selector"
|
82
|
+
bodyTemplateVars: ()->
|
83
|
+
example_name: component.name
|
84
|
+
]
|
85
|
+
|
86
|
+
@components = wrapped
|
87
|
+
@components.unshift title: "Overview", bodyTemplate: "examples_browser/overview"
|
88
|
+
|
89
|
+
afterInitialize: ()->
|
90
|
+
@wrapExampleComponents()
|
91
|
+
|
92
|
+
page.publicMethods
|
93
|
+
show: (exampleName=0, view="component")->
|
94
|
+
@activate exampleName, false, ()->
|
95
|
+
@getViewSelector().activate(view)
|
96
|
+
@$("li").removeClass("active")
|
97
|
+
@$("li.#{view}").addClass("active")
|
98
|
+
|
99
|
+
index: ()->
|
100
|
+
@show()
|
101
|
+
|
102
|
+
page.register()
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# The `Docs.components.ApiBrowser` is an example of using
|
2
|
+
# a `Luca.Container` with a `@componentEvents` configuration
|
3
|
+
# to broker communication between two child components.
|
4
|
+
view = Docs.register "Docs.components.ApiBrowser"
|
5
|
+
view.extends "Luca.Container"
|
6
|
+
|
7
|
+
view.configuration
|
8
|
+
componentEvents:
|
9
|
+
"* button:click" : "loadUrl"
|
10
|
+
|
11
|
+
view.contains
|
12
|
+
type: "container"
|
13
|
+
rowFluid: true
|
14
|
+
className: "url-selector"
|
15
|
+
components:[
|
16
|
+
type: "text_field"
|
17
|
+
name: "endpoint_url"
|
18
|
+
label: "Enter a URL"
|
19
|
+
span: 9
|
20
|
+
,
|
21
|
+
type: "button_field"
|
22
|
+
input_value: "Browse"
|
23
|
+
span: 3
|
24
|
+
]
|
25
|
+
,
|
26
|
+
tagName: "pre"
|
27
|
+
className: "prettyprint pre-scrollable"
|
28
|
+
role: "output"
|
29
|
+
afterInitialize: ()->
|
30
|
+
@$el.html("Loading...")
|
31
|
+
|
32
|
+
view.privateMethods
|
33
|
+
runExample: ()->
|
34
|
+
@findComponentByName("endpoint_url", true).setValue("https://api.github.com/users/datapimp/gists")
|
35
|
+
@loadUrl()
|
36
|
+
|
37
|
+
loadUrl: ()->
|
38
|
+
url = @findComponentByName("endpoint_url", true).getValue()
|
39
|
+
$.get url, (parsed, state, options)=>
|
40
|
+
@getOutput().$html( options.responseText )
|
41
|
+
window.prettyPrint()
|
42
|
+
|
43
|
+
view.register()
|
@@ -0,0 +1,14 @@
|
|
1
|
+
view = Docs.register "Docs.views.GridLayoutViewExample"
|
2
|
+
view.extends "Luca.components.GridLayoutView"
|
3
|
+
|
4
|
+
view.publicConfiguration
|
5
|
+
collection: "github_repositories"
|
6
|
+
itemPerRow: 4
|
7
|
+
paginatable: 12
|
8
|
+
itemTemplate: "github_repository"
|
9
|
+
|
10
|
+
view.publicMethods
|
11
|
+
runExample: ()->
|
12
|
+
@getCollection().fetch()
|
13
|
+
|
14
|
+
view.register()
|
@@ -0,0 +1,39 @@
|
|
1
|
+
view = Docs.register "Docs.views.TableViewExample"
|
2
|
+
view.extends "Luca.components.ScrollableTable"
|
3
|
+
view.publicConfiguration
|
4
|
+
# Only render 100 models at a time. The `Luca.CollectionView` has
|
5
|
+
# automatic pagination control rendering, if you specify a pagination
|
6
|
+
# view class and render area.
|
7
|
+
paginatable: 100
|
8
|
+
|
9
|
+
# The scrollable table element has a max height.
|
10
|
+
maxHeight: 300
|
11
|
+
|
12
|
+
# The string "github_repositories" is an alias for the collection manager
|
13
|
+
# which is created by the `Docs.Application`. It represents a singular
|
14
|
+
# global instance of the `Docs.collections.GithubRepositories` collection.
|
15
|
+
collection: "github_repositories"
|
16
|
+
|
17
|
+
# The `Luca.components.TableView` component accepts an array of column
|
18
|
+
# configurations. Each column can specify the following properties:
|
19
|
+
# - header
|
20
|
+
# - reader ( a method, or attribute on the collection's model )
|
21
|
+
# - renderer ( a custom function which renders the model / reader )
|
22
|
+
# - width ( a percentage width for the column )
|
23
|
+
columns:[
|
24
|
+
reader: "name"
|
25
|
+
renderer: (name, model)->
|
26
|
+
"<a href=#{ model.get('html_url') }>#{ name }</a>"
|
27
|
+
,
|
28
|
+
reader: "description"
|
29
|
+
,
|
30
|
+
reader: "language"
|
31
|
+
,
|
32
|
+
reader: "watchers"
|
33
|
+
]
|
34
|
+
|
35
|
+
view.publicMethods
|
36
|
+
runExample: ()->
|
37
|
+
@getCollection().fetch()
|
38
|
+
|
39
|
+
view.register()
|
data/site/source/app/assets/javascripts/docs/views/views/form_view_examples/basic_example.coffee
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
# The `Docs.views.BasicFormView` is an example of the `Luca.components.FormView`.
|
2
|
+
# In this basic example, the form contains a range of different fields. They are
|
3
|
+
# rendered one on top of another. You can get more advanced and nest containers within
|
4
|
+
# your form, or use a `@bodyTemplate` and specify your own DOM structure, and assign
|
5
|
+
# components to custom CSS selectors within it.
|
6
|
+
form = Docs.register "Docs.views.BasicFormView"
|
7
|
+
form.extends "Luca.components.FormView"
|
8
|
+
|
9
|
+
form.privateConfiguration
|
10
|
+
# Any values you specify in the `@defaults` property will be
|
11
|
+
# set on each of the components in this container.
|
12
|
+
defaults:
|
13
|
+
type: "text"
|
14
|
+
|
15
|
+
form.publicConfiguration
|
16
|
+
# You can manually define a `@components` property, or in your component
|
17
|
+
# definition you can use the special `contains` directive, the only difference
|
18
|
+
# is your personal preference for readability. I did it this way
|
19
|
+
components:[
|
20
|
+
label: "Text Field One"
|
21
|
+
,
|
22
|
+
type: "select"
|
23
|
+
label: "Select Field One"
|
24
|
+
collection:
|
25
|
+
data:[
|
26
|
+
['Alpha','Alpha']
|
27
|
+
['Bravo','Bravo']
|
28
|
+
['Charlie','Charlie']
|
29
|
+
['Delta','Delta']
|
30
|
+
]
|
31
|
+
,
|
32
|
+
type: "checkbox_field"
|
33
|
+
label: "Checkbox Field"
|
34
|
+
|
35
|
+
]
|
36
|
+
|
37
|
+
form.register()
|
38
|
+
|
data/site/source/app/assets/javascripts/docs/views/views/form_view_examples/complex_layout.coffee
ADDED
@@ -0,0 +1,110 @@
|
|
1
|
+
# The `Docs.views.ComplexLayoutForm` is an example of a `Luca.components.FormView` which contains
|
2
|
+
# a nested container, and which uses the bootstrap grid helper properties `@rowFluid` and `@span`
|
3
|
+
# to arrange the nested components inside of a grid layout.
|
4
|
+
#
|
5
|
+
# In addition to laying out the form components visually, there is a nested `Luca.containers.CardView`
|
6
|
+
# component which shows / hides various field sets depending on what options you select on the form.
|
7
|
+
# This is an example of how Luca framework components can be assembled together arbitrarily to build
|
8
|
+
# whatever type of user interface you can imagine.
|
9
|
+
form = Docs.register "Docs.views.ComplexLayoutForm"
|
10
|
+
form.extends "Luca.components.FormView"
|
11
|
+
|
12
|
+
form.privateConfiguration
|
13
|
+
# By setting `@rowFluid` to true, this container
|
14
|
+
# will support the twitter bootstrap grid layout. Applying
|
15
|
+
# the `@span` property to the direct children of this component
|
16
|
+
# will control their width
|
17
|
+
rowFluid: true
|
18
|
+
|
19
|
+
# Here is an example of using the `@componentEvents` property to listen
|
20
|
+
# to the change event on the select field identified by the role 'group_selector'.
|
21
|
+
# once that field emits its change event, we change the active display card in the
|
22
|
+
# nested card selector.
|
23
|
+
componentEvents:
|
24
|
+
"group_selector on:change" : "selectGroup"
|
25
|
+
|
26
|
+
form.privateMethods
|
27
|
+
# The selectGroup method is bound to the componentEvent listener. Whenever
|
28
|
+
# the group_selector field changes its value, we want to change which field
|
29
|
+
# group is visible on the form.
|
30
|
+
selectGroup: ()->
|
31
|
+
desiredGroup = @getGroupSelector().getValue()
|
32
|
+
selector = @getGroupDisplaySelector()
|
33
|
+
selector.activate(desiredGroup)
|
34
|
+
|
35
|
+
form.contains
|
36
|
+
type: "container"
|
37
|
+
span: 6
|
38
|
+
components:[
|
39
|
+
type: "text"
|
40
|
+
label: "Field One"
|
41
|
+
,
|
42
|
+
type: "text"
|
43
|
+
label: "Field Two"
|
44
|
+
,
|
45
|
+
type: "text"
|
46
|
+
label: "Field Three"
|
47
|
+
]
|
48
|
+
,
|
49
|
+
type: "container"
|
50
|
+
span: 6
|
51
|
+
components:[
|
52
|
+
label: "Select a Group"
|
53
|
+
type: "select"
|
54
|
+
role: "group_selector"
|
55
|
+
includeBlank: false
|
56
|
+
valueType: "string"
|
57
|
+
collection:
|
58
|
+
data:[
|
59
|
+
["alpha","Alpha Group"]
|
60
|
+
["bravo", "Bravo Group"]
|
61
|
+
["charlie","Charlie Group"]
|
62
|
+
]
|
63
|
+
,
|
64
|
+
type: "card"
|
65
|
+
role: "group_display_selector"
|
66
|
+
components:[
|
67
|
+
name: "alpha"
|
68
|
+
defaults:
|
69
|
+
type: "text"
|
70
|
+
components:[
|
71
|
+
type: "view"
|
72
|
+
tagName: "h4"
|
73
|
+
bodyTemplate: ()-> "Group One"
|
74
|
+
,
|
75
|
+
label: "Alpha"
|
76
|
+
,
|
77
|
+
label: "Bravo"
|
78
|
+
,
|
79
|
+
label: "Charlie"
|
80
|
+
]
|
81
|
+
,
|
82
|
+
name: "bravo"
|
83
|
+
defaults:
|
84
|
+
type: "checkbox_field"
|
85
|
+
components:[
|
86
|
+
type: "view"
|
87
|
+
tagName: "h4"
|
88
|
+
bodyTemplate: ()-> "Group Two"
|
89
|
+
,
|
90
|
+
label: "One"
|
91
|
+
,
|
92
|
+
label: "Two"
|
93
|
+
]
|
94
|
+
,
|
95
|
+
name: "charlie"
|
96
|
+
defaults:
|
97
|
+
type: "button_field"
|
98
|
+
components:[
|
99
|
+
type: "view"
|
100
|
+
tagName: "h4"
|
101
|
+
bodyTemplate: ()-> "Group Three"
|
102
|
+
,
|
103
|
+
input_value: "Button One"
|
104
|
+
icon_class: "chevron-up"
|
105
|
+
,
|
106
|
+
input_value: "Button Two"
|
107
|
+
icon_class: "pencil"
|
108
|
+
]
|
109
|
+
]
|
110
|
+
]
|