Permalink
Browse files

trying to update to working copy

  • Loading branch information...
martypdx committed Nov 1, 2012
1 parent 28d779a commit 81db48ebb346a0d6942e5739155aeafe5d9be439
Showing with 29,657 additions and 112 deletions.
  1. +1 −5 features/editor/layout/layout.html
  2. +18 −10 features/editor/layout/layout.jade
  3. +4 −4 features/editor/layout/layout.json
  4. 0 features/template-selector/feature-list/feature-list.css
  5. 0 features/template-selector/feature-list/feature-list.jade
  6. 0 features/template-selector/feature-list/feature-list.js
  7. 0 features/template-selector/feature-list/feature-list.json
  8. +1 −1 features/template-selector/template-mixin/template-mixin.jade
  9. +0 −1 lib/common
  10. +40 −0 lib/common/app-template.js
  11. +155 −0 lib/common/template-service.js
  12. 0 package.json
  13. 0 public/css/editors.css
  14. 0 public/css/main.css
  15. 0 public/css/panes.css
  16. BIN public/images/delete.png
  17. BIN public/images/horizontal_resize.png
  18. BIN public/images/horizontal_resize_old.png
  19. BIN public/images/move.png
  20. BIN public/images/quad_resize.png
  21. BIN public/images/quad_resize2.png
  22. BIN public/images/resize.png
  23. BIN public/images/views.png
  24. 0 public/index2.html
  25. 0 public/index_original.html
  26. 0 public/js/3rdParty/ace/ace-uncompressed.js
  27. 0 public/js/3rdParty/ace/ace.js
  28. 0 public/js/3rdParty/ace/cockpit-uncompressed.js
  29. 0 public/js/3rdParty/ace/cockpit.js
  30. 0 public/js/3rdParty/ace/keybinding-emacs.js
  31. 0 public/js/3rdParty/ace/keybinding-vim.js
  32. 0 public/js/3rdParty/ace/mode-c_cpp.js
  33. 0 public/js/3rdParty/ace/mode-clojure.js
  34. 0 public/js/3rdParty/ace/mode-coffee.js
  35. 0 public/js/3rdParty/ace/mode-csharp.js
  36. 0 public/js/3rdParty/ace/mode-css.js
  37. 0 public/js/3rdParty/ace/mode-groovy.js
  38. 0 public/js/3rdParty/ace/mode-html.js
  39. 0 public/js/3rdParty/ace/mode-java.js
  40. 0 public/js/3rdParty/ace/mode-javascript.js
  41. 0 public/js/3rdParty/ace/mode-json.js
  42. 0 public/js/3rdParty/ace/mode-ocaml.js
  43. 0 public/js/3rdParty/ace/mode-perl.js
  44. 0 public/js/3rdParty/ace/mode-php.js
  45. 0 public/js/3rdParty/ace/mode-python.js
  46. 0 public/js/3rdParty/ace/mode-ruby.js
  47. 0 public/js/3rdParty/ace/mode-scad.js
  48. 0 public/js/3rdParty/ace/mode-scala.js
  49. 0 public/js/3rdParty/ace/mode-scss.js
  50. 0 public/js/3rdParty/ace/mode-svg.js
  51. 0 public/js/3rdParty/ace/mode-textile.js
  52. 0 public/js/3rdParty/ace/mode-xml.js
  53. 0 public/js/3rdParty/ace/theme-clouds.js
  54. 0 public/js/3rdParty/ace/theme-clouds_midnight.js
  55. 0 public/js/3rdParty/ace/theme-cobalt.js
  56. 0 public/js/3rdParty/ace/theme-crimson_editor.js
  57. 0 public/js/3rdParty/ace/theme-dawn.js
  58. 0 public/js/3rdParty/ace/theme-eclipse.js
  59. 0 public/js/3rdParty/ace/theme-idle_fingers.js
  60. 0 public/js/3rdParty/ace/theme-kr_theme.js
  61. 0 public/js/3rdParty/ace/theme-merbivore.js
  62. 0 public/js/3rdParty/ace/theme-merbivore_soft.js
  63. 0 public/js/3rdParty/ace/theme-mono_industrial.js
  64. 0 public/js/3rdParty/ace/theme-monokai.js
  65. 0 public/js/3rdParty/ace/theme-pastel_on_dark.js
  66. 0 public/js/3rdParty/ace/theme-solarized_dark.js
  67. 0 public/js/3rdParty/ace/theme-solarized_light.js
  68. 0 public/js/3rdParty/ace/theme-textmate.js
  69. 0 public/js/3rdParty/ace/theme-twilight.js
  70. 0 public/js/3rdParty/ace/theme-vibrant_ink.js
  71. 0 public/js/3rdParty/ace/worker-coffee.js
  72. 0 public/js/3rdParty/ace/worker-css.js
  73. 0 public/js/3rdParty/ace/worker-javascript.js
  74. 0 public/js/3rdParty/beautify/beautify.min.js
  75. 0 public/js/3rdParty/dpm/diff_match_patch.js
  76. 0 public/js/3rdParty/dpm/diff_match_patch_uncompressed.js
  77. 0 public/js/3rdParty/event.drag.touch/jquery.event.drag.js
  78. 0 public/js/3rdParty/event.drag/jquery.event.drag.js
  79. 0 public/js/3rdParty/event.drag/jquery.event.drag.min.js
  80. +26 −0 public/js/3rdParty/jsrepl/evaluator.js
  81. +26 −0 public/js/3rdParty/jsrepl/jsrepl.js
  82. +35 −0 public/js/3rdParty/jsrepl/langs/bloop/jsrepl_bloop.coffee
  83. +83 −0 public/js/3rdParty/jsrepl/langs/brainfuck/jsrepl_brainfuck.coffee
  84. +68 −0 public/js/3rdParty/jsrepl/langs/coffee-script/jsrepl_coffee.coffee
  85. +77 −0 public/js/3rdParty/jsrepl/langs/emoticon/jsrepl_emoticon.coffee
  86. +90 −0 public/js/3rdParty/jsrepl/langs/forth/jsrepl_forth.coffee
  87. +34 −0 public/js/3rdParty/jsrepl/langs/javascript/jsrepl_js.coffee
  88. +74 −0 public/js/3rdParty/jsrepl/langs/kaffeine/jsrepl_kaffeine.coffee
  89. +114 −0 public/js/3rdParty/jsrepl/langs/lolcode/jsrepl_lolcode.coffee
  90. +30 −0 public/js/3rdParty/jsrepl/langs/lua/jsrepl_lua.coffee
  91. +48 −0 public/js/3rdParty/jsrepl/langs/move/jsrepl_move.coffee
  92. +45 −0 public/js/3rdParty/jsrepl/langs/python/jsrepl_python.coffee
  93. +88 −0 public/js/3rdParty/jsrepl/langs/qbasic/jsrepl_qbasic.coffee
  94. +37 −0 public/js/3rdParty/jsrepl/langs/roy/jsrepl_roy.coffee
  95. +95 −0 public/js/3rdParty/jsrepl/langs/ruby/jsrepl_ruby.coffee
  96. +68 −0 public/js/3rdParty/jsrepl/langs/scheme/jsrepl_scheme.coffee
  97. +55 −0 public/js/3rdParty/jsrepl/langs/traceur/jsrepl_traceur.coffee
  98. +37 −0 public/js/3rdParty/jsrepl/langs/unlambda/jsrepl_unlambda.coffee
  99. +309 −0 public/js/3rdParty/jsrepl/sandbox.js
  100. +0 −1 public/js/common
  101. +8 −0 public/js/common/3rdParty/Raphael/raphael-min.js
  102. +445 −0 public/js/common/3rdParty/event.drag.touch/jquery.event.drag.js
  103. +388 −0 public/js/common/3rdParty/event.drag/jquery.event.drag.js
  104. +6 −0 public/js/common/3rdParty/event.drag/jquery.event.drag.min.js
  105. +119 −0 public/js/common/3rdParty/humane-dates/humane-dates.js
  106. +3,163 −0 public/js/common/3rdParty/jade/jade.js
  107. +2,759 −0 public/js/common/3rdParty/jade/jade_modified.js
  108. +492 −0 public/js/common/3rdParty/jade/my.jade.js
  109. +55 −0 public/js/common/3rdParty/jade/research/locals.js
  110. +16 −0 public/js/common/3rdParty/jquery/jquery-1.6.js
  111. +9,300 −0 public/js/common/3rdParty/jquery/jquery.js
  112. +4,135 −0 public/js/common/3rdParty/jsPlumb/jquery.jsPlumb-1.2.6.js
  113. +5,929 −0 public/js/common/3rdParty/jsPlumb/jquery.jsPlumb.js
  114. +1 −0 public/js/common/3rdParty/jsPlumb/jquery.jsPlumb.min.js
  115. +52 −0 public/js/common/3rdParty/microevent/microevent.js
  116. +610 −0 public/js/common/3rdParty/move/move.js
  117. +47 −0 public/js/common/animations.js
  118. +87 −0 public/js/common/drag.js
  119. +184 −0 public/js/common/templates.js
  120. +69 −77 public/js/editors.js
  121. +26 −8 public/js/jade-editor-load.js
  122. 0 public/js/panes.js
  123. 0 public/js/panes_old.js
  124. 0 public/js/panes_old2.js
  125. 0 public/js/sizer.js
  126. +39 −0 public/test.html
  127. +56 −0 public/test2.html
  128. +4 −1 server.js
  129. +9 −4 views/index.jade
