luca 0.9.2 → 0.9.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (129) hide show
  1. data/.gitignore +1 -0
  2. data/.rvmrc +1 -1
  3. data/CHANGELOG +46 -2
  4. data/Gemfile +1 -1
  5. data/Gemfile.lock +2 -2
  6. data/Guardfile +1 -1
  7. data/README.md +64 -27
  8. data/ROADMAP +17 -2
  9. data/Rakefile +49 -1
  10. data/app.rb +38 -2
  11. data/assets/javascripts/luca-ui-base.coffee +1 -20
  12. data/assets/javascripts/luca-ui-full.js +3 -0
  13. data/assets/javascripts/luca-ui.coffee +0 -5
  14. data/assets/javascripts/sandbox/application.coffee +24 -18
  15. data/assets/javascripts/sandbox/router.coffee +16 -6
  16. data/assets/javascripts/sandbox/templates/builder/component_list.luca +1 -0
  17. data/assets/javascripts/sandbox/templates/builder.luca +2 -0
  18. data/assets/javascripts/sandbox/templates/main.luca +4 -3
  19. data/assets/javascripts/sandbox/templates/sandbox/docs_index.luca +1 -0
  20. data/assets/javascripts/sandbox/templates/sandbox/navigation.luca +6 -1
  21. data/assets/javascripts/sandbox/templates/sandbox/readme.luca +30 -0
  22. data/assets/javascripts/sandbox/views/builder/builder_canvas.coffee +3 -0
  23. data/assets/javascripts/sandbox/views/builder/builder_editor.coffee +6 -0
  24. data/assets/javascripts/sandbox/views/builder/component_list.coffee +38 -0
  25. data/assets/javascripts/sandbox/views/builder/project_browser.coffee +14 -0
  26. data/assets/javascripts/sandbox/views/builder.coffee +133 -0
  27. data/assets/javascripts/sandbox/views/docs_controller.coffee +7 -0
  28. data/assets/javascripts/sandbox/views/inspector/instance_filter.coffee +18 -0
  29. data/assets/javascripts/sandbox/{collections/sample.coffee → views/inspector/instance_list.coffee} +0 -0
  30. data/assets/javascripts/sandbox/views/inspector.coffee +11 -0
  31. data/assets/javascripts/sandbox.coffee +2 -0
  32. data/assets/stylesheets/luca-ui-full.css +3 -0
  33. data/assets/stylesheets/sandbox/builder.scss +79 -0
  34. data/assets/stylesheets/sandbox/sandbox.scss +2 -1
  35. data/docs/application.md +41 -0
  36. data/docs/collection.md +79 -0
  37. data/docs/collection_manager.md +76 -0
  38. data/docs/container_philosophy.md +122 -0
  39. data/docs/event_binding_helpers.md +164 -0
  40. data/docs/method_caching_and_computed_properties.md +77 -0
  41. data/docs/view.md +119 -0
  42. data/lib/luca/rails/version.rb +1 -1
  43. data/lib/luca/template.rb +9 -9
  44. data/site/assets/bootstrap.min.js +7 -0
  45. data/site/assets/luca-ui-bootstrap.css +19 -1
  46. data/site/assets/luca-ui-development-tools.css +10 -0
  47. data/site/assets/luca-ui-development-tools.min.js +15 -0
  48. data/site/assets/luca-ui-full.min.js +8 -0
  49. data/site/assets/luca-ui.min.js +4 -0
  50. data/site/assets/sandbox.css +52 -4
  51. data/site/assets/sandbox.js +368 -30
  52. data/site/docs/application.html +41 -0
  53. data/site/docs/caching.html +43 -0
  54. data/site/docs/collection.html +75 -0
  55. data/site/docs/collection_manager.html +71 -0
  56. data/site/docs/containers.html +118 -0
  57. data/site/docs/events.html +153 -0
  58. data/site/docs/view.html +128 -0
  59. data/site/img/glyphicons-halflings-white.png +0 -0
  60. data/site/img/glyphicons-halflings.png +0 -0
  61. data/site/source-map.js +1 -0
  62. data/spec/core/view_spec.coffee +5 -17
  63. data/spec/managers/collection_manager_spec.coffee +4 -7
  64. data/src/components/application.coffee +202 -77
  65. data/src/components/base_toolbar.coffee +1 -1
  66. data/src/components/collection_view.coffee +38 -10
  67. data/src/components/controller.coffee +24 -1
  68. data/src/components/fields/checkbox_field.coffee +9 -12
  69. data/src/components/fields/label_field.coffee +14 -0
  70. data/src/components/fields/select_field.coffee +2 -2
  71. data/src/components/fields/text_field.coffee +12 -7
  72. data/src/components/fields/type_ahead_field.coffee +1 -0
  73. data/src/components/form_view.coffee +44 -25
  74. data/src/components/page_controller.coffee +2 -0
  75. data/src/containers/card_view.coffee +4 -1
  76. data/src/containers/column_view.coffee +2 -1
  77. data/src/containers/modal_view.coffee +6 -2
  78. data/src/containers/page_view.coffee +2 -0
  79. data/src/containers/panel_toolbar.coffee +0 -5
  80. data/src/containers/viewport.coffee +28 -10
  81. data/src/core/collection.coffee +7 -1
  82. data/src/core/container.coffee +57 -30
  83. data/src/core/core.coffee +0 -186
  84. data/src/core/field.coffee +11 -3
  85. data/src/core/model.coffee +31 -16
  86. data/src/core/panel.coffee +6 -46
  87. data/src/core/registry.coffee +19 -2
  88. data/src/core/script_loader.coffee +32 -0
  89. data/src/core/view.coffee +112 -139
  90. data/src/define.coffee +110 -0
  91. data/src/framework.coffee +8 -2
  92. data/src/luca.coffee +22 -0
  93. data/src/managers/collection_manager.coffee +65 -31
  94. data/src/modules/load_mask.coffee +47 -0
  95. data/src/plugins/development_tool_helpers.coffee +21 -0
  96. data/src/plugins/events.coffee +54 -0
  97. data/src/stylesheets/components/viewport.scss +15 -0
  98. data/src/stylesheets/containers/container.scss +1 -4
  99. data/src/stylesheets/tools/component_tester.scss +18 -0
  100. data/src/templates/fields/select_field.luca +6 -5
  101. data/src/templates/fields/text_field.luca +10 -9
  102. data/src/tools/application_inspector.coffee +2 -0
  103. data/src/tools/coffee_script_editor.coffee +28 -6
  104. data/src/tools/collections/components.coffee +59 -0
  105. data/src/tools/collections/instances.coffee +15 -0
  106. data/src/tools/component_tester.coffee +12 -22
  107. data/src/tools/console.coffee +22 -4
  108. data/src/tools/models/components.coffee +16 -54
  109. data/src/tools/models/instance.coffee +2 -0
  110. data/src/{core/util.coffee → util.coffee} +10 -1
  111. data/vendor/assets/javascripts/luca-ui-base.js +132 -137
  112. data/vendor/assets/javascripts/luca-ui-development-tools.js +191 -219
  113. data/vendor/assets/javascripts/luca-ui-development-tools.min.js +2 -2
  114. data/vendor/assets/javascripts/luca-ui-full.js +4680 -0
  115. data/vendor/assets/javascripts/luca-ui-full.min.js +8 -0
  116. data/vendor/assets/javascripts/luca-ui-spec.js +291 -225
  117. data/vendor/assets/javascripts/luca-ui.js +1001 -724
  118. data/vendor/assets/javascripts/luca-ui.min.js +4 -4
  119. data/vendor/assets/stylesheets/luca-ui-bootstrap.css +19 -1
  120. data/vendor/assets/stylesheets/luca-ui-development-tools.css +10 -0
  121. data/vendor/assets/stylesheets/luca-ui-full.css +1334 -0
  122. data/vendor/assets/stylesheets/luca-ui-spec.css +19 -1
  123. data/vendor/assets/stylesheets/luca-ui.css +19 -1
  124. data/views/index.erb +2 -5
  125. metadata +58 -9
  126. data/lib/sprockets/luca_template.rb +0 -49
  127. data/src/tools/class_browser.coffee +0 -39
  128. data/src/tools/components/class_browser_detail.coffee +0 -10
  129. data/src/tools/components/class_browser_list.coffee +0 -74
