luca 0.9.89 → 0.9.91

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (186) hide show
  1. data/CHANGELOG +11 -1
  2. data/Gemfile +5 -2
  3. data/Gemfile.lock +84 -56
  4. data/Rakefile +10 -2
  5. data/app/assets/javascripts/luca/components/application.coffee +82 -89
  6. data/app/assets/javascripts/luca/components/collection_view.coffee +9 -5
  7. data/app/assets/javascripts/luca/components/controller.coffee +72 -11
  8. data/app/assets/javascripts/luca/components/fields/base.coffee +61 -8
  9. data/app/assets/javascripts/luca/components/fields/button_field.coffee +53 -7
  10. data/app/assets/javascripts/luca/components/fields/checkbox_array.coffee +12 -7
  11. data/app/assets/javascripts/luca/components/fields/text_field.coffee +1 -1
  12. data/app/assets/javascripts/luca/components/form_view.coffee +2 -2
  13. data/app/assets/javascripts/luca/components/grid_layout_view.coffee +0 -1
  14. data/app/assets/javascripts/luca/components/page.coffee +1 -0
  15. data/app/assets/javascripts/luca/components/table_view.coffee +2 -2
  16. data/app/assets/javascripts/luca/concerns/dom_helpers.coffee +2 -2
  17. data/app/assets/javascripts/luca/containers/card_view.coffee +84 -54
  18. data/app/assets/javascripts/luca/containers/container.coffee +126 -46
  19. data/app/assets/javascripts/luca/containers/modal_view.coffee +9 -9
  20. data/app/assets/javascripts/luca/containers/page_controller.coffee +25 -0
  21. data/app/assets/javascripts/luca/containers/panel_toolbar.coffee +1 -1
  22. data/app/assets/javascripts/luca/containers/viewport.coffee +2 -5
  23. data/app/assets/javascripts/luca/core/collection.coffee +18 -4
  24. data/app/assets/javascripts/luca/core/model.coffee +1 -1
  25. data/app/assets/javascripts/luca/core/panel.coffee +1 -1
  26. data/app/assets/javascripts/luca/core/view.coffee +26 -7
  27. data/app/assets/javascripts/luca/development/code_sync_manager.coffee +51 -4
  28. data/app/assets/javascripts/luca/development/console.coffee +1 -1
  29. data/app/assets/javascripts/luca/framework.coffee +1 -1
  30. data/app/assets/javascripts/luca/index.coffee +1 -0
  31. data/app/assets/javascripts/luca/util/luca.coffee +2 -1
  32. data/app/assets/stylesheets/luca/components/viewport.scss +0 -4
  33. data/bin/luca +14 -0
  34. data/docs/framework.json +1 -1
  35. data/docs/luca-framework-documentation.js +1 -0
  36. data/lib/luca/cli/generate.rb +37 -0
  37. data/lib/luca/cli/server.rb +20 -0
  38. data/lib/luca/cli/sync.rb +40 -0
  39. data/lib/luca/cli/watch.rb +16 -0
  40. data/lib/luca/cli.rb +68 -0
  41. data/lib/luca/collection/endpoint.rb +1 -0
  42. data/lib/luca/component_definition.rb +23 -5
  43. data/lib/luca/luca_application.rb +18 -7
  44. data/lib/luca/rails/version.rb +1 -1
  45. data/lib/luca/server.rb +7 -0
  46. data/lib/luca/stylesheet.rb +2 -3
  47. data/lib/luca/version.rb +3 -0
  48. data/lib/luca/watcher.rb +72 -0
  49. data/lib/luca.rb +8 -1
  50. data/luca.gemspec +14 -7
  51. data/site/.bundle/config +2 -0
  52. data/site/.gitignore +5 -0
  53. data/site/.rvmrc +1 -0
  54. data/site/CHANGELOG.md +41 -0
  55. data/site/DOCS.md +41 -0
  56. data/site/Gemfile +8 -0
  57. data/site/Gemfile.lock +134 -0
  58. data/site/LICENSE.md +19 -0
  59. data/site/config.rb +84 -0
  60. data/site/helpers/site_helpers.rb +20 -0
  61. data/site/html5bp-docs/README.md +38 -0
  62. data/site/html5bp-docs/contribute.md +104 -0
  63. data/site/html5bp-docs/crossdomain.md +21 -0
  64. data/site/html5bp-docs/css.md +135 -0
  65. data/site/html5bp-docs/extend.md +507 -0
  66. data/site/html5bp-docs/faq.md +77 -0
  67. data/site/html5bp-docs/htaccess.md +323 -0
  68. data/site/html5bp-docs/html.md +170 -0
  69. data/site/html5bp-docs/js.md +31 -0
  70. data/site/html5bp-docs/misc.md +25 -0
  71. data/site/html5bp-docs/usage.md +109 -0
  72. data/site/readme.md +47 -0
  73. data/site/source/.htaccess +540 -0
  74. data/site/source/404.html +157 -0
  75. data/site/source/app/assets/javascripts/dependencies.js.coffee +6 -0
  76. data/site/source/app/assets/javascripts/docs/application.coffee +64 -0
  77. data/site/source/app/assets/javascripts/docs/collections/docs_documentation.coffee +17 -0
  78. data/site/source/app/assets/javascripts/docs/collections/github_repositories.coffee +7 -0
  79. data/site/source/app/assets/javascripts/docs/collections/index.coffee +1 -0
  80. data/site/source/app/assets/javascripts/docs/collections/luca_documentation.coffee +17 -0
  81. data/site/source/app/assets/javascripts/docs/collections/public_gists.coffee +4 -0
  82. data/site/source/app/assets/javascripts/docs/config.coffee +5 -0
  83. data/site/source/app/assets/javascripts/docs/index.coffee +12 -0
  84. data/site/source/app/assets/javascripts/docs/lib/router.coffee +3 -0
  85. data/site/source/app/assets/javascripts/docs/lib/util.coffee +0 -0
  86. data/site/source/app/assets/javascripts/docs/models/component.coffee +99 -0
  87. data/site/source/app/assets/javascripts/docs/models/github_repository.coffee +3 -0
  88. data/site/source/app/assets/javascripts/docs/models/index.coffee +1 -0
  89. data/site/source/app/assets/javascripts/docs/templates/component_documentation.jst.ejs +55 -0
  90. data/site/source/app/assets/javascripts/docs/templates/examples_browser/overview.jst.ejs +4 -0
  91. data/site/source/app/assets/javascripts/docs/templates/examples_browser/selector.jst.ejs +11 -0
  92. data/site/source/app/assets/javascripts/docs/templates/github_repository.jst.ejs +4 -0
  93. data/site/source/app/assets/javascripts/docs/templates/layouts/main.jst.ejs +4 -0
  94. data/site/source/app/assets/javascripts/docs/templates/left_navigation.jst.ejs +5 -0
  95. data/site/source/app/assets/javascripts/docs/templates/pages/getting_started.jst.ejs +78 -0
  96. data/site/source/app/assets/javascripts/docs/templates/pages/home.jst.ejs +57 -0
  97. data/site/source/app/assets/javascripts/docs/views/components/code_editor/index.coffee +0 -0
  98. data/site/source/app/assets/javascripts/docs/views/components/code_editor.coffee +45 -0
  99. data/site/source/app/assets/javascripts/docs/views/components/component_documentation.coffee +72 -0
  100. data/site/source/app/assets/javascripts/docs/views/index.coffee +3 -0
  101. data/site/source/app/assets/javascripts/docs/views/pages/browse_source/details.coffee +37 -0
  102. data/site/source/app/assets/javascripts/docs/views/pages/browse_source/list.coffee +31 -0
  103. data/site/source/app/assets/javascripts/docs/views/pages/browse_source.coffee +46 -0
  104. data/site/source/app/assets/javascripts/docs/views/pages/component_editor.coffee +10 -0
  105. data/site/source/app/assets/javascripts/docs/views/pages/examples_browser/docs.coffee +12 -0
  106. data/site/source/app/assets/javascripts/docs/views/pages/examples_browser/source.coffee +13 -0
  107. data/site/source/app/assets/javascripts/docs/views/pages/examples_browser.coffee +102 -0
  108. data/site/source/app/assets/javascripts/docs/views/pages/home.coffee +10 -0
  109. data/site/source/app/assets/javascripts/docs/views/views/api_browser/index.coffee +43 -0
  110. data/site/source/app/assets/javascripts/docs/views/views/collection_view_examples/grid_layout_view_example.coffee +14 -0
  111. data/site/source/app/assets/javascripts/docs/views/views/collection_view_examples/table_view_example.coffee +39 -0
  112. data/site/source/app/assets/javascripts/docs/views/views/form_view_examples/basic_example.coffee +38 -0
  113. data/site/source/app/assets/javascripts/docs/views/views/form_view_examples/complex_layout.coffee +110 -0
  114. data/site/source/app/assets/javascripts/docs/views/views/top_navigation.coffee +6 -0
  115. data/site/source/app/assets/javascripts/docs-docs.js +1 -0
  116. data/site/source/app/assets/javascripts/luca-docs.js +1 -0
  117. data/site/source/app/assets/javascripts/luca-framework-documentation.js +1 -0
  118. data/site/source/app/assets/javascripts/site.js.coffee +4 -0
  119. data/site/source/app/assets/javascripts/vendor/codemirror.js +4786 -0
  120. data/site/source/app/assets/javascripts/vendor/coffeescript.js +346 -0
  121. data/site/source/app/assets/javascripts/vendor/css.js +465 -0
  122. data/site/source/app/assets/javascripts/vendor/htmlmixed.js +84 -0
  123. data/site/source/app/assets/javascripts/vendor/javascript.js +422 -0
  124. data/site/source/app/assets/javascripts/vendor/js-beautify.js +1353 -0
  125. data/site/source/app/assets/javascripts/vendor/modernizr-2.6.1.min.js +4 -0
  126. data/site/source/app/assets/javascripts/vendor/vim.js +2511 -0
  127. data/site/source/app/assets/stylesheets/docs/api-browser.css.scss +5 -0
  128. data/site/source/app/assets/stylesheets/docs/application.css.scss +35 -0
  129. data/site/source/app/assets/stylesheets/docs/browse-source.css.scss +5 -0
  130. data/site/source/app/assets/stylesheets/docs/scrollable-table.css.scss +5 -0
  131. data/site/source/app/assets/stylesheets/site.css.scss +2 -0
  132. data/site/source/app/assets/stylesheets/vendor/codemirror.css +240 -0
  133. data/site/source/app/assets/stylesheets/vendor/prettify-tomorrow-night-bright.css +160 -0
  134. data/site/source/app/assets/stylesheets/vendor/twilight.css +26 -0
  135. data/site/source/crossdomain.xml +15 -0
  136. data/site/source/documentation.html.haml +1 -0
  137. data/site/source/favicon_base.png +0 -0
  138. data/site/source/humans.txt +15 -0
  139. data/site/source/images/background.png +0 -0
  140. data/site/source/images/middleman.png +0 -0
  141. data/site/source/index.html.haml +1 -0
  142. data/site/source/layouts/layout.haml +55 -0
  143. data/site/source/readme.md +63 -0
  144. data/site/source/robots.txt +3 -0
  145. data/spec/javascripts/components/collection_view_spec.coffee +1 -1
  146. data/spec/javascripts/containers/card_view_spec.coffee +58 -5
  147. data/spec/javascripts/core/collection_spec.coffee +1 -1
  148. data/spec/javascripts/core/view_spec.coffee +2 -2
  149. data/vendor/assets/javascripts/backbone-min.js +37 -33
  150. data/vendor/assets/javascripts/backbone-query.min.js +1 -1
  151. data/vendor/assets/javascripts/jquery.js +5 -4
  152. data/vendor/assets/javascripts/luca-dependencies.min.js +8 -6
  153. data/vendor/assets/javascripts/luca-development.min.js +1 -1
  154. data/vendor/assets/javascripts/luca.full.min.js +12 -10
  155. data/vendor/assets/javascripts/luca.min.js +5 -5
  156. data/vendor/assets/javascripts/underscore-min.js +1 -5
  157. data/vendor/assets/javascripts/underscore-string.min.js +1 -1
  158. data/vendor/assets/stylesheets/luca-components.css +0 -2
  159. data/vendor/assets/stylesheets/luca-development.css +1 -1
  160. metadata +215 -39
  161. data/app/assets/javascripts/luca/components/page_controller.coffee +0 -3
  162. data/app/assets/javascripts/luca/core/collection_view.coffee +0 -150
  163. data/site/assets/bootstrap.min.js +0 -7
  164. data/site/assets/dependencies.js +0 -94
  165. data/site/assets/glyphicons-halflings-white.png +0 -0
  166. data/site/assets/glyphicons-halflings.png +0 -0
  167. data/site/assets/luca-ui-bootstrap.css +0 -1331
  168. data/site/assets/luca-ui-bootstrap.js +0 -9
  169. data/site/assets/luca-ui-development-tools.css +0 -234
  170. data/site/assets/luca-ui-development-tools.js +0 -18561
  171. data/site/assets/luca-ui-development-tools.min.js +0 -15
  172. data/site/assets/luca-ui-full.min.js +0 -8
  173. data/site/assets/luca-ui.min.js +0 -4
  174. data/site/assets/sandbox.css +0 -62
  175. data/site/assets/sandbox.js +0 -469
  176. data/site/docs/application.html +0 -41
  177. data/site/docs/caching.html +0 -43
  178. data/site/docs/collection.html +0 -75
  179. data/site/docs/collection_manager.html +0 -71
  180. data/site/docs/containers.html +0 -118
  181. data/site/docs/events.html +0 -153
  182. data/site/docs/view.html +0 -128
  183. data/site/img/glyphicons-halflings-white.png +0 -0
  184. data/site/img/glyphicons-halflings.png +0 -0
  185. data/site/index.html +0 -20
  186. data/site/source-map.js +0 -1