@@ -1,5 +1 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html><head><style>
-</style><script src="//ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.js"></script></head><body>
-<script type="text/javascript">var template = $('body').children(':first-child')
-
-</script></body></html>
+<pre style="color: red;">ReferenceError: templateName is not defined</pre>
@@ -1,16 +1,24 @@
!!!
html
- head
- if css instanceof Array
- for style in css
- style
- !{style}
+ head
+ mixin stylesheet(feature, template, css)
+ style(feature=feature, template=template)
+ !{css}
+
+ if locals.styles
+ for style in styles
+ mixin stylesheet(style.feature, style.template, style.css)
else
- style
- !{css}
+ if locals.style
+ mixin stylesheet(style.feature, style.template, style.css)
+
script(src="js/common/3rdParty/jquery/jquery.js")
body
!{html}
- script(type="text/javascript")
- var template = $('body').children()
- !{javascript}
+ script(type="text/javascript")
+ if('#{templateName}' !== 'layout') {
+ (function(){
+ var template = $('body').children().eq(0)
+ templates['#{feature}']['#{templateName}'].activate(template)
+ })()
+ }
@@ -1,5 +1,5 @@
-{
- "css":"",
- "html":"",
- "javascript":""
+{
+ "css": "",
+ "html": "",
+ "javascript": ""
}
No changes.
No changes.
No changes.
No changes.
@@ -1,6 +1,6 @@
mixin template-link(feature, template)
li
- - var id = feature + "-" + template
+ - var id = feature + "/" + template
a.template(href='#' + id,
id=id,
feature=feature,
View
View
@@ -0,0 +1,40 @@
+var templateService = require('./template-service')
+var exportObject = {
+ attach: function(app, directory) {
+
+ var templates = templateService.getApp(directory)
+
+ app.get('/features/all', function (request, response) {
+ templates.getAll(function(err, data) {
+ response.send(data)
+ })
+ })
+
+ app.get('/features', function (request, response) {
+ templates.listAll(function(err, data) {
+ response.send(data)
+ })
+ })
+
+ app.get('/features/:feature/templates/:template', function (request, response) {
+ templates.getTemplate(request.params.feature, request.params.template, function(err, template) {
+ response.send(err || template)
+ })
+ })
+
+ app.get('/features/:feature/templates', function (request, response) {
+ templates.getTemplates(request.params.feature, function(err, templates) {
+ response.send(err || templates )
+ })
+ })
+
+ app.post('/features/:feature/templates/:templateName', function (request, response) {
+ templates.saveTemplate(request.params.feature, request.params.templateName,
+ request.param('template'), function(err) {
+ if(err) { console.log('template save error', err) }
+ response.end()
+ })
+ })
+ }
+}
+module.exports = exportObject
@@ -0,0 +1,155 @@
+var fs = require('fs')
+ , path = require('path')
+ , mkdirp = require('mkdirp')
+
+
+function Service(app) {
+
+ this.app = app
+ var service = this
+
+ var ensureDirExists = function(path, cb) {
+ mkdirp(path, 0755, function(err) {
+ err ? cb(err) : cb(null, path)
+ })
+ }
+ var getFeaturesDir = function(cb) {
+ ensureDirExists(path.join(app, 'features'), cb)
+ }
+ var getFeatureNames = function(cb) {
+ getFeaturesDir(function(err, featuresDir){
+ fs.readdir(featuresDir, cb)
+ })
+ }
+ var getFeatureDir = function(feature, cb) {
+ getFeaturesDir(function(err, featuresDir){
+ ensureDirExists(path.join(featuresDir, feature), cb)
+ })
+ }
+ var getTemplateDir = function(feature, template, cb) {
+ getFeatureDir(feature, function(err, featureDir){
+ ensureDirExists(path.join(featureDir, template), cb)
+ })
+ }
+ var getTemplateNames = function(feature, cb) {
+ getFeatureDir(feature, function(err, featureDir){
+ fs.readdir(featureDir, cb)
+ })
+ }
+
+ //hierarchical list of all features and templates
+ this.listAll = function(cb) {
+ getFeatureNames(function(err, features){
+ var results = { features: [] }
+ if(features.length === 0) { return cb(null, results) }
+
+ var gotFeature = function(feature) {
+ if(results.features.push(feature) === features.length) {
+ results.features.sort(function(a, b) {
+ return a.name < b.name ? -1 : 1
+ })
+ cb(null, results)
+ }
+ }
+
+ features.forEach(function(feature) {
+ getTemplateNames(feature, function(err, templates) {
+ gotFeature({ name: feature, templates: templates.sort() })
+ })
+ })
+ })
+ }
+
+ //all features and templates
+ this.getAll = function(cb) {
+ getFeatureNames(function(err, features){
+ var results = { features: [] }
+ if(features.length === 0) { return cb(null, results) }
+
+ var gotFeature = function(err, feature) {
+ if(results.features.push(feature) === features.length) {
+ cb(null, results)
+ }
+ }
+
+ features.forEach(function(feature) {
+ getTemplates(feature, gotFeature)
+ })
+ })
+ }
+
+ var templateParts = ['css', 'fn', 'html', 'jade', 'js', 'json']
+
+ var templateRoot = function(templateDir, template){
+ return path.join(templateDir, template + '.')
+ }
+
+ //get full template
+ var getTemplate = this.getTemplate = function(feature, template, cb) {
+
+ getTemplateDir(feature, template, function(err, templateDir) {
+ var parts = 0
+ var results = { name: template }
+ var root = templateRoot(templateDir, template)
+
+ var collect = function(name) {
+ fs.readFile(root + name, function(err, data) {
+ results[name] = (err) ? "" : data.toString()
+ parts++;
+ if(parts === templateParts.length) { cb(null, results) }
+ })
+ }
+ templateParts.forEach(collect)
+ })
+ }
+
+ //get all full templates for a feature
+ var getTemplates = this.getTemplates = function(feature, cb) {
+
+ getTemplateNames(feature, function(err, templates) {
+ var results = { name: feature, templates: [] }
+ if(templates.length === 0) { return cb(null, results) }
+
+ var gotTemplate = function(err, template) {
+ if(results.templates.push(template) === templates.length) {
+ cb(null, results)
+ }
+ }
+ templates.forEach(function(template) {
+ getTemplate(feature, template, gotTemplate)
+ })
+ })
+ }
+
+ //save full template
+ this.saveTemplate = function(feature, template, data, cb) {
+
+ getTemplateDir(feature, template, function(err, templateDir) {
+ var parts = 0
+ var results = {}
+ var root = templateRoot(templateDir, template)
+
+ var hasError
+ var save = function(name) {
+ fs.writeFile(root + name, data[name], function(err, data) {
+ if (err) {
+ hasError = true
+ results[name] = err
+ }
+ parts++;
+ if(parts === templateParts.length) { cb((hasError) ? results : null) }
+ })
+ }
+ templateParts.forEach(save)
+ })
+
+ }
+}
+
+
+var exportObject = {}
+exportObject.getApp = function(appDir) {
+ console.log('creating template service for app', appDir)
+ return new Service(appDir)
+}
+module.exports = exportObject
View
0 package.json 100755 → 100644
No changes.
View
0 public/css/editors.css 100755 → 100644
No changes.
View
0 public/css/main.css 100755 → 100644
No changes.
View
0 public/css/panes.css 100755 → 100644
No changes.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
0 public/images/quad_resize.png 100755 → 100644
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
0 public/images/quad_resize2.png 100755 → 100644
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
0 public/index2.html 100755 → 100644
No changes.
View
0 public/index_original.html 100755 → 100644
No changes.
View
No changes.
View
0 public/js/3rdParty/ace/ace.js 100755 → 100644
No changes.
View
No changes.
View
0 public/js/3rdParty/ace/cockpit.js 100755 → 100644
No changes.
View
No changes.
View
No changes.
View
No changes.
View
No changes.
View
No changes.
View
No changes.
View
No changes.
View
No changes.
View
No changes.
View
No changes.
View
No changes.
View
No changes.
View
No changes.
View
No changes.
View
No changes.
View
No changes.
View
No changes.
View
No changes.
View
No changes.
View
No changes.
View
No changes.
View
No changes.
View
No changes.
View
No changes.
View
No changes.
View
No changes.
View
No changes.
View
No changes.
View
No changes.
View
No changes.
View
No changes.
View
No changes.
View
No changes.
View
No changes.
View
No changes.
View
No changes.
View
No changes.
View
No changes.
View
No changes.
View
No changes.
View
No changes.
View
No changes.
View
No changes.
View
No changes.
View
No changes.
View
No changes.
No changes.
No changes.
View
No changes.
No changes.
@@ -0,0 +1,26 @@
+function Evaluator(cons) {
+ this.env = {};
+ this.cons = cons;
+}
+Evaluator.prototype.evaluate = function (str) {
+ try {
+ str = Evaluator.rewriteDeclarations(str);
+ var __environment__ = this.env;
+ var console = this.cons;
+ with (__environment__) {
+ return JSON.stringify(eval(str));
+ }
+ } catch (e) {
+ return e.toString();
+ }
+};
+Evaluator.rewriteDeclarations = function (str) {
+ // Prefix a newline so that search and replace is simpler
+ // (remove it before returning the result)
+ str = "\n" + str;
+
+ str = str.replace(/\nvar\s+(\w+)\s*=/g, "\n__environment__.$1 =");
+ str = str.replace(/\nfunction\s+(\w+)/g, "\n__environment__.$1 = function");
+
+ return str.slice(1);
+}
Oops, something went wrong.

0 comments on commit 81db48e

Please sign in to comment.