data/.gitignore CHANGED
@@ -6,3 +6,4 @@ vendor/assets/stylesheets/luca-ui
6
6
  node_modules
7
7
  tmp
8
8
  public/sandbox/temp.js
9
+ *sublime-*
data/.rvmrc CHANGED
@@ -1 +1 @@
1
- rvm use 1.9.2-p290
1
+ rvm use 1.9.3-p194@luca --create
data/CHANGELOG CHANGED
@@ -85,11 +85,55 @@
85
85
  0.9.1
86
86
  - Bugfix Release
87
87
 
88
- 0.9.2 ( not yet released )
88
+ 0.9.2
89
89
  - FormView has errorMessage, successMessage methods which use twitter bootstrap alerts as flash message
90
90
  - FormView toolbar accepts new options: true, both, bottom, or top
91
91
  - Luca.Collection has a property @remoteFiltering which makes applyFilter always use remote fetch
92
92
  - Bugfix in GridView collection change handler
93
93
  - Added Luca.isViewPrototype, Luca.isModelPrototype, Luca.isCollectionPrototype helpers
94
94
  - Added configuration option to control auto registration of components with the registry
95
- - Only View Prototypes will be registered with the component registry
95
+ - Added Luca.parentClass and Luca.inheritanceChain methods for inspecting a component or prototype
96
+ - Changed single instance tracking mechanism on CollectionManager. Will throw an error if more than one
97
+ is created without specifying a name.
98
+ - Added Luca.getCollectionManager() helper as an Alias for Luca.CollectionManager.get()
99
+ - Luca.getApplication() and Luca.getCollectionManager() accept a name argument
100
+ - Classes like Luca.Application and Luca.CollectionManager which normally are singletons
101
+ can have more than one instance if a unique name is given
102
+
103
+ 0.9.3
104
+ - CardViews and Controllers set data attributes on their elements for the active card / page
105
+ - Added convenience methods to container 'pluck', 'invoke'
106
+ - Added methods to Controller for ease of autogenerating routes
107
+ - Added beforeInitialize hook on Luca.View
108
+ - Luca.View can now automatically configure state machine models by passing `stateful:true`
109
+ in your view definition.
110
+ - Containers will respond to getter attributes set on their components, by defining a getter
111
+ on the container
112
+
113
+ 0.9.31
114
+ - lazyComponent type property now goes through a map to allow for aliasing
115
+ - add ability to customize container / component render method by overriding Luca.core.Container.componentRenderer
116
+ - rename appendContainers property to generateComponentElements
117
+ - adding a Luca.PageView component as an alias for CardView
118
+ - adding a Luca.PageController component as an alias for Controller
119
+
120
+ 0.9.33
121
+ - added gridSpan property to Luca.View. This will automatically add the span class for you to snap your view to the grid.
122
+ Accepts a number 0-12.
123
+ - fixed a bug in CardView.componentElements method with bodyClassName being present
124
+ - Added LabelView component. A form field which just displays a value.
125
+
126
+ 0.9.35
127
+ - fixes bug in FormView.getFields() when passing in a filter. getField by name falls back to input name check if name check fails.
128
+ - fixes checkbox method for checking if underlying component is checked or not
129
+ - adds valueType option to core field object. allows for typecasting on getValue function
130
+ - change behavior on enableKeyEvents on text field
131
+ - added Luca.util.launchers for Development Tools usage
132
+ - added gridRow and gridRowFluid option to luca views to add row classes
133
+ - added gridOffset to add grid offset bootstrap classes
134
+
135
+ 0.9.4
136
+ - Luca::Template can now configure its namespace, removing duplicate sprockets class
137
+ - Luca.Application triggers page:change and sub:page:change events
138
+ - Luca.Viewport gets enable / disable method for fluid and fullscreen mode
139
+ - Add configurability to fullscreen behavior on viewport
data/Gemfile CHANGED
@@ -11,7 +11,7 @@ gem 'haml'
11
11
  group :test, :development do