data/CHANGELOG CHANGED
@@ -275,5 +275,15 @@
275
275
 
276
276
  0.9.88
277
277
  - Fixed a bug in StateModel concern
278
- - Luca.View which define an @_events property on their prototypes will have
278
+ - Luca.View which define an @_inheritEvents property on their prototypes will have
279
279
  that event configuration persist into @events of views which extend from them
280
+
281
+ 0.9.9
282
+ - Added luca executable which includes:
283
+ - documentation generator
284
+ - sync command for running Luca.CodeSyncManager in development
285
+ - Removes some unused components
286
+ - API changes for Luca.components.Controller
287
+ - Removing rails dependencies
288
+ - Middleman site for documentation and examples
289
+ - Improving documentation for core components
data/Gemfile CHANGED
@@ -4,14 +4,17 @@ gem "sinatra", :require => "sinatra/base"
4
4
  gem 'coffee-script', '>= 2.2.0'
5
5
  gem "uglifier", '>= 1.0.3'
6
6
  gem "sass", '>= 3.1.10'
7
- gem "sprockets", '>= 2.0.2'
7
+ gem "sprockets", ">= 2.4.5"
8
8
  gem 'ejs'
9
9
  gem 'haml'
10
10
  gem 'redcarpet'
11
11
  gem 'rake'
12
12
  gem 'hogan_assets'
13
13
  gem 'haml_assets'
14
- gem 'active_support'
14
+ gem 'activesupport', '>= 3.2.12'
15
+ gem 'listen'
16
+ gem 'faye'
17
+ gem 'thin'
15
18
 
16
19
  group :test, :development do
17
20
  gem 'faker'
data/Gemfile.lock CHANGED
@@ -1,122 +1,150 @@
1
1
  GEM
2
2
  remote: http://rubygems.org/
3
3
  specs:
4
- active_support (3.0.0)
5
- activesupport (= 3.0.0)
6
- activesupport (3.0.0)
4
+ activesupport (3.2.12)
5
+ i18n (~> 0.6)
6
+ multi_json (~> 1.0)
7
7
  addressable (2.3.2)
8
- childprocess (0.3.1)
9
- ffi (~> 1.0.6)
10
- coderay (0.9.8)
8
+ childprocess (0.3.8)
9
+ ffi (~> 1.0, >= 1.0.11)
10
+ coderay (1.0.9)
11
11
  coffee-script (2.2.0)
12
12
  coffee-script-source
13
13
  execjs
14
- coffee-script-source (1.2.0)
14
+ coffee-script-source (1.4.0)
15
+ cookiejar (0.3.0)
16
+ daemons (1.1.9)
15
17
  diff-lcs (1.1.3)