12
12
  gem 'faker'
13
13
  gem 'guard-sprockets2'
14
- gem 'rb-fsevent'
14
+ gem 'rb-fsevent', '>= 0.9.1'
15
15
  gem 'pry'
16
16
  gem 'guard-jasmine'
17
17
  end
data/Gemfile.lock CHANGED
@@ -39,7 +39,7 @@ GEM
39
39
  rack (1.3.5)
40
40
  rack-protection (1.1.4)
41
41
  rack
42
- rb-fsevent (0.4.3.1)
42
+ rb-fsevent (0.9.1)
43
43
  ruby_parser (2.3.1)
44
44
  sexp_processor (~> 3.0)
45
45
  sass (3.1.12)
@@ -70,7 +70,7 @@ DEPENDENCIES
70
70
  guard-sprockets2
71
71
  haml
72
72
  pry
73
- rb-fsevent
73
+ rb-fsevent (>= 0.9.1)
74
74
  sass (>= 3.1.10)
75
75
  sinatra
76
76
  sprockets (>= 2.0.2)
data/Guardfile CHANGED
@@ -4,7 +4,7 @@ assets_path = Dir.pwd + '/vendor/assets'
4
4
  javascript_path = File.join( assets_path, 'javascripts' )
5
5
  stylesheets_path = File.join( assets_path, 'stylesheets' )
6
6
 
7
- unless ENV['TEST_MODE']
7
+ unless ENV['TEST_MODE'] or ENV['RUN_TESTS']
8
8
  unless ENV['SKIP_JAVASCRIPTS']
9
9
  guard 'sprockets2', :clean=>false, :assets_path => javascript_path, :sprockets => App.sprockets, :precompile=>[/^luca-ui.+(coffee|js)$/], :digest => false, :gz => false do
10
10
  watch(%r{^src/.+$})
data/README.md CHANGED
@@ -1,44 +1,81 @@
1
- Documentation and Sandbox
2
- -------------------------
3
- http://datapimp.github.com/luca
1
+ # Component Driven Architecture with Luca.JS
4
2
 
3
+ Luca is a component architecture framework based on Backbone.js, which includes
4
+ many development helpers, classes, patterns, and tools needed to build scalable
5
+ and clean single page applications.
5
6
 
6
- What Is Luca?
7
- -------------
8
- Luca is a component / container library for Backbone.js which
9
- encompasses all of the best practices for laying out a large
10
- app with many nested views and containers.
7
+ It uses twitter bootstrap compatible markup and css naming conventions,
8
+ making it possible to generate completely styled user interfaces with JSON alone.
11
9
 
12
- To run the sandbox:
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.
13
12
 
14
- * `bundle install`
15
- * `rackup`
13
+ ### Dependencies
16
14
 
17
- visit http://localhost:9292
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
+ ### Using With Rails Asset Pipeline
18
26
 
19
- Using it with Rails
20
- -------------------
21
27
  ```ruby
22
- # Gemfile
23
- gem 'luca'
28
+ # Gemfile
29
+ gem 'luca', '>= 0.9.2', :git => "git@github.com:datapimp/luca.git"
30
+ ```
31
+
32
+ In your css manifest:
33
+
34
+ ```css
35
+ /*
36
+ *= require 'luca-ui-full'
37
+ *= require 'luca-ui-development-tools'
38
+ */
24
39
  ```
25
40
 
26
- javascript manifest
41
+ All Javascript Dependencies:
27
42
 
28
43
  ```javascript
29
- //= require luca-ui
44
+ //= require 'underscore'
45
+ //= require 'underscore-string.min'
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'
30
51
  ```
31
52
 
32
- stylesheet manifest
53
+ Or you can just use the dependencies we rely on. Latest backbone.js, underscore.js, underscore.string.js, twitter boostrap js and css:
33
54
 
34
- ```css
35
- /*
36
- *= require luca-ui
37
- */
38
55
  ```