16
- ejs (1.0.0)
17
- execjs (1.2.13)
18
+ ejs (1.1.1)
19
+ em-http-request (1.0.3)
20
+ addressable (>= 2.2.3)
21
+ cookiejar
22
+ em-socksify
23
+ eventmachine (>= 1.0.0.beta.4)
24
+ http_parser.rb (>= 0.5.3)
25
+ em-socksify (0.2.1)
26
+ eventmachine (>= 1.0.0.beta.4)
27
+ eventmachine (1.0.0)
28
+ execjs (1.4.0)
18
29
  multi_json (~> 1.0)
19
- faker (1.0.1)
20
- i18n (~> 0.4)
21
- ffi (1.0.11)
22
- guard (0.9.2)
23
- ffi (>= 0.5.0)
24
- thor (~> 0.14.6)
25
- guard-jasmine (0.9.13)
30
+ faker (1.1.2)
31
+ i18n (~> 0.5)
32
+ faye (0.8.8)
33
+ cookiejar (>= 0.3.0)
34
+ em-http-request (>= 0.3.0)
35
+ eventmachine (>= 0.12.0)
36
+ faye-websocket (>= 0.4.0)
37
+ rack (>= 1.0.0)
38
+ yajl-ruby (>= 1.0.0)
39
+ faye-websocket (0.4.7)
40
+ eventmachine (>= 0.12.0)
41
+ ffi (1.4.0)
42
+ guard (1.6.2)
43
+ listen (>= 0.6.0)
44
+ lumberjack (>= 1.0.2)
45
+ pry (>= 0.9.10)
46
+ terminal-table (>= 1.4.3)
47
+ thor (>= 0.14.6)
48
+ guard-jasmine (1.13.0)
26
49
  childprocess
27
- guard (>= 0.8.3)
50
+ guard (>= 1.1.0)
28
51
  multi_json
29
52
  thor
30
53
  guard-sprockets2 (0.0.6)
31
54
  guard
32
55
  sprockets (~> 2.0)
33
- haml (3.1.4)
56
+ haml (4.0.0)
57
+ tilt
34
58
  haml_assets (0.2.1)
35
59
  haml
36
60
  tilt
37
61
  hike (1.2.1)
38
- hogan_assets (1.3.4)
62
+ hogan_assets (1.5.0)
39
63
  execjs (>= 1.2.9)
40
64
  sprockets (>= 2.0.3)
41
65
  tilt (>= 1.3.3)
42
- i18n (0.6.0)
43
- jasmine (1.3.0)
44
- jasmine-core (>= 1.3.0)
66
+ http_parser.rb (0.5.3)
67
+ i18n (0.6.1)
68
+ jasmine (1.3.1)
69
+ jasmine-core (~> 1.3.1)
45
70
  rack (~> 1.0)
46
71
  rspec (>= 1.3.1)
47
72
  selenium-webdriver (>= 0.1.3)
48
- jasmine-core (1.3.0)
49
- libwebsocket (0.1.7.1)
50
- addressable
51
- websocket
52
- method_source (0.6.7)
53
- ruby_parser (>= 2.3.1)
54
- multi_json (1.0.4)
55
- pry (0.9.7.4)
56
- coderay (~> 0.9.8)
57
- method_source (~> 0.6.7)
58
- ruby_parser (>= 2.3.1)
59
- slop (~> 2.1.0)
73
+ jasmine-core (1.3.1)
74
+ listen (0.7.2)
75
+ lumberjack (1.0.2)
76
+ method_source (0.8.1)
77
+ multi_json (1.6.1)
78
+ pry (0.9.12)
79
+ coderay (~> 1.0.5)
80
+ method_source (~> 0.8)
81
+ slop (~> 3.4)
60
82
  rack (1.5.2)