56
+ //= require 'luca-ui-full.min.js'
57
+ ```
58
+
59
+ ## Standalone With Twitter Bootstrap ( development tools are optional )
60
+ ```html
61
+ <html>
62
+ <head>
63
+ <link rel="stylesheet" href='luca-ui-full.css' />
64
+ <link rel="stylesheet" href='luca-ui-development-tools.css' />
65
+ </head>
66
+ <body>
67
+ <script type='text/javascript' src="luca-ui-full.min.js" />
68
+ <script type='text/javascript' src="luca-ui-development-tools.min.js" />
69
+ </body>
70
+ </html>
71
+ ```
72
+
73
+ ## Interactive Documentation and Examples
74
+
75
+ [View the Sandbox](http://datapimp.com/luca)
76
+
77
+ ## Thanks To
39
78
 
40
- Thanks To
41
- ---------
42
79
  @jashkenas for making coffeescript, underscore, backbone.js.
43
80
 
44
81
  @twitter for making bootstrap 2.0
@@ -49,6 +86,6 @@ Thanks To
49
86
 
50
87
  @luca. who i spent only two minutes making and am exponentially more proud to have created.
51
88
 
89
+ ## Contributing
52
90
 
53
- https://raw.github.com/datapimp/luca/development-tools/assets/javascripts/dependencies/underscore-string.min.js
54
- https://raw.github.com/datapimp/luca/development-tools/assets/javascripts/dependencies/backbond-string.min.js
91
+ Please!
data/ROADMAP CHANGED
@@ -1,9 +1,18 @@
1
+ Framework
2
+ ---------
3
+ Extract hooks into module
4
+
1
5
  General
2
6
  -------
3
7
  - Make development mode options easily disabled
4
8
  - Integrate with requireJs or some other AMD system
5
- - Move to node.js
9
+ - Move to node.js for build / testing
6
10
  - Replace .luca template with standard jst
11
+ - Eliminate underscore-string dependency. just copy necessary functions.
12
+ - Eliminate pointless CSS selectors
13
+
14
+ - Rely on data attributes for functionality instead of css selectors
15
+ - BUT in general don't tie views to the DOM anyway
7
16
 
8
17
  Luca.View
9
18
  ---------
@@ -15,4 +24,10 @@ Containers
15
24
 
16
25
  Luca.CollectionManager
17
26
  ----------------------
18
- - Add concept of base params for a given scope of the collection manager
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
data/Rakefile CHANGED
@@ -1,3 +1,4 @@
1
+
1
2
  task :environment do
2
3
  require './app'
3
4
  require 'pry'
@@ -7,11 +8,48 @@ end
7
8
  stylesheets = ["luca-ui-bootstrap.css","luca-ui-development-tools.css","sandbox.css"]
8
9
  scripts = ["dependencies.js","sandbox.js"]
9
10
 
11
+ namespace :source do
12
+ desc "Create a source map for the project"
13
+ task :map => :environment do
14
+ require 'json'
15
+ source_map = {}
16
+
17
+ (["src/**/*.coffee","assets/javascripts/sandbox/**/*.coffee"]).map do |location|
18
+ files = Dir.glob( location )
19
+ files.inject(source_map) do |memo,file|
20
+ definitions = IO.read(file).lines.to_a.grep /_\.def/
21
+
22
+ definitions.each do |definition|
23
+ component = definition.match(/_\.def\(['"](.+)['"]\)\./)
24
+
25
+ if component and component[1]
26
+ componentId = component[1].gsub(/['"].*$/,'')
27
+ if componentId
28
+ memo[ componentId ] = {className:componentId,file:file,source:IO.read(file)}
29
+ end
30
+ end
31
+ end
32
+
33
+ memo
34
+ end
35
+
36
+ end
37
+
38
+ sourceMapFile = File.join( App.root, 'site', 'source-map.js')
39
+
40
+ File.open(sourceMapFile,'w+') do |fh|
41
+ fh.puts( JSON.generate( source_map.values ) )
42
+ end
43
+
44
+ end
45
+ end
46
+
10
47
  namespace :release do
11
48
  desc "Release new version of sandbox site"
12
49
  task :sandbox => [:assets, :minify] do
13
50
 
14
51
  asset_folder = File.join(App.root,'site','assets')
52
+ img_folder = File.join(App.root,'site','img')
15
53
 
16
54
  [stylesheets,scripts].flatten.each do |filename|
17
55
  asset = App.sprockets.find_asset(filename)
@@ -22,7 +60,12 @@ namespace :release do
22
60
 
23
61
  FileUtils.cp( File.join(App.root,'assets','javascripts','dependencies','bootstrap.min.js'), asset_folder)
24
62
  FileUtils.cp( File.join(App.root,'vendor/assets/javascripts/luca-ui.min.js'), asset_folder)
63
+ FileUtils.cp( File.join(App.root,'vendor/assets/javascripts/luca-ui-full.min.js'), asset_folder)
25
64
  FileUtils.cp( File.join(App.root,'vendor/assets/javascripts/luca-ui-development-tools.min.js'), asset_folder)
65
+
66
+ FileUtils.cp( File.join(App.root,'vendor/assets/images/glyphicons-halflings-white.png'), img_folder )
67
+ FileUtils.cp( File.join(App.root,'vendor/assets/images/glyphicons-halflings.png'), img_folder )
68
+
26
69
  end
27
70
 
28
71
  desc "Compile all the assets"
@@ -35,6 +78,10 @@ namespace :release do
35
78
  fh.puts(App.sprockets["luca-ui.js"].to_s)
36
79
  end
37
80
 
81
+ File.open( File.join(App.root,'vendor','assets','javascripts','luca-ui-full.js'), 'w+' ) do |fh|
82
+ fh.puts(App.sprockets["luca-ui-full.js"].to_s)
83
+ end
84
+
38
85
  File.open( File.join(App.root,'vendor','assets','javascripts','luca-ui-development-tools.js'), 'w+' ) do |fh|
39
86
  fh.puts(App.sprockets["luca-ui-development-tools.coffee"].to_s)
40
87
  end
@@ -43,11 +90,12 @@ namespace :release do
43
90
  desc "Minify the assets"
44
91
  task :minify do
45
92
  `uglifyjs vendor/assets/javascripts/luca-ui.js > vendor/assets/javascripts/luca-ui.min.js`
93
+ `uglifyjs vendor/assets/javascripts/luca-ui-full.js > vendor/assets/javascripts/luca-ui-full.min.js`
46
94
  `uglifyjs vendor/assets/javascripts/luca-ui-development-tools.js > vendor/assets/javascripts/luca-ui-development-tools.min.js`
47
95
  end
48
96
 
49
97
  desc "Build the gem"
50
- task :gem, do
98
+ task :gem do
51
99
  `gem build luca.gemspec`
52
100
  end
53
101
 
data/app.rb CHANGED
@@ -11,9 +11,17 @@ module AssetHelpers
11
11
  end
12
12
  end
13
13
 
14
- require "#{ File.expand_path('../', __FILE__) }/lib/sprockets/luca_template.rb"
14
+ require "#{ File.expand_path('../', __FILE__) }/lib/luca/template.rb"
15
15
  require "#{ File.expand_path('../', __FILE__) }/lib/luca/code_browser.rb"
16
16
 
17
+ module Luca
18
+ class Template
19
+ def self.namespace
20
+ "Luca.templates"
21
+ end
22
+ end
23
+ end
24
+
17
25
  class App < Sinatra::Base
18
26
  set :root, File.expand_path('../', __FILE__)
19
27
  set :sprockets, Sprockets::Environment.new(root)
@@ -21,12 +29,15 @@ class App < Sinatra::Base
21
29
  set :assets_prefix, 'assets'
22
30
  set :assets_path, File.join(root, 'public', assets_prefix)
23
31
 
24
- sprockets.register_engine '.luca', Sprockets::LucaTemplate
32
+ sprockets.register_engine '.luca', Luca::Template
25
33
 
26
34
  configure do
27
35
  sprockets.append_path(File.join(root, 'assets', 'stylesheets'))
28
36
  sprockets.append_path(File.join(root, 'assets', 'javascripts'))
37
+ sprockets.append_path(File.join(root, 'vendor', 'assets', 'javascripts'))
38
+ sprockets.append_path(File.join(root, 'vendor', 'assets', 'stylesheets'))
29
39
  sprockets.append_path(File.join(root, 'assets', 'images'))
40
+ sprockets.append_path(File.join(root, 'vendor', 'assets', 'images'))
30
41
 
31
42
  sprockets.context_class.instance_eval do
32
43
  include AssetHelpers
@@ -47,6 +58,31 @@ class App < Sinatra::Base
47
58
 
48
59
  Luca::CodeBrowser.look_for_source_in( File.join(File.expand_path('../', __FILE__),'src') )
49
60
 
61
+ get "/luca/source-map.js" do
62
+ source_map = {}
63
+
64
+ files = (["src/**/*.coffee","assets/javascripts/sandbox/**/*.coffee"]).map do |location|
65
+ Dir.glob("#{ App.root }/#{ location }")
66
+ end
67
+
68
+ files.flatten.each do |file|
69
+ definitions = IO.read(file).lines.to_a.grep /_\.def/
70
+
71
+ definitions.each do |definition|
72
+ component = definition.match(/_\.def\(['"](.+)['"]\)\./)
73
+
74
+ if component and component[1]
75
+ componentId = component[1].gsub(/['"].*$/,'')
76
+ if componentId
77
+ source_map[ componentId ] = {className:componentId,file:file,source:IO.read(file)}
78
+ end
79
+ end
80
+ end
81
+ end
82
+
83
+ JSON.generate source_map.values
84
+ end
85
+
50
86
  get "/components" do
51
87
  if params[:component]
52
88
  component = params[:component]
@@ -1,20 +1 @@
1
- #= require ./luca-ui/framework
2
- #= require ./luca-ui/core/util
3
- #= require ./luca-ui/core/core
4
- #= require ./luca-ui/core/registry
5
- #= require ./luca-ui/core/view
6
- #= require ./luca-ui/core/model
7
- #= require ./luca-ui/core/collection
8
- #= require ./luca-ui/core/panel
9
-
10
- #= require_tree ./luca-ui/modules
11
- #= require_tree ./luca-ui/templates
12
-
13
- #= require ./luca-ui/core/observer
14
- #= require ./luca-ui/core/field
15
- #= require ./luca-ui/core/container
16
-
17
- #= require_tree ./luca-ui/managers
18
- #= require ./luca-ui/containers/split_view
19
- #= require ./luca-ui/containers/column_view
20
- #= require_tree ./luca-ui/containers
1
+ #= require ./luca-ui/luca
@@ -0,0 +1,3 @@
1
+ //= require ./dependencies
2
+ //= require ./luca-ui-bootstrap
3
+ //= require ./luca-ui
@@ -1,8 +1,3 @@
1
1
  #= require ./luca-ui-base
2
2
  #= require ./luca-ui/components/template
3
3
  #= require_tree ./luca-ui/components
4
-
5
- _.extend Luca, Luca.Events
6
- _.extend Luca.View::, Luca.Events
7
- _.extend Luca.Collection::, Luca.Events
8
- _.extend Luca.Model::, Luca.Events
@@ -1,35 +1,46 @@
1
- Sandbox.Application = Luca.Application.extend
2
- name: 'sandbox_application'
1
+ _.def('Sandbox.Application').extends('Luca.Application').with
2
+
3
+ autoBoot: true
4
+
5
+ name: 'SandboxApp'
6
+
7
+ router: "Sandbox.Router"
8
+
3
9
  el: '#viewport'
10
+
4
11
  fluid: true
5
12
 
6
13
  topNav:'top_navigation'
7
14
 
8
- useKeyRouter: true
15
+ useKeyHandler: false
9
16
 
10
17
  keyEvents:
11
18
  meta:
12
19
  forwardslash: "developmentConsole"
13
20
 
21
+ collectionManager:
22
+ initialCollections: ["components"]
23
+
14
24
  components:[
15
25
  ctype: 'controller'
16
26
  name: 'pages'
17
27
  components:[
18
28
  name: "main"
29
+ className:"marketing-content"
19
30
  bodyTemplate: 'main'
20
31
  ,
21
- name :"class_browser"
22
- ctype: "class_browser"
32
+ name: "intro"
33
+ className:"marketing-content"
34
+ bodyTemplate: "readme"
35
+ ,
36
+ name: "build"
37
+ ctype: "builder"
23
38
  ,
24
- name: "component_tester"
25
- ctype: "component_tester"
39
+ name: "docs"
40
+ ctype: "docs_controller"
26
41
  ]
27
42
  ]
28
43
 
29
- initialize: (@options={})->
30
- Luca.Application::initialize.apply @, arguments
31
- @router = new Sandbox.Router(app: @)
32
-
33
44
  developmentConsole: ()->
34
45
  @developmentConsole = Luca "coffeescript-console", ()->
35
46
  new Luca.tools.DevelopmentConsole(name:"coffeescript-console")
@@ -42,10 +53,5 @@ Sandbox.Application = Luca.Application.extend
42
53
 
43
54
  $('#devtools-console-wrapper').modal(backdrop:false,show:true)
44
55
 
45
- afterRender: ()->
46
- @_super("afterRender", @, arguments)
47
-
48
- $ do ->
49
- (window || global).SandboxApp = new Sandbox.Application()
50
- SandboxApp.boot()
51
- prettyPrint()
56
+ $ ->
57
+ new Sandbox.Application()
@@ -1,14 +1,24 @@
1
1
  Sandbox.Router = Luca.Router.extend
2
2
  routes:
3
3
  "" : "default"
4
- "class_browser" : "class_browser"
5
- "component_tester" : "component_tester"
4
+ "build" : "build"
5
+ "intro" : "intro"
6
+ "application" : "inspector"
7
+ "docs" : "docs"
8
+ "docs/:section" : "docs"
6
9
 
7
10
  default: ()->
8
11
  @app.navigate_to("pages").navigate_to "main"
9
12
 
10
- class_browser: ()->
11
- @app.navigate_to("pages").navigate_to "class_browser"
13
+ build: ()->
14
+ @app.navigate_to("pages").navigate_to "build"
12
15
 
13
- component_tester: ()->
14
- @app.navigate_to("pages").navigate_to "component_tester"
16
+ docs: (section="docs_index")->
17
+ @app.navigate_to("docs").navigate_to(section)
18
+
19
+ intro: ()->
20
+ @app.navigate_to("pages").navigate_to "intro"
21
+
22
+ inspector: ()->
23
+ inspector = Luca "application_inspector", new Sandbox.views.ApplicationInspector()
24
+ inspector.toggle()
@@ -0,0 +1,2 @@
1
+ %h1 Luca.JS Component Builder
2
+ %p This is coming soon. The Luca.JS sandbox application will provide interactive examples of various components and explain the architectural pieces that go into a well designed single page application.
@@ -39,12 +39,13 @@
39
39
  .row
40
40
  .span4
41
41
  %h3 Development Tools
42
- %p If you enable the Luca development tools, you have access to things like an in browser Coffeescript console, a CodeMirror based IDE to edit and test your components which live reloads javascript prototype changes and re-renders your components, so that you can experiment directly in the browser.
42
+ %p Luca's development tools include an in-browser Coffeescript console, a CodeMirror based IDE which performs live updates in the browser.
43
43
  %p Live reloading of your code changes is also supported if you use the ruby gem and make changes in your favorite editor.
44
44
  .span4
45
45
  %h3 Experimentation and Debugging
46
- %p The way the Luca framework was designed encourages us to define our apps mostly using JSON configuration, which then gets interpreted, and structural components and style rules are generated for us. Events get binded, and things just work.
47
- %p Because large parts of the application's code are just configuration strings, it is very easy to provide you with a suite of development tools that allow you to inspect what is going on behind the scenes and make changes directly in the environment if you want to experiment with some ideas.
46
+ %p The Luca framework was designed encourage developers to define apps mostly using JSON configuration, The structural components and style rules are generated for us, events get bound, and things just work.
47
+ %p
48
+ %a{href:"#application"} Take a look at this application in the inspector.
48
49
 
49
50
  .span4
50
51
  %h3 Not only for Ruby Developers
@@ -0,0 +1 @@
1
+ %h1 Documentation
@@ -1,3 +1,8 @@
1
1
  %ul.nav
2
2
  %li
3
- %a{:href=>"#"} Intro
3
+ %a{:href=>"#intro"} Intro
4
+ %li
5
+ %a{:href=>"#build"} Component Builder
6
+ %li
7
+ %a{:href=>"#docs"} Documentation
8
+
@@ -0,0 +1,30 @@
1
+ .container
2
+ %h1 Component Driven Architecture with Luca.JS
3
+
4
+ %p Luca is a component architecture framework based on Backbone.js, which includes
5
+ many development helpers, classes, patterns, and tools needed to build scalable
6
+ and clean single page applications.
7
+
8
+ %p It uses twitter bootstrap compatible markup and css naming conventions,
9
+ making it possible to generate completely styled user interfaces with JSON alone.
10
+
11
+ %p Luca combines the functionality of other open source libraries as well, but you are not
12
+ required to use any of them if you don't like.
13
+
14
+ %h3 Dependencies
15
+
16
+ %ul
17
+ %li
18
+ %a{href:"https://twitter.github.com/bootstrap"} Bootstrap by Twitter
19
+ %li
20
+ %a{href:"https://github.com/davidgtonge/backbone_query"} Backbone-Query by David Tonge
21
+ %li
22
+ %a{href:"https://github.com/epeli/underscore.string"} Underscore String by Esa-Matti Suuronen
23
+
24
+ %h3 Development Tool Dependencies
25
+
26
+ %ul
27
+ %li
28
+ %a{href:"https://codemirror.net"} CodeMirror IDE
29
+ %li
30
+ %a{href:"https://coffeescript.org"}CoffeeScript Compiler
@@ -0,0 +1,3 @@
1
+ _.def("Sandbox.views.BuilderCanvas").extends("Luca.View").with
2
+ name: "builder_canvas"
3
+ bodyTemplate: "builder"
@@ -0,0 +1,6 @@
1
+ _.def("Sandbox.views.BuilderEditor").extends("Luca.tools.CoffeeEditor").with
2
+ name: "builder_editor"
3
+
4
+
5
+ toggleSource:()->
6
+ @_super("toggleMode", @, arguments)