61
- rack-protection (1.1.4)
83
+ rack-protection (1.3.2)
62
84
  rack
63
- rake (0.9.2.2)
64
- rb-fsevent (0.9.1)
85
+ rake (10.0.3)
86
+ rb-fsevent (0.9.3)
65
87
  redcarpet (2.2.2)
66
88
  rspec (2.12.0)
67
89
  rspec-core (~> 2.12.0)
68
90
  rspec-expectations (~> 2.12.0)
69
91
  rspec-mocks (~> 2.12.0)
70
- rspec-core (2.12.0)
71
- rspec-expectations (2.12.0)
92
+ rspec-core (2.12.2)
93
+ rspec-expectations (2.12.1)
72
94
  diff-lcs (~> 1.1.3)
73
- rspec-mocks (2.12.0)
74
- ruby_parser (2.3.1)
75
- sexp_processor (~> 3.0)
95
+ rspec-mocks (2.12.2)
76
96
  rubyzip (0.9.9)
77
- sass (3.1.12)
78
- selenium-webdriver (2.26.0)
97
+ sass (3.2.5)
98
+ selenium-webdriver (2.30.0)
79
99
  childprocess (>= 0.2.5)
80
- libwebsocket (~> 0.1.3)
81
100
  multi_json (~> 1.0)
82
101
  rubyzip
83
- sexp_processor (3.0.9)
84
- sinatra (1.3.1)
85
- rack (~> 1.3, >= 1.3.4)
86
- rack-protection (~> 1.1, >= 1.1.2)
102
+ websocket (~> 1.0.4)
103
+ sinatra (1.3.4)
104
+ rack (~> 1.4)
105
+ rack-protection (~> 1.3)
87
106
  tilt (~> 1.3, >= 1.3.3)
88
- slop (2.1.0)
107
+ slop (3.4.3)
89
108
  sprockets (2.8.2)
90
109
  hike (~> 1.2)
91
110
  multi_json (~> 1.0)
92
111
  rack (~> 1.0)
93
112
  tilt (~> 1.1, != 1.3.0)
94
- thor (0.14.6)
113
+ terminal-table (1.4.5)
114
+ thin (1.5.0)
115
+ daemons (>= 1.0.9)
116
+ eventmachine (>= 0.12.6)
117
+ rack (>= 1.0.0)
118
+ thor (0.17.0)
95
119
  tilt (1.3.3)
96
- uglifier (1.2.0)
120
+ uglifier (1.3.0)
97
121
  execjs (>= 0.3.0)
98
- multi_json (>= 1.0.2)
99
- websocket (1.0.4)
122
+ multi_json (~> 1.0, >= 1.0.2)
123
+ websocket (1.0.7)
124
+ yajl-ruby (1.1.0)
100
125
 
101
126
  PLATFORMS
102
127
  ruby
103
128
 
104
129
  DEPENDENCIES
105
- active_support
130
+ activesupport (>= 3.2.12)
106
131
  coffee-script (>= 2.2.0)
107
132
  ejs
108
133
  faker
134
+ faye
109
135
  guard-jasmine
110
136
  guard-sprockets2
111
137
  haml
112
138
  haml_assets
113
139
  hogan_assets
114
140
  jasmine
141
+ listen
115
142
  pry
116
143
  rake
117
144
  rb-fsevent (>= 0.9.1)
118
145
  redcarpet
119
146
  sass (>= 3.1.10)
120
147
  sinatra
121
- sprockets (>= 2.0.2)
148
+ sprockets (>= 2.4.5)
149
+ thin
122
150
  uglifier (>= 1.0.3)
data/Rakefile CHANGED
@@ -2,6 +2,7 @@
2
2
  task :environment do
3
3
  require './app'
4
4
  require 'pry'
5
+ require 'luca'
5
6
  end
6
7
 
7
8
 
@@ -9,8 +10,15 @@ stylesheets = ["luca-ui-bootstrap.css","luca-ui-development-tools.css","sandbox.
9
10
  scripts = ["dependencies.js","sandbox.js"]
10
11
 
11
12
  namespace :release do
13
+ desc "Zip up the assets"
14
+ task :zip => :environment do
15
+ `cp vendor/assets/javascripts/luca.min.js vendor/assets/javascripts/luca-dependencies.min.js vendor/assets/stylesheets/luca-ui.css .`
16
+ `zip downloads/luca-#{ Luca::Version }.zip luca.min.js luca-dependencies.min.js luca-ui.css`
17
+ `rm luca-ui.css luca.min.js luca-dependencies.min.js`
18
+ end
19
+
12
20
  desc "Compile and Minify"
13
- task :all => [:assets,:minify]
21
+ task :all => [:assets,:minify,:zip]
14
22
  desc "Compile all the assets"
15
23
  task :assets => :environment do
16
24
  File.open( File.join(App.root,'vendor','assets','stylesheets','luca-development.css'), 'w+' ) do |fh|
@@ -40,7 +48,7 @@ namespace :release do
40
48
  end
41
49
 
42
50
  desc "Build the gem"
43
- task :gem => [:assets,:minify] do
51
+ task :gem => [:assets,:minify,:zip] do
44
52
  `gem build luca.gemspec`
45
53
  end
46
54
 
@@ -86,6 +86,18 @@ application.publicConfiguration
86
86
  # listen for on this component before you start history
87
87
  autoStartHistory: "before:render"
88
88
 
89
+ # use Backbone.history push state?
90
+ pushState: false
91
+
92
+ # If the server renders the entire page
93
+ # first, then we should start history silently.
94
+ startHistorySilently: false
95
+
96
+ # In cases where we use pushState, we need to tell
97
+ # the application what the actual root url of our app
98
+ # is, since everything after would otherwise be a hashbang
99
+ rootUrl: undefined
100
+
89
101
  # we will create a collection manager singleton
90
102
  # by default unless otherwise specified.
91
103
  useCollectionManager: true
@@ -110,63 +122,42 @@ application.publicConfiguration
110
122
  # with several 'pages' so to speak
111
123
  useController: true
112
124
 
113
- # if you have special rendering requirements for
114
- # the application's components, you can assign the
115
- # specific element you want to render the container
116
- # to inside of the #viewport
125
+ # If your Application does not behave as a Viewport that monopolizes
126
+ # its entire element, but instead you wish to render the application
127
+ # controller to a specific element, you can specify the css selector of that element.
117
128
  mainControllerContainer: undefined
118
129
 
119
- # Key Handler
120
- #
121
- # One responsibility of the application, since it is a viewport which monopolizes the entire screen
122
- # is to relay keypress events from the document, to whatever views are interested in responding to them.
123
- #
124
- # This functionality is disabled by default.
125
- useKeyHandler: false
126
-
127
- # You can configure key events by specifying them by their name, as it exists in Luca.keyMap. For example:
128
-
129
130
  # keyEvents understands the following modifiers:
130
- # `⇧`, `shift`, `option`, `⌥`, `alt`, `ctrl`, `control`, `command`, and `⌘`.
131
-
131
+ # - `⇧`, `shift`, `option`, `⌥`, `alt`, `ctrl`, `control`, `command`, and `⌘`.
132
132
  # The following special keys can be used for shortcuts:
133
133
  # `backspace`, `tab`, `clear`, `enter`, `return`, `esc`, `escape`, `space`,
134
134
  # `up`, `down`, `left`, `right`, `home`, `end`, `pageup`, `pagedown`, `del`, `delete`
135
135
  # and `f1` through `f19`.
136
136
  #
137
+ # **Note**: This requires the keymaster.js library to be loaded. This library is included
138
+ # with the bundled dependencies that ship with Luca.
139
+ #
137
140
  # Example:
138
- # ```coffeescript
139
- # application.configuration
140
- # keyEvents:
141
- # '⌘+r, ctrl+r': "keyHandlerFunction"
142
- # keyHandlerFunction: -> alert 'something + r was pressed'
143
- # ```
141
+ # application.configuration
142
+ # keyEvents:
143
+ # '⌘+r, ctrl+r': "keyHandlerFunction"
144
+ # keyHandlerFunction: -> alert 'something + r was pressed'
144
145
  keyEvents: {}
145
146
 
146
- # applications have one component, the controller.
147
- # any components defined on the application class directly
148
- # will get wrapped by the main controller unless you
149
- # set useController = false
150
- components:[
151
- type: 'template'
152
- name: 'welcome'
153
- template: 'sample/welcome'
154
- templateContainer: "Luca.templates"
155
- ]
156
-
157
- # create getter methods for the various
158
- # roles in the application's components on the
159
- # application itself. false by default.
147
+ # create getter methods for the various roles in the application's components on the application itself.
160
148
  createRoleBasedGetters: false
161
149
 
162
- # create an instance of Luca.SocketManager
163
- # which is a Backbone.Events style abstraction that
150
+ # create an instance of Luca.SocketManager which is a Backbone.Events style abstraction that
164
151
  # sits on top of services like faye, or socket.io
165
152
  useSocketManager: false
166
153
  socketManagerOptions: {}
167
154
 
168
- # Don't create getters on this component
169
- # for the nested components
155
+ application.publicMethods
156
+ # Creating your Application and all of its components and pages is
157
+ # generally as simple as creating an instance of your Application class:
158
+ # Luca.onReady ()->
159
+ # window.MyApp = new Luca.Application()
160
+ # window.MyApp.boot()
170
161
  initialize: (@options={})->
171
162
  app = @
172
163
  appName = @name
@@ -254,7 +245,8 @@ application.publicConfiguration
254
245
  @get("active_sub_section")
255
246
 
256
247
  activePages: ()->
257
- @$('.luca-ui-controller').map (index,element)=> $(element).data('active-section')
248
+ console.log "This method will be getting removed in Luca 1.0"
249
+ @$('.luca-controller').map (index,element)=> $(element).data('active-section')
258
250
 
259
251
  # boot should trigger the ready event, which will call the initial call
260
252
  # to render() your application, which will have a cascading effect on every
@@ -274,47 +266,31 @@ application.publicConfiguration
274
266
  collection: ()->
275
267
  @collectionManager.getOrCreate.apply(@collectionManager, arguments)
276
268
 
269
+ # Get an attribute from our internal state machine
277
270
  get: (attribute)->
278
271
  @state.get(attribute)
279
272
 
273
+ # Set an attribute on our internal state machine
280
274
  set: (attribute, value, options)->
281
275
  @state.set.apply(@state, arguments)
282
276
 
277
+ # Access a named view by its @name property.
283
278
  view: (name)->
284
279
  Luca.cache(name)
285
280
 
286
- #### Navigation Hooks
287
- #
288
281
  # delegate to the main controller so that we can switch the active section
282
+ # easily directly from the application. If passed a callback, this function
283
+ # will get called in the context of the activated component. This method is useful
284
+ # inside of custom route handlers if you are manually defining them on a `Backbone.Router`
285
+ # instead of using the built in `@routes` helper.
289
286
  navigate_to: (component_name, callback)->
290
287
  @getMainController().navigate_to(component_name, callback)
291
288
 
292
- application.privateInterface
293
- keyHandler: (e)->
294
- return unless e and @keyEvents
295
-
296
- isInputEvent = $(e.target).is('input') || $(e.target).is('textarea')
297
-
298
- return if isInputEvent
299
-
300
- keyname = Luca.keyMap[ e.keyCode ]
301
-
302
- return unless keyname
303
-
304
- meta = e?.metaKey is true
305
- control = e?.ctrlKey is true
306
-
307
- source = @keyEvents
308
- source = if meta then @keyEvents.meta else source
309
- source = if control then @keyEvents.control else source
310
- source = if meta and control then @keyEvents.meta_control else source
311
-
312
- if keyEvent = source?[keyname]
313
- if @[keyEvent]? and _.isFunction(@[keyEvent])
314
- @[keyEvent]?.call(@, e, keyname, keyEvent)
315
- else
316
- @trigger(keyEvent, e, keyname)
317
-
289
+ application.privateMethods
290
+ # Any time the Application's main controller changes its active page
291
+ # we track the name of that page ( aka section ) on our state machine.
292
+ # If the active page on the main controller is another controller component,
293
+ # then we will track that controller's active component as our active sub section.
318
294
  setupControllerBindings: ()->
319
295
  app = @
320
296
  # any time the main controller card switches we should track
@@ -332,6 +308,12 @@ application.privateInterface
332
308
  @state.set(active_sub_section:current.name)
333
309
  app.trigger "action:change", previous.name, current.name
334
310
 
311
+ # A typical structure for a Luca.Application is that it will act as a `Viewport` which
312
+ # monopolizes the entire top level element in your dom ( either the body tag, or a top
313
+ # level element just underneath it) This `Viewport` is an abstract element where we can
314
+ # setup global event bindings, like keyBindings and such. The `Viewport` will generally
315
+ # contain a `Luca.components.Controller` instance called "main_controller" that is responsible
316
+ # for displaying the active page for a given route.
335
317
  setupMainController: ()->
336
318
  if @useController is true
337
319
  definedComponents = @components || []
@@ -385,12 +367,18 @@ application.privateInterface
385
367
  collectionManagerOptions.autoStart = false
386
368
  @collectionManager = new @collectionManagerClass( collectionManagerOptions )
387
369
 
370
+ # If our application is configured with a `@socketManagerOptions` property,
371
+ # it will create a socket manager instance for us automatically. It won't
372
+ # start the socket manager process until the `@boot()` method is called on the application.
388
373
  setupSocketManager: ()->
389
374
  return if _.isEmpty(@socketManagerOptions)
390
375
  _.extend(@socketManagerOptions, autoStart: false)
391
376
 
392
377
  @socket = new Luca.SocketManager(@socketManagerOptions)
393
-
378
+
379
+ # Sets up an instance of the Backbone.Router, and sets up the
380
+ # call to start the history tracking API once the appropriate
381
+ # application events have been fired.
394
382
  setupRouter: ()->
395
383
  return if not @router? and not @routes?
396
384
 
@@ -421,6 +409,9 @@ application.privateInterface
421
409
  @autoStartHistory = "before:render" if @autoStartHistory is true
422
410
  @defer( Luca.Application.startHistory, false).until(@, @autoStartHistory)
423
411
 
412
+ # The default implementation of setupKeyHandler is kept around for backward
413
+ # compatibility purposes. In Luca 1.0 we will be using keymaster.js for our
414
+ # key binding setup.
424
415
  setupKeyHandler: ()->
425
416
  return unless @keyEvents
426
417
 
@@ -434,11 +425,12 @@ application.privateInterface
434
425
  for keyEvent in (@keypressEvents || ["keydown"])
435
426
  $( document ).on( keyEvent, handler )
436
427
 
437
- application.classInterface
428
+ application.classMethods
438
429
  instances:{}
439
430
 
440
- # Public: For purely informational purposes, describes the structure
441
- # of the Application's controller views, and any of their nested controllers views.
431
+ # An application inspection helper, it describes the structure of this application's
432
+ # controlled components. For an application that consists of multiple nested controllers
433
+ # it will recursively walk each controller and build a tree of the various pages / controlers.
442
434
  pageHierarchy: ()->
443
435
  app = Luca()
444
436
  mainController = app.getMainController()
@@ -455,19 +447,15 @@ application.classInterface
455
447
 
456
448
  getTree( mainController )
457
449
 
458
- # Private: registers the instance of the Luca.Appliction
450
+ # Registers this instance of the Luca.Appliction
459
451
  # so that it is available via the Luca() helper, or through
460
- # a call to Luca.Application.get()
452
+ # a call to Luca.Application.get().
461
453
  registerInstance: (app)->
462
454
  Luca.Application.instances[ app.name ] = app
463
455
 
464
- # Keymaster understands the following modifiers:
465
- # `⇧`, `shift`, `option`, `⌥`, `alt`, `ctrl`, `control`, `command`, and `⌘`.
466
-
467
- # The following special keys can be used for shortcuts:
468
- # `backspace`, `tab`, `clear`, `enter`, `return`, `esc`, `escape`, `space`,
469
- # `up`, `down`, `left`, `right`, `home`, `end`, `pageup`, `pagedown`, `del`, `delete`
470
- # and `f1` through `f19`.
456
+ # If the keymaster library is present, swap out the
457
+ # setupKeyHandler method with something which will enable
458
+ # keymaster support instead of our legacy system.
471
459
  checkForKeymaster: ()->
472
460
  if window?.key?.noConflict
473
461
  Luca.key = window.key.noConflict()
@@ -476,13 +464,12 @@ application.classInterface
476
464
  return unless @keyEvents
477
465
  Luca.util.setupKeymaster(@keyEvents, "all").on(@)
478
466
 
479
- # Private: Recursively navigates down the controller page hierarchy
480
- # to the page you specify by name. You can specify the
481
- # method which is to be called at the end of the chain.
482
- #
483
467
  # This is used internally by the Application as it sets up
484
468
  # the @routes property and uses it to configure the Luca.Router
485
- # instance for your app.
469
+ # instance for your app. It allows you to specify the page you want
470
+ # to monopolize the viewport in your application by name, and regardless
471
+ # of how deeply nested that page may be among your controllers, it will know
472
+ # what to do.
486
473
  routeTo: (pages...)->
487
474
  last = _( pages ).last()
488
475
  first = _( pages ).first()
@@ -494,7 +481,7 @@ application.classInterface
494
481
  path = @app || Luca()
495
482
  index = 0
496
483
 
497
- # we can specify a page by name, and not have to know its full path
484
+ # we can specify a page by name, and not have to know its full path.
498
485
  if pages.length is 1 and target = Luca(first)
499
486
  pages = target.controllerPath()
500
487
 
@@ -504,6 +491,9 @@ application.classInterface
504
491
  target = Luca(page)
505
492
 
506
493
  if page is last
494
+ if specifiedAction? and not target[specifiedAction]? and not target.routeHandler?
495
+ console.log "You specified a component action to call when a route matches, but it does not exist on the component"
496
+
507
497
  callback = if specifiedAction? and target[ specifiedAction ]?
508
498
  _.bind(target[ specifiedAction ], target)
509
499
  else if target.routeHandler?
@@ -528,7 +518,10 @@ application.classInterface
528
518
  # modify how Backbone.history.start is called. This will get called
529
519
  # by the Application instance in response to the @autoStartHistory property.
530
520
  startHistory: ()->
531
- Backbone.history.start()
521
+ Backbone.history.start
522
+ pushState: @pushState
523
+ rootUrl: @rootUrl
524
+ silent: @startHistorySilently
532
525
 
533
526
  application.afterDefinition ()->
534
527
  Luca.routeHelper = Luca.Application.routeTo
@@ -151,15 +151,19 @@ collectionView.publicMethods
151
151
  if models.length is 0
152
152
  @trigger("empty:results", query, options)
153
153
 
154
- index = 0
155
- for model in models
156
- @$append @makeItem(model, index++)
154
+ @renderModels(models, query, options)
157
155
 
158
156
  @trigger("after:refresh", models, query, options)
159
157
 
160
158
  @
161
159
 
160
+
162
161
  collectionView.privateMethods
162
+ renderModels: (models, query, options)->
163
+ index = 0
164
+ for model in models
165
+ @$append @makeItem(model, index++)
166
+
163
167
  # Determines which attributes should be set on the item DOM element.
164
168
  attributesForItem: (item, model)->
165
169
  _.extend {}, class: @itemClassName, "data-index": item.index, "data-model-id": item.model.get('id')
@@ -178,14 +182,14 @@ collectionView.privateMethods
178
182
 
179
183
  ""
180
184
 
181
- # Uses the various options passed to the `CollectionView` to assemble a call to `Backbone.View::make`.
185
+ # Uses the various options passed to the `CollectionView` to assemble a call to `Luca.View::make`.
182
186
  makeItem: (model, index)->
183
187
  item = if @prepareItem? then @prepareItem.call(@, model, index) else (model:model, index: index)
184
188
  attributes = @attributesForItem(item, model)
185
189
  content = @contentForItem(item)
186
190
 
187
191
  try
188
- Backbone.View::make(@itemTagName, attributes, content)
192
+ Luca.View::make(@itemTagName, attributes, content)
189
193
  catch e
190
194
  console.log "Error generating DOM element for CollectionView", @, model, index
191